OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 |
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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 253 |
254 // Adjust the frame size, subsuming the unoptimized frame into the | 254 // Adjust the frame size, subsuming the unoptimized frame into the |
255 // optimized frame. | 255 // optimized frame. |
256 int slots = GetStackSlotCount() - graph()->osr()->UnoptimizedFrameSlots(); | 256 int slots = GetStackSlotCount() - graph()->osr()->UnoptimizedFrameSlots(); |
257 ASSERT(slots >= 0); | 257 ASSERT(slots >= 0); |
258 __ Subu(sp, sp, Operand(slots * kPointerSize)); | 258 __ Subu(sp, sp, Operand(slots * kPointerSize)); |
259 } | 259 } |
260 | 260 |
261 | 261 |
262 void LCodeGen::GenerateBodyInstructionPre(LInstruction* instr) { | 262 void LCodeGen::GenerateBodyInstructionPre(LInstruction* instr) { |
| 263 if (instr->IsCall()) { |
| 264 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); |
| 265 } |
263 if (!instr->IsLazyBailout() && !instr->IsGap()) { | 266 if (!instr->IsLazyBailout() && !instr->IsGap()) { |
264 safepoints_.BumpLastLazySafepointIndex(); | 267 safepoints_.BumpLastLazySafepointIndex(); |
265 } | 268 } |
266 } | 269 } |
267 | 270 |
268 | 271 |
269 bool LCodeGen::GenerateDeferredCode() { | 272 bool LCodeGen::GenerateDeferredCode() { |
270 ASSERT(is_generating()); | 273 ASSERT(is_generating()); |
271 if (deferred_.length() > 0) { | 274 if (deferred_.length() > 0) { |
272 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { | 275 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { |
(...skipping 5265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5538 __ nop(); | 5541 __ nop(); |
5539 padding_size -= Assembler::kInstrSize; | 5542 padding_size -= Assembler::kInstrSize; |
5540 } | 5543 } |
5541 } | 5544 } |
5542 } | 5545 } |
5543 last_lazy_deopt_pc_ = masm()->pc_offset(); | 5546 last_lazy_deopt_pc_ = masm()->pc_offset(); |
5544 } | 5547 } |
5545 | 5548 |
5546 | 5549 |
5547 void LCodeGen::DoLazyBailout(LLazyBailout* instr) { | 5550 void LCodeGen::DoLazyBailout(LLazyBailout* instr) { |
5548 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); | 5551 last_lazy_deopt_pc_ = masm()->pc_offset(); |
5549 ASSERT(instr->HasEnvironment()); | 5552 ASSERT(instr->HasEnvironment()); |
5550 LEnvironment* env = instr->environment(); | 5553 LEnvironment* env = instr->environment(); |
5551 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); | 5554 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); |
5552 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 5555 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
5553 } | 5556 } |
5554 | 5557 |
5555 | 5558 |
5556 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { | 5559 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { |
5557 Deoptimizer::BailoutType type = instr->hydrogen()->type(); | 5560 Deoptimizer::BailoutType type = instr->hydrogen()->type(); |
5558 // TODO(danno): Stubs expect all deopts to be lazy for historical reasons (the | 5561 // TODO(danno): Stubs expect all deopts to be lazy for historical reasons (the |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5610 if (instr->hydrogen()->is_function_entry()) { | 5613 if (instr->hydrogen()->is_function_entry()) { |
5611 // Perform stack overflow check. | 5614 // Perform stack overflow check. |
5612 Label done; | 5615 Label done; |
5613 __ LoadRoot(at, Heap::kStackLimitRootIndex); | 5616 __ LoadRoot(at, Heap::kStackLimitRootIndex); |
5614 __ Branch(&done, hs, sp, Operand(at)); | 5617 __ Branch(&done, hs, sp, Operand(at)); |
5615 ASSERT(instr->context()->IsRegister()); | 5618 ASSERT(instr->context()->IsRegister()); |
5616 ASSERT(ToRegister(instr->context()).is(cp)); | 5619 ASSERT(ToRegister(instr->context()).is(cp)); |
5617 CallCode(isolate()->builtins()->StackCheck(), | 5620 CallCode(isolate()->builtins()->StackCheck(), |
5618 RelocInfo::CODE_TARGET, | 5621 RelocInfo::CODE_TARGET, |
5619 instr); | 5622 instr); |
5620 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); | |
5621 __ bind(&done); | 5623 __ bind(&done); |
5622 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); | |
5623 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | |
5624 } else { | 5624 } else { |
5625 ASSERT(instr->hydrogen()->is_backwards_branch()); | 5625 ASSERT(instr->hydrogen()->is_backwards_branch()); |
5626 // Perform stack overflow check if this goto needs it before jumping. | 5626 // Perform stack overflow check if this goto needs it before jumping. |
5627 DeferredStackCheck* deferred_stack_check = | 5627 DeferredStackCheck* deferred_stack_check = |
5628 new(zone()) DeferredStackCheck(this, instr); | 5628 new(zone()) DeferredStackCheck(this, instr); |
5629 __ LoadRoot(at, Heap::kStackLimitRootIndex); | 5629 __ LoadRoot(at, Heap::kStackLimitRootIndex); |
5630 __ Branch(deferred_stack_check->entry(), lo, sp, Operand(at)); | 5630 __ Branch(deferred_stack_check->entry(), lo, sp, Operand(at)); |
5631 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); | 5631 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); |
5632 __ bind(instr->done_label()); | 5632 __ bind(instr->done_label()); |
5633 deferred_stack_check->SetExit(instr->done_label()); | 5633 deferred_stack_check->SetExit(instr->done_label()); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5742 __ Subu(scratch, result, scratch); | 5742 __ Subu(scratch, result, scratch); |
5743 __ lw(result, FieldMemOperand(scratch, | 5743 __ lw(result, FieldMemOperand(scratch, |
5744 FixedArray::kHeaderSize - kPointerSize)); | 5744 FixedArray::kHeaderSize - kPointerSize)); |
5745 __ bind(&done); | 5745 __ bind(&done); |
5746 } | 5746 } |
5747 | 5747 |
5748 | 5748 |
5749 #undef __ | 5749 #undef __ |
5750 | 5750 |
5751 } } // namespace v8::internal | 5751 } } // namespace v8::internal |
OLD | NEW |