OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/address-map.h" | 7 #include "src/address-map.h" |
8 #include "src/base/adapters.h" | 8 #include "src/base/adapters.h" |
9 #include "src/compilation-info.h" | 9 #include "src/compilation-info.h" |
10 #include "src/compiler/code-generator-impl.h" | 10 #include "src/compiler/code-generator-impl.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 for (OutOfLineCode* ool = ools_; ool; ool = ool->next()) { | 189 for (OutOfLineCode* ool = ools_; ool; ool = ool->next()) { |
190 masm()->bind(ool->entry()); | 190 masm()->bind(ool->entry()); |
191 ool->Generate(); | 191 ool->Generate(); |
192 if (ool->exit()->is_bound()) masm()->jmp(ool->exit()); | 192 if (ool->exit()->is_bound()) masm()->jmp(ool->exit()); |
193 } | 193 } |
194 } | 194 } |
195 | 195 |
196 // Assemble all eager deoptimization exits. | 196 // Assemble all eager deoptimization exits. |
197 for (DeoptimizationExit* exit : deoptimization_exits_) { | 197 for (DeoptimizationExit* exit : deoptimization_exits_) { |
198 masm()->bind(exit->label()); | 198 masm()->bind(exit->label()); |
199 AssembleDeoptimizerCall(exit->deoptimization_id(), Deoptimizer::EAGER, | 199 AssembleDeoptimizerCall(exit->deoptimization_id(), exit->pos()); |
200 exit->pos()); | |
201 } | 200 } |
202 | 201 |
203 // Ensure there is space for lazy deoptimization in the code. | 202 // Ensure there is space for lazy deoptimization in the code. |
204 if (info->ShouldEnsureSpaceForLazyDeopt()) { | 203 if (info->ShouldEnsureSpaceForLazyDeopt()) { |
205 int target_offset = masm()->pc_offset() + Deoptimizer::patch_size(); | 204 int target_offset = masm()->pc_offset() + Deoptimizer::patch_size(); |
206 while (masm()->pc_offset() < target_offset) { | 205 while (masm()->pc_offset() < target_offset) { |
207 masm()->nop(); | 206 masm()->nop(); |
208 } | 207 } |
209 } | 208 } |
210 | 209 |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 return result; | 664 return result; |
666 } | 665 } |
667 | 666 |
668 DeoptimizationEntry const& CodeGenerator::GetDeoptimizationEntry( | 667 DeoptimizationEntry const& CodeGenerator::GetDeoptimizationEntry( |
669 Instruction* instr, size_t frame_state_offset) { | 668 Instruction* instr, size_t frame_state_offset) { |
670 InstructionOperandConverter i(this, instr); | 669 InstructionOperandConverter i(this, instr); |
671 int const state_id = i.InputInt32(frame_state_offset); | 670 int const state_id = i.InputInt32(frame_state_offset); |
672 return code()->GetDeoptimizationEntry(state_id); | 671 return code()->GetDeoptimizationEntry(state_id); |
673 } | 672 } |
674 | 673 |
| 674 DeoptimizeKind CodeGenerator::GetDeoptimizationKind( |
| 675 int deoptimization_id) const { |
| 676 size_t const index = static_cast<size_t>(deoptimization_id); |
| 677 DCHECK_LT(index, deoptimization_states_.size()); |
| 678 return deoptimization_states_[index]->kind(); |
| 679 } |
| 680 |
675 DeoptimizeReason CodeGenerator::GetDeoptimizationReason( | 681 DeoptimizeReason CodeGenerator::GetDeoptimizationReason( |
676 int deoptimization_id) const { | 682 int deoptimization_id) const { |
677 size_t const index = static_cast<size_t>(deoptimization_id); | 683 size_t const index = static_cast<size_t>(deoptimization_id); |
678 DCHECK_LT(index, deoptimization_states_.size()); | 684 DCHECK_LT(index, deoptimization_states_.size()); |
679 return deoptimization_states_[index]->reason(); | 685 return deoptimization_states_[index]->reason(); |
680 } | 686 } |
681 | 687 |
682 void CodeGenerator::TranslateStateValueDescriptor( | 688 void CodeGenerator::TranslateStateValueDescriptor( |
683 StateValueDescriptor* desc, StateValueList* nested, | 689 StateValueDescriptor* desc, StateValueList* nested, |
684 Translation* translation, InstructionOperandIterator* iter) { | 690 Translation* translation, InstructionOperandIterator* iter) { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 Translation translation( | 835 Translation translation( |
830 &translations_, static_cast<int>(descriptor->GetFrameCount()), | 836 &translations_, static_cast<int>(descriptor->GetFrameCount()), |
831 static_cast<int>(descriptor->GetJSFrameCount()), zone()); | 837 static_cast<int>(descriptor->GetJSFrameCount()), zone()); |
832 InstructionOperandIterator iter(instr, frame_state_offset); | 838 InstructionOperandIterator iter(instr, frame_state_offset); |
833 BuildTranslationForFrameStateDescriptor(descriptor, &iter, &translation, | 839 BuildTranslationForFrameStateDescriptor(descriptor, &iter, &translation, |
834 state_combine); | 840 state_combine); |
835 | 841 |
836 int deoptimization_id = static_cast<int>(deoptimization_states_.size()); | 842 int deoptimization_id = static_cast<int>(deoptimization_states_.size()); |
837 | 843 |
838 deoptimization_states_.push_back(new (zone()) DeoptimizationState( | 844 deoptimization_states_.push_back(new (zone()) DeoptimizationState( |
839 descriptor->bailout_id(), translation.index(), pc_offset, | 845 descriptor->bailout_id(), translation.index(), pc_offset, entry.kind(), |
840 entry.reason())); | 846 entry.reason())); |
841 | 847 |
842 return deoptimization_id; | 848 return deoptimization_id; |
843 } | 849 } |
844 | 850 |
845 | 851 |
846 void CodeGenerator::AddTranslationForOperand(Translation* translation, | 852 void CodeGenerator::AddTranslationForOperand(Translation* translation, |
847 Instruction* instr, | 853 Instruction* instr, |
848 InstructionOperand* op, | 854 InstructionOperand* op, |
849 MachineType type) { | 855 MachineType type) { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { | 991 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { |
986 gen->ools_ = this; | 992 gen->ools_ = this; |
987 } | 993 } |
988 | 994 |
989 | 995 |
990 OutOfLineCode::~OutOfLineCode() {} | 996 OutOfLineCode::~OutOfLineCode() {} |
991 | 997 |
992 } // namespace compiler | 998 } // namespace compiler |
993 } // namespace internal | 999 } // namespace internal |
994 } // namespace v8 | 1000 } // namespace v8 |
OLD | NEW |