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

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

Issue 10546095: AssemblerBase does not need remember a Zone. Fix this. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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/ia32/assembler-ia32.cc ('k') | src/x64/assembler-x64.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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
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();
132 info.pc = assembler->pc_offset(); 131 info.pc = assembler->pc_offset();
133 info.arguments = arguments; 132 info.arguments = arguments;
134 info.has_doubles = (kind & Safepoint::kWithDoubles); 133 info.has_doubles = (kind & Safepoint::kWithDoubles);
135 deoptimization_info_.Add(info, zone); 134 deoptimization_info_.Add(info, zone_);
136 deopt_index_list_.Add(Safepoint::kNoDeoptimizationIndex, zone); 135 deopt_index_list_.Add(Safepoint::kNoDeoptimizationIndex, zone_);
137 if (deopt_mode == Safepoint::kNoLazyDeopt) { 136 if (deopt_mode == Safepoint::kNoLazyDeopt) {
138 last_lazy_safepoint_ = deopt_index_list_.length(); 137 last_lazy_safepoint_ = deopt_index_list_.length();
139 } 138 }
140 indexes_.Add(new(zone) ZoneList<int>(8, zone), zone); 139 indexes_.Add(new(zone_) ZoneList<int>(8, zone_), zone_);
141 registers_.Add((kind & Safepoint::kWithRegisters) 140 registers_.Add((kind & Safepoint::kWithRegisters)
142 ? new(zone) ZoneList<int>(4, zone) 141 ? new(zone_) ZoneList<int>(4, zone_)
143 : NULL, 142 : NULL,
144 zone); 143 zone_);
145 return Safepoint(indexes_.last(), registers_.last()); 144 return Safepoint(indexes_.last(), registers_.last());
146 } 145 }
147 146
148 147
149 void SafepointTableBuilder::RecordLazyDeoptimizationIndex(int index) { 148 void SafepointTableBuilder::RecordLazyDeoptimizationIndex(int index) {
150 while (last_lazy_safepoint_ < deopt_index_list_.length()) { 149 while (last_lazy_safepoint_ < deopt_index_list_.length()) {
151 deopt_index_list_[last_lazy_safepoint_++] = index; 150 deopt_index_list_[last_lazy_safepoint_++] = index;
152 } 151 }
153 } 152 }
154 153
155 unsigned SafepointTableBuilder::GetCodeOffset() const { 154 unsigned SafepointTableBuilder::GetCodeOffset() const {
156 ASSERT(emitted_); 155 ASSERT(emitted_);
157 return offset_; 156 return offset_;
158 } 157 }
159 158
160 159
161 void SafepointTableBuilder::Emit(Assembler* assembler, int bits_per_entry) { 160 void SafepointTableBuilder::Emit(Assembler* assembler, int bits_per_entry) {
162 // For lazy deoptimization we need space to patch a call after every call. 161 // For lazy deoptimization we need space to patch a call after every call.
163 // Ensure there is always space for such patching, even if the code ends 162 // Ensure there is always space for such patching, even if the code ends
164 // in a call. 163 // in a call.
165 Zone* zone = assembler->zone();
166 int target_offset = assembler->pc_offset() + Deoptimizer::patch_size(); 164 int target_offset = assembler->pc_offset() + Deoptimizer::patch_size();
167 while (assembler->pc_offset() < target_offset) { 165 while (assembler->pc_offset() < target_offset) {
168 assembler->nop(); 166 assembler->nop();
169 } 167 }
170 168
171 // Make sure the safepoint table is properly aligned. Pad with nops. 169 // Make sure the safepoint table is properly aligned. Pad with nops.
172 assembler->Align(kIntSize); 170 assembler->Align(kIntSize);
173 assembler->RecordComment(";;; Safepoint table."); 171 assembler->RecordComment(";;; Safepoint table.");
174 offset_ = assembler->pc_offset(); 172 offset_ = assembler->pc_offset();
175 173
(...skipping 10 matching lines...) Expand all
186 assembler->dd(bytes_per_entry); 184 assembler->dd(bytes_per_entry);
187 185
188 // Emit sorted table of pc offsets together with deoptimization indexes. 186 // Emit sorted table of pc offsets together with deoptimization indexes.
189 for (int i = 0; i < length; i++) { 187 for (int i = 0; i < length; i++) {
190 assembler->dd(deoptimization_info_[i].pc); 188 assembler->dd(deoptimization_info_[i].pc);
191 assembler->dd(EncodeExceptPC(deoptimization_info_[i], 189 assembler->dd(EncodeExceptPC(deoptimization_info_[i],
192 deopt_index_list_[i])); 190 deopt_index_list_[i]));
193 } 191 }
194 192
195 // Emit table of bitmaps. 193 // Emit table of bitmaps.
196 ZoneList<uint8_t> bits(bytes_per_entry, zone); 194 ZoneList<uint8_t> bits(bytes_per_entry, zone_);
197 for (int i = 0; i < length; i++) { 195 for (int i = 0; i < length; i++) {
198 ZoneList<int>* indexes = indexes_[i]; 196 ZoneList<int>* indexes = indexes_[i];
199 ZoneList<int>* registers = registers_[i]; 197 ZoneList<int>* registers = registers_[i];
200 bits.Clear(); 198 bits.Clear();
201 bits.AddBlock(0, bytes_per_entry, zone); 199 bits.AddBlock(0, bytes_per_entry, zone_);
202 200
203 // Run through the registers (if any). 201 // Run through the registers (if any).
204 ASSERT(IsAligned(kNumSafepointRegisters, kBitsPerByte)); 202 ASSERT(IsAligned(kNumSafepointRegisters, kBitsPerByte));
205 if (registers == NULL) { 203 if (registers == NULL) {
206 const int num_reg_bytes = kNumSafepointRegisters >> kBitsPerByteLog2; 204 const int num_reg_bytes = kNumSafepointRegisters >> kBitsPerByteLog2;
207 for (int j = 0; j < num_reg_bytes; j++) { 205 for (int j = 0; j < num_reg_bytes; j++) {
208 bits[j] = SafepointTable::kNoRegisters; 206 bits[j] = SafepointTable::kNoRegisters;
209 } 207 }
210 } else { 208 } else {
211 for (int j = 0; j < registers->length(); j++) { 209 for (int j = 0; j < registers->length(); j++) {
(...skipping 26 matching lines...) Expand all
238 unsigned index) { 236 unsigned index) {
239 uint32_t encoding = SafepointEntry::DeoptimizationIndexField::encode(index); 237 uint32_t encoding = SafepointEntry::DeoptimizationIndexField::encode(index);
240 encoding |= SafepointEntry::ArgumentsField::encode(info.arguments); 238 encoding |= SafepointEntry::ArgumentsField::encode(info.arguments);
241 encoding |= SafepointEntry::SaveDoublesField::encode(info.has_doubles); 239 encoding |= SafepointEntry::SaveDoublesField::encode(info.has_doubles);
242 return encoding; 240 return encoding;
243 } 241 }
244 242
245 243
246 244
247 } } // namespace v8::internal 245 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/assembler-ia32.cc ('k') | src/x64/assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698