OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 if (FLAG_code_comments && instr->HasInterestingComment(this)) { | 270 if (FLAG_code_comments && instr->HasInterestingComment(this)) { |
271 Comment(";;; <@%d,#%d> %s", | 271 Comment(";;; <@%d,#%d> %s", |
272 current_instruction_, | 272 current_instruction_, |
273 instr->hydrogen_value()->id(), | 273 instr->hydrogen_value()->id(), |
274 instr->Mnemonic()); | 274 instr->Mnemonic()); |
275 } | 275 } |
276 | 276 |
277 instr->CompileToNative(this); | 277 instr->CompileToNative(this); |
278 } | 278 } |
279 EnsureSpaceForLazyDeopt(); | 279 EnsureSpaceForLazyDeopt(); |
| 280 last_lazy_deopt_pc_ = masm()->pc_offset(); |
280 return !is_aborted(); | 281 return !is_aborted(); |
281 } | 282 } |
282 | 283 |
283 | 284 |
284 bool LCodeGen::GenerateDeferredCode() { | 285 bool LCodeGen::GenerateDeferredCode() { |
285 ASSERT(is_generating()); | 286 ASSERT(is_generating()); |
286 if (deferred_.length() > 0) { | 287 if (deferred_.length() > 0) { |
287 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { | 288 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { |
288 LDeferredCode* code = deferred_[i]; | 289 LDeferredCode* code = deferred_[i]; |
289 Comment(";;; <@%d,#%d> " | 290 Comment(";;; <@%d,#%d> " |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 TargetAddressStorageMode storage_mode) { | 670 TargetAddressStorageMode storage_mode) { |
670 CallCodeGeneric(code, mode, instr, RECORD_SIMPLE_SAFEPOINT, storage_mode); | 671 CallCodeGeneric(code, mode, instr, RECORD_SIMPLE_SAFEPOINT, storage_mode); |
671 } | 672 } |
672 | 673 |
673 | 674 |
674 void LCodeGen::CallCodeGeneric(Handle<Code> code, | 675 void LCodeGen::CallCodeGeneric(Handle<Code> code, |
675 RelocInfo::Mode mode, | 676 RelocInfo::Mode mode, |
676 LInstruction* instr, | 677 LInstruction* instr, |
677 SafepointMode safepoint_mode, | 678 SafepointMode safepoint_mode, |
678 TargetAddressStorageMode storage_mode) { | 679 TargetAddressStorageMode storage_mode) { |
| 680 EnsureSpaceForLazyDeopt(); |
679 ASSERT(instr != NULL); | 681 ASSERT(instr != NULL); |
680 // Block literal pool emission to ensure nop indicating no inlined smi code | 682 // Block literal pool emission to ensure nop indicating no inlined smi code |
681 // is in the correct position. | 683 // is in the correct position. |
682 Assembler::BlockConstPoolScope block_const_pool(masm()); | 684 Assembler::BlockConstPoolScope block_const_pool(masm()); |
683 LPointerMap* pointers = instr->pointer_map(); | 685 LPointerMap* pointers = instr->pointer_map(); |
684 RecordPosition(pointers->position()); | 686 RecordPosition(pointers->position()); |
685 __ Call(code, mode, TypeFeedbackId::None(), al, storage_mode); | 687 __ Call(code, mode, TypeFeedbackId::None(), al, storage_mode); |
686 RecordSafepointWithLazyDeopt(instr, safepoint_mode); | 688 RecordSafepointWithLazyDeopt(instr, safepoint_mode); |
687 | 689 |
688 // Signal that we don't inline smi code before these stubs in the | 690 // Signal that we don't inline smi code before these stubs in the |
(...skipping 4914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5603 if (current_pc < last_lazy_deopt_pc_ + patch_size) { | 5605 if (current_pc < last_lazy_deopt_pc_ + patch_size) { |
5604 // Block literal pool emission for duration of padding. | 5606 // Block literal pool emission for duration of padding. |
5605 Assembler::BlockConstPoolScope block_const_pool(masm()); | 5607 Assembler::BlockConstPoolScope block_const_pool(masm()); |
5606 int padding_size = last_lazy_deopt_pc_ + patch_size - current_pc; | 5608 int padding_size = last_lazy_deopt_pc_ + patch_size - current_pc; |
5607 ASSERT_EQ(0, padding_size % Assembler::kInstrSize); | 5609 ASSERT_EQ(0, padding_size % Assembler::kInstrSize); |
5608 while (padding_size > 0) { | 5610 while (padding_size > 0) { |
5609 __ nop(); | 5611 __ nop(); |
5610 padding_size -= Assembler::kInstrSize; | 5612 padding_size -= Assembler::kInstrSize; |
5611 } | 5613 } |
5612 } | 5614 } |
5613 last_lazy_deopt_pc_ = masm()->pc_offset(); | |
5614 } | 5615 } |
5615 | 5616 |
5616 | 5617 |
5617 void LCodeGen::DoLazyBailout(LLazyBailout* instr) { | 5618 void LCodeGen::DoLazyBailout(LLazyBailout* instr) { |
5618 EnsureSpaceForLazyDeopt(); | 5619 EnsureSpaceForLazyDeopt(); |
| 5620 last_lazy_deopt_pc_ = masm()->pc_offset(); |
5619 ASSERT(instr->HasEnvironment()); | 5621 ASSERT(instr->HasEnvironment()); |
5620 LEnvironment* env = instr->environment(); | 5622 LEnvironment* env = instr->environment(); |
5621 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); | 5623 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); |
5622 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 5624 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
5623 } | 5625 } |
5624 | 5626 |
5625 | 5627 |
5626 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { | 5628 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { |
5627 if (instr->hydrogen_value()->IsSoftDeoptimize()) { | 5629 if (instr->hydrogen_value()->IsSoftDeoptimize()) { |
5628 SoftDeoptimize(instr->environment()); | 5630 SoftDeoptimize(instr->environment()); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5666 if (instr->hydrogen()->is_function_entry()) { | 5668 if (instr->hydrogen()->is_function_entry()) { |
5667 // Perform stack overflow check. | 5669 // Perform stack overflow check. |
5668 Label done; | 5670 Label done; |
5669 __ LoadRoot(ip, Heap::kStackLimitRootIndex); | 5671 __ LoadRoot(ip, Heap::kStackLimitRootIndex); |
5670 __ cmp(sp, Operand(ip)); | 5672 __ cmp(sp, Operand(ip)); |
5671 __ b(hs, &done); | 5673 __ b(hs, &done); |
5672 StackCheckStub stub; | 5674 StackCheckStub stub; |
5673 PredictableCodeSizeScope predictable(masm_, 2 * Assembler::kInstrSize); | 5675 PredictableCodeSizeScope predictable(masm_, 2 * Assembler::kInstrSize); |
5674 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 5676 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
5675 EnsureSpaceForLazyDeopt(); | 5677 EnsureSpaceForLazyDeopt(); |
| 5678 last_lazy_deopt_pc_ = masm()->pc_offset(); |
5676 __ bind(&done); | 5679 __ bind(&done); |
5677 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); | 5680 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); |
5678 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 5681 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
5679 } else { | 5682 } else { |
5680 ASSERT(instr->hydrogen()->is_backwards_branch()); | 5683 ASSERT(instr->hydrogen()->is_backwards_branch()); |
5681 // Perform stack overflow check if this goto needs it before jumping. | 5684 // Perform stack overflow check if this goto needs it before jumping. |
5682 DeferredStackCheck* deferred_stack_check = | 5685 DeferredStackCheck* deferred_stack_check = |
5683 new(zone()) DeferredStackCheck(this, instr); | 5686 new(zone()) DeferredStackCheck(this, instr); |
5684 __ LoadRoot(ip, Heap::kStackLimitRootIndex); | 5687 __ LoadRoot(ip, Heap::kStackLimitRootIndex); |
5685 __ cmp(sp, Operand(ip)); | 5688 __ cmp(sp, Operand(ip)); |
5686 __ b(lo, deferred_stack_check->entry()); | 5689 __ b(lo, deferred_stack_check->entry()); |
5687 EnsureSpaceForLazyDeopt(); | 5690 EnsureSpaceForLazyDeopt(); |
| 5691 last_lazy_deopt_pc_ = masm()->pc_offset(); |
5688 __ bind(instr->done_label()); | 5692 __ bind(instr->done_label()); |
5689 deferred_stack_check->SetExit(instr->done_label()); | 5693 deferred_stack_check->SetExit(instr->done_label()); |
5690 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); | 5694 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); |
5691 // Don't record a deoptimization index for the safepoint here. | 5695 // Don't record a deoptimization index for the safepoint here. |
5692 // This will be done explicitly when emitting call and the safepoint in | 5696 // This will be done explicitly when emitting call and the safepoint in |
5693 // the deferred code. | 5697 // the deferred code. |
5694 } | 5698 } |
5695 } | 5699 } |
5696 | 5700 |
5697 | 5701 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5802 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5806 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5803 __ ldr(result, FieldMemOperand(scratch, | 5807 __ ldr(result, FieldMemOperand(scratch, |
5804 FixedArray::kHeaderSize - kPointerSize)); | 5808 FixedArray::kHeaderSize - kPointerSize)); |
5805 __ bind(&done); | 5809 __ bind(&done); |
5806 } | 5810 } |
5807 | 5811 |
5808 | 5812 |
5809 #undef __ | 5813 #undef __ |
5810 | 5814 |
5811 } } // namespace v8::internal | 5815 } } // namespace v8::internal |
OLD | NEW |