| 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(), exit->pos()); | 199 AssembleDeoptimizerCall(exit->deoptimization_id(), Deoptimizer::EAGER, |
| 200 exit->pos()); |
| 200 } | 201 } |
| 201 | 202 |
| 202 // Ensure there is space for lazy deoptimization in the code. | 203 // Ensure there is space for lazy deoptimization in the code. |
| 203 if (info->ShouldEnsureSpaceForLazyDeopt()) { | 204 if (info->ShouldEnsureSpaceForLazyDeopt()) { |
| 204 int target_offset = masm()->pc_offset() + Deoptimizer::patch_size(); | 205 int target_offset = masm()->pc_offset() + Deoptimizer::patch_size(); |
| 205 while (masm()->pc_offset() < target_offset) { | 206 while (masm()->pc_offset() < target_offset) { |
| 206 masm()->nop(); | 207 masm()->nop(); |
| 207 } | 208 } |
| 208 } | 209 } |
| 209 | 210 |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 return result; | 665 return result; |
| 665 } | 666 } |
| 666 | 667 |
| 667 DeoptimizationEntry const& CodeGenerator::GetDeoptimizationEntry( | 668 DeoptimizationEntry const& CodeGenerator::GetDeoptimizationEntry( |
| 668 Instruction* instr, size_t frame_state_offset) { | 669 Instruction* instr, size_t frame_state_offset) { |
| 669 InstructionOperandConverter i(this, instr); | 670 InstructionOperandConverter i(this, instr); |
| 670 int const state_id = i.InputInt32(frame_state_offset); | 671 int const state_id = i.InputInt32(frame_state_offset); |
| 671 return code()->GetDeoptimizationEntry(state_id); | 672 return code()->GetDeoptimizationEntry(state_id); |
| 672 } | 673 } |
| 673 | 674 |
| 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 | |
| 681 DeoptimizeReason CodeGenerator::GetDeoptimizationReason( | 675 DeoptimizeReason CodeGenerator::GetDeoptimizationReason( |
| 682 int deoptimization_id) const { | 676 int deoptimization_id) const { |
| 683 size_t const index = static_cast<size_t>(deoptimization_id); | 677 size_t const index = static_cast<size_t>(deoptimization_id); |
| 684 DCHECK_LT(index, deoptimization_states_.size()); | 678 DCHECK_LT(index, deoptimization_states_.size()); |
| 685 return deoptimization_states_[index]->reason(); | 679 return deoptimization_states_[index]->reason(); |
| 686 } | 680 } |
| 687 | 681 |
| 688 void CodeGenerator::TranslateStateValueDescriptor( | 682 void CodeGenerator::TranslateStateValueDescriptor( |
| 689 StateValueDescriptor* desc, StateValueList* nested, | 683 StateValueDescriptor* desc, StateValueList* nested, |
| 690 Translation* translation, InstructionOperandIterator* iter) { | 684 Translation* translation, InstructionOperandIterator* iter) { |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 Translation translation( | 829 Translation translation( |
| 836 &translations_, static_cast<int>(descriptor->GetFrameCount()), | 830 &translations_, static_cast<int>(descriptor->GetFrameCount()), |
| 837 static_cast<int>(descriptor->GetJSFrameCount()), zone()); | 831 static_cast<int>(descriptor->GetJSFrameCount()), zone()); |
| 838 InstructionOperandIterator iter(instr, frame_state_offset); | 832 InstructionOperandIterator iter(instr, frame_state_offset); |
| 839 BuildTranslationForFrameStateDescriptor(descriptor, &iter, &translation, | 833 BuildTranslationForFrameStateDescriptor(descriptor, &iter, &translation, |
| 840 state_combine); | 834 state_combine); |
| 841 | 835 |
| 842 int deoptimization_id = static_cast<int>(deoptimization_states_.size()); | 836 int deoptimization_id = static_cast<int>(deoptimization_states_.size()); |
| 843 | 837 |
| 844 deoptimization_states_.push_back(new (zone()) DeoptimizationState( | 838 deoptimization_states_.push_back(new (zone()) DeoptimizationState( |
| 845 descriptor->bailout_id(), translation.index(), pc_offset, entry.kind(), | 839 descriptor->bailout_id(), translation.index(), pc_offset, |
| 846 entry.reason())); | 840 entry.reason())); |
| 847 | 841 |
| 848 return deoptimization_id; | 842 return deoptimization_id; |
| 849 } | 843 } |
| 850 | 844 |
| 851 | 845 |
| 852 void CodeGenerator::AddTranslationForOperand(Translation* translation, | 846 void CodeGenerator::AddTranslationForOperand(Translation* translation, |
| 853 Instruction* instr, | 847 Instruction* instr, |
| 854 InstructionOperand* op, | 848 InstructionOperand* op, |
| 855 MachineType type) { | 849 MachineType type) { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { | 985 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { |
| 992 gen->ools_ = this; | 986 gen->ools_ = this; |
| 993 } | 987 } |
| 994 | 988 |
| 995 | 989 |
| 996 OutOfLineCode::~OutOfLineCode() {} | 990 OutOfLineCode::~OutOfLineCode() {} |
| 997 | 991 |
| 998 } // namespace compiler | 992 } // namespace compiler |
| 999 } // namespace internal | 993 } // namespace internal |
| 1000 } // namespace v8 | 994 } // namespace v8 |
| OLD | NEW |