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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 if (current_instruction_ < instructions_->length() - 1) { | 250 if (current_instruction_ < instructions_->length() - 1) { |
251 return instructions_->at(current_instruction_ + 1); | 251 return instructions_->at(current_instruction_ + 1); |
252 } else { | 252 } else { |
253 return NULL; | 253 return NULL; |
254 } | 254 } |
255 } | 255 } |
256 | 256 |
257 | 257 |
258 bool LCodeGen::GenerateDeferredCode() { | 258 bool LCodeGen::GenerateDeferredCode() { |
259 ASSERT(is_generating()); | 259 ASSERT(is_generating()); |
260 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { | 260 Label last_jump; |
261 LDeferredCode* code = deferred_[i]; | 261 if (deferred_.length() > 0) { |
262 __ bind(code->entry()); | 262 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { |
263 code->Generate(); | 263 LDeferredCode* code = deferred_[i]; |
264 __ jmp(code->exit()); | 264 __ bind(code->entry()); |
| 265 code->Generate(); |
| 266 #ifdef DEBUG |
| 267 if (i == deferred_.length() - 1) { |
| 268 __ bind(&last_jump); |
| 269 } |
| 270 #endif |
| 271 __ jmp(code->exit()); |
| 272 } |
| 273 |
| 274 // Reserve some space to ensure that the last piece of deferred code |
| 275 // have room for lazy bailout. |
| 276 __ nop(); |
| 277 __ nop(); |
| 278 |
| 279 int code_generated = |
| 280 masm_->InstructionsGeneratedSince(&last_jump) * Assembler::kInstrSize; |
| 281 ASSERT(Deoptimizer::patch_size() <= code_generated); |
265 } | 282 } |
266 | 283 |
267 // Force constant pool emission at the end of the deferred code to make | 284 // Force constant pool emission at the end of the deferred code to make |
268 // sure that no constant pools are emitted after. | 285 // sure that no constant pools are emitted after. |
269 masm()->CheckConstPool(true, false); | 286 masm()->CheckConstPool(true, false); |
270 | 287 |
271 return !is_aborted(); | 288 return !is_aborted(); |
272 } | 289 } |
273 | 290 |
274 | 291 |
(...skipping 4040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4315 RecordPosition(pointers->position()); | 4332 RecordPosition(pointers->position()); |
4316 RegisterEnvironmentForDeoptimization(env); | 4333 RegisterEnvironmentForDeoptimization(env); |
4317 SafepointGenerator safepoint_generator(this, | 4334 SafepointGenerator safepoint_generator(this, |
4318 pointers, | 4335 pointers, |
4319 env->deoptimization_index()); | 4336 env->deoptimization_index()); |
4320 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); | 4337 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
4321 } | 4338 } |
4322 | 4339 |
4323 | 4340 |
4324 void LCodeGen::DoDeferredStackCheck(LStackCheck* instr) { | 4341 void LCodeGen::DoDeferredStackCheck(LStackCheck* instr) { |
4325 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); | 4342 { |
4326 CallRuntimeFromDeferred(Runtime::kStackGuard, 0, instr); | 4343 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); |
| 4344 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); |
| 4345 RegisterLazyDeoptimization( |
| 4346 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); |
| 4347 } |
| 4348 |
| 4349 // The gap code includes the restoring of the safepoint registers. |
| 4350 int pc = masm()->pc_offset(); |
| 4351 safepoints_.SetPcAfterGap(pc); |
4327 } | 4352 } |
4328 | 4353 |
4329 | 4354 |
4330 void LCodeGen::DoStackCheck(LStackCheck* instr) { | 4355 void LCodeGen::DoStackCheck(LStackCheck* instr) { |
4331 class DeferredStackCheck: public LDeferredCode { | 4356 class DeferredStackCheck: public LDeferredCode { |
4332 public: | 4357 public: |
4333 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) | 4358 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) |
4334 : LDeferredCode(codegen), instr_(instr) { } | 4359 : LDeferredCode(codegen), instr_(instr) { } |
4335 virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); } | 4360 virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); } |
4336 private: | 4361 private: |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4375 ASSERT(osr_pc_offset_ == -1); | 4400 ASSERT(osr_pc_offset_ == -1); |
4376 osr_pc_offset_ = masm()->pc_offset(); | 4401 osr_pc_offset_ = masm()->pc_offset(); |
4377 } | 4402 } |
4378 | 4403 |
4379 | 4404 |
4380 | 4405 |
4381 | 4406 |
4382 #undef __ | 4407 #undef __ |
4383 | 4408 |
4384 } } // namespace v8::internal | 4409 } } // namespace v8::internal |
OLD | NEW |