OLD | NEW |
---|---|
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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
248 if (current_instruction_ < instructions_->length() - 1) { | 248 if (current_instruction_ < instructions_->length() - 1) { |
249 return instructions_->at(current_instruction_ + 1); | 249 return instructions_->at(current_instruction_ + 1); |
250 } else { | 250 } else { |
251 return NULL; | 251 return NULL; |
252 } | 252 } |
253 } | 253 } |
254 | 254 |
255 | 255 |
256 bool LCodeGen::GenerateDeferredCode() { | 256 bool LCodeGen::GenerateDeferredCode() { |
257 ASSERT(is_generating()); | 257 ASSERT(is_generating()); |
258 Label last_jump; | |
259 if (deferred_.length() > 0) { | 258 if (deferred_.length() > 0) { |
260 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { | 259 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { |
261 LDeferredCode* code = deferred_[i]; | 260 LDeferredCode* code = deferred_[i]; |
262 __ bind(code->entry()); | 261 __ bind(code->entry()); |
263 code->Generate(); | 262 code->Generate(); |
264 #ifdef DEBUG | |
265 if (i == deferred_.length() - 1) { | |
266 __ bind(&last_jump); | |
267 } | |
268 #endif | |
269 __ jmp(code->exit()); | 263 __ jmp(code->exit()); |
270 } | 264 } |
271 | 265 |
272 // Reserve some space to ensure that the last piece of deferred code | 266 // Pad code to ensure that the last piece of deferred code have |
273 // have room for lazy bailout. | 267 // room for lazy bailout. |
274 __ nop(); | 268 while ((masm()->pc_offset() - LastSafepointEnd()) |
275 __ nop(); | 269 < Deoptimizer::patch_size()) { |
276 __ nop(); | 270 __ nop(); |
277 | 271 } |
sra1
2011/07/06 17:13:03
This is much nicer. Thanks!
| |
278 ASSERT(Deoptimizer::patch_size() <= | |
279 masm_->SizeOfCodeGeneratedSince(&last_jump)); | |
280 } | 272 } |
281 | 273 |
282 // Deferred code is the last part of the instruction sequence. Mark | 274 // Deferred code is the last part of the instruction sequence. Mark |
283 // the generated code as done unless we bailed out. | 275 // the generated code as done unless we bailed out. |
284 if (!is_aborted()) status_ = DONE; | 276 if (!is_aborted()) status_ = DONE; |
285 return !is_aborted(); | 277 return !is_aborted(); |
286 } | 278 } |
287 | 279 |
288 | 280 |
289 bool LCodeGen::GenerateSafepointTable() { | 281 bool LCodeGen::GenerateSafepointTable() { |
(...skipping 3978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4268 env->deoptimization_index()); | 4260 env->deoptimization_index()); |
4269 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); | 4261 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
4270 } | 4262 } |
4271 | 4263 |
4272 | 4264 |
4273 #undef __ | 4265 #undef __ |
4274 | 4266 |
4275 } } // namespace v8::internal | 4267 } } // namespace v8::internal |
4276 | 4268 |
4277 #endif // V8_TARGET_ARCH_IA32 | 4269 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |