Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: src/safepoint-table.cc

Issue 10534006: Remove TLS access for current Zone. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review. Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/safepoint-table.h ('k') | src/scopeinfo.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 110
111 void SafepointTable::PrintBits(uint8_t byte, int digits) { 111 void SafepointTable::PrintBits(uint8_t byte, int digits) {
112 ASSERT(digits >= 0 && digits <= kBitsPerByte); 112 ASSERT(digits >= 0 && digits <= kBitsPerByte);
113 for (int i = 0; i < digits; i++) { 113 for (int i = 0; i < digits; i++) {
114 PrintF("%c", ((byte & (1 << i)) == 0) ? '0' : '1'); 114 PrintF("%c", ((byte & (1 << i)) == 0) ? '0' : '1');
115 } 115 }
116 } 116 }
117 117
118 118
119 void Safepoint::DefinePointerRegister(Register reg) { 119 void Safepoint::DefinePointerRegister(Register reg, Zone* zone) {
120 registers_->Add(reg.code()); 120 registers_->Add(reg.code(), zone);
121 } 121 }
122 122
123 123
124 Safepoint SafepointTableBuilder::DefineSafepoint( 124 Safepoint SafepointTableBuilder::DefineSafepoint(
125 Assembler* assembler, 125 Assembler* assembler,
126 Safepoint::Kind kind, 126 Safepoint::Kind kind,
127 int arguments, 127 int arguments,
128 Safepoint::DeoptMode deopt_mode) { 128 Safepoint::DeoptMode deopt_mode) {
129 ASSERT(arguments >= 0); 129 ASSERT(arguments >= 0);
130 DeoptimizationInfo info; 130 DeoptimizationInfo info;
131 Zone* zone = assembler->zone();
131 info.pc = assembler->pc_offset(); 132 info.pc = assembler->pc_offset();
132 info.arguments = arguments; 133 info.arguments = arguments;
133 info.has_doubles = (kind & Safepoint::kWithDoubles); 134 info.has_doubles = (kind & Safepoint::kWithDoubles);
134 deoptimization_info_.Add(info); 135 deoptimization_info_.Add(info, zone);
135 deopt_index_list_.Add(Safepoint::kNoDeoptimizationIndex); 136 deopt_index_list_.Add(Safepoint::kNoDeoptimizationIndex, zone);
136 if (deopt_mode == Safepoint::kNoLazyDeopt) { 137 if (deopt_mode == Safepoint::kNoLazyDeopt) {
137 last_lazy_safepoint_ = deopt_index_list_.length(); 138 last_lazy_safepoint_ = deopt_index_list_.length();
138 } 139 }
139 indexes_.Add(new ZoneList<int>(8)); 140 indexes_.Add(new(zone) ZoneList<int>(8, zone), zone);
140 registers_.Add((kind & Safepoint::kWithRegisters) 141 registers_.Add((kind & Safepoint::kWithRegisters)
141 ? new ZoneList<int>(4) 142 ? new(zone) ZoneList<int>(4, zone)
142 : NULL); 143 : NULL,
144 zone);
143 return Safepoint(indexes_.last(), registers_.last()); 145 return Safepoint(indexes_.last(), registers_.last());
144 } 146 }
145 147
146 148
147 void SafepointTableBuilder::RecordLazyDeoptimizationIndex(int index) { 149 void SafepointTableBuilder::RecordLazyDeoptimizationIndex(int index) {
148 while (last_lazy_safepoint_ < deopt_index_list_.length()) { 150 while (last_lazy_safepoint_ < deopt_index_list_.length()) {
149 deopt_index_list_[last_lazy_safepoint_++] = index; 151 deopt_index_list_[last_lazy_safepoint_++] = index;
150 } 152 }
151 } 153 }
152 154
153 unsigned SafepointTableBuilder::GetCodeOffset() const { 155 unsigned SafepointTableBuilder::GetCodeOffset() const {
154 ASSERT(emitted_); 156 ASSERT(emitted_);
155 return offset_; 157 return offset_;
156 } 158 }
157 159
158 160
159 void SafepointTableBuilder::Emit(Assembler* assembler, int bits_per_entry) { 161 void SafepointTableBuilder::Emit(Assembler* assembler, int bits_per_entry) {
160 // For lazy deoptimization we need space to patch a call after every call. 162 // For lazy deoptimization we need space to patch a call after every call.
161 // Ensure there is always space for such patching, even if the code ends 163 // Ensure there is always space for such patching, even if the code ends
162 // in a call. 164 // in a call.
165 Zone* zone = assembler->zone();
163 int target_offset = assembler->pc_offset() + Deoptimizer::patch_size(); 166 int target_offset = assembler->pc_offset() + Deoptimizer::patch_size();
164 while (assembler->pc_offset() < target_offset) { 167 while (assembler->pc_offset() < target_offset) {
165 assembler->nop(); 168 assembler->nop();
166 } 169 }
167 170
168 // Make sure the safepoint table is properly aligned. Pad with nops. 171 // Make sure the safepoint table is properly aligned. Pad with nops.
169 assembler->Align(kIntSize); 172 assembler->Align(kIntSize);
170 assembler->RecordComment(";;; Safepoint table."); 173 assembler->RecordComment(";;; Safepoint table.");
171 offset_ = assembler->pc_offset(); 174 offset_ = assembler->pc_offset();
172 175
(...skipping 10 matching lines...) Expand all
183 assembler->dd(bytes_per_entry); 186 assembler->dd(bytes_per_entry);
184 187
185 // Emit sorted table of pc offsets together with deoptimization indexes. 188 // Emit sorted table of pc offsets together with deoptimization indexes.
186 for (int i = 0; i < length; i++) { 189 for (int i = 0; i < length; i++) {
187 assembler->dd(deoptimization_info_[i].pc); 190 assembler->dd(deoptimization_info_[i].pc);
188 assembler->dd(EncodeExceptPC(deoptimization_info_[i], 191 assembler->dd(EncodeExceptPC(deoptimization_info_[i],
189 deopt_index_list_[i])); 192 deopt_index_list_[i]));
190 } 193 }
191 194
192 // Emit table of bitmaps. 195 // Emit table of bitmaps.
193 ZoneList<uint8_t> bits(bytes_per_entry); 196 ZoneList<uint8_t> bits(bytes_per_entry, zone);
194 for (int i = 0; i < length; i++) { 197 for (int i = 0; i < length; i++) {
195 ZoneList<int>* indexes = indexes_[i]; 198 ZoneList<int>* indexes = indexes_[i];
196 ZoneList<int>* registers = registers_[i]; 199 ZoneList<int>* registers = registers_[i];
197 bits.Clear(); 200 bits.Clear();
198 bits.AddBlock(0, bytes_per_entry); 201 bits.AddBlock(0, bytes_per_entry, zone);
199 202
200 // Run through the registers (if any). 203 // Run through the registers (if any).
201 ASSERT(IsAligned(kNumSafepointRegisters, kBitsPerByte)); 204 ASSERT(IsAligned(kNumSafepointRegisters, kBitsPerByte));
202 if (registers == NULL) { 205 if (registers == NULL) {
203 const int num_reg_bytes = kNumSafepointRegisters >> kBitsPerByteLog2; 206 const int num_reg_bytes = kNumSafepointRegisters >> kBitsPerByteLog2;
204 for (int j = 0; j < num_reg_bytes; j++) { 207 for (int j = 0; j < num_reg_bytes; j++) {
205 bits[j] = SafepointTable::kNoRegisters; 208 bits[j] = SafepointTable::kNoRegisters;
206 } 209 }
207 } else { 210 } else {
208 for (int j = 0; j < registers->length(); j++) { 211 for (int j = 0; j < registers->length(); j++) {
(...skipping 26 matching lines...) Expand all
235 unsigned index) { 238 unsigned index) {
236 uint32_t encoding = SafepointEntry::DeoptimizationIndexField::encode(index); 239 uint32_t encoding = SafepointEntry::DeoptimizationIndexField::encode(index);
237 encoding |= SafepointEntry::ArgumentsField::encode(info.arguments); 240 encoding |= SafepointEntry::ArgumentsField::encode(info.arguments);
238 encoding |= SafepointEntry::SaveDoublesField::encode(info.has_doubles); 241 encoding |= SafepointEntry::SaveDoublesField::encode(info.has_doubles);
239 return encoding; 242 return encoding;
240 } 243 }
241 244
242 245
243 246
244 } } // namespace v8::internal 247 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/safepoint-table.h ('k') | src/scopeinfo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698