| 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 5334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5607 __ nop(); | 5610 __ nop(); |
| 5608 padding_size -= Assembler::kInstrSize; | 5611 padding_size -= Assembler::kInstrSize; |
| 5609 } | 5612 } |
| 5610 } | 5613 } |
| 5611 } | 5614 } |
| 5612 last_lazy_deopt_pc_ = masm()->pc_offset(); | 5615 last_lazy_deopt_pc_ = masm()->pc_offset(); |
| 5613 } | 5616 } |
| 5614 | 5617 |
| 5615 | 5618 |
| 5616 void LCodeGen::DoLazyBailout(LLazyBailout* instr) { | 5619 void LCodeGen::DoLazyBailout(LLazyBailout* instr) { |
| 5617 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); | 5620 last_lazy_deopt_pc_ = masm()->pc_offset(); |
| 5618 ASSERT(instr->HasEnvironment()); | 5621 ASSERT(instr->HasEnvironment()); |
| 5619 LEnvironment* env = instr->environment(); | 5622 LEnvironment* env = instr->environment(); |
| 5620 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); | 5623 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); |
| 5621 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 5624 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
| 5622 } | 5625 } |
| 5623 | 5626 |
| 5624 | 5627 |
| 5625 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { | 5628 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { |
| 5626 Deoptimizer::BailoutType type = instr->hydrogen()->type(); | 5629 Deoptimizer::BailoutType type = instr->hydrogen()->type(); |
| 5627 // TODO(danno): Stubs expect all deopts to be lazy for historical reasons (the | 5630 // 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... |
| 5679 if (instr->hydrogen()->is_function_entry()) { | 5682 if (instr->hydrogen()->is_function_entry()) { |
| 5680 // Perform stack overflow check. | 5683 // Perform stack overflow check. |
| 5681 Label done; | 5684 Label done; |
| 5682 __ LoadRoot(at, Heap::kStackLimitRootIndex); | 5685 __ LoadRoot(at, Heap::kStackLimitRootIndex); |
| 5683 __ Branch(&done, hs, sp, Operand(at)); | 5686 __ Branch(&done, hs, sp, Operand(at)); |
| 5684 ASSERT(instr->context()->IsRegister()); | 5687 ASSERT(instr->context()->IsRegister()); |
| 5685 ASSERT(ToRegister(instr->context()).is(cp)); | 5688 ASSERT(ToRegister(instr->context()).is(cp)); |
| 5686 CallCode(isolate()->builtins()->StackCheck(), | 5689 CallCode(isolate()->builtins()->StackCheck(), |
| 5687 RelocInfo::CODE_TARGET, | 5690 RelocInfo::CODE_TARGET, |
| 5688 instr); | 5691 instr); |
| 5689 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); | |
| 5690 __ bind(&done); | 5692 __ bind(&done); |
| 5691 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); | |
| 5692 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | |
| 5693 } else { | 5693 } else { |
| 5694 ASSERT(instr->hydrogen()->is_backwards_branch()); | 5694 ASSERT(instr->hydrogen()->is_backwards_branch()); |
| 5695 // Perform stack overflow check if this goto needs it before jumping. | 5695 // Perform stack overflow check if this goto needs it before jumping. |
| 5696 DeferredStackCheck* deferred_stack_check = | 5696 DeferredStackCheck* deferred_stack_check = |
| 5697 new(zone()) DeferredStackCheck(this, instr); | 5697 new(zone()) DeferredStackCheck(this, instr); |
| 5698 __ LoadRoot(at, Heap::kStackLimitRootIndex); | 5698 __ LoadRoot(at, Heap::kStackLimitRootIndex); |
| 5699 __ Branch(deferred_stack_check->entry(), lo, sp, Operand(at)); | 5699 __ Branch(deferred_stack_check->entry(), lo, sp, Operand(at)); |
| 5700 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); | 5700 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); |
| 5701 __ bind(instr->done_label()); | 5701 __ bind(instr->done_label()); |
| 5702 deferred_stack_check->SetExit(instr->done_label()); | 5702 deferred_stack_check->SetExit(instr->done_label()); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5811 __ Subu(scratch, result, scratch); | 5811 __ Subu(scratch, result, scratch); |
| 5812 __ lw(result, FieldMemOperand(scratch, | 5812 __ lw(result, FieldMemOperand(scratch, |
| 5813 FixedArray::kHeaderSize - kPointerSize)); | 5813 FixedArray::kHeaderSize - kPointerSize)); |
| 5814 __ bind(&done); | 5814 __ bind(&done); |
| 5815 } | 5815 } |
| 5816 | 5816 |
| 5817 | 5817 |
| 5818 #undef __ | 5818 #undef __ |
| 5819 | 5819 |
| 5820 } } // namespace v8::internal | 5820 } } // namespace v8::internal |
| OLD | NEW |