OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
6 #include "src/compiler/graph.h" | 6 #include "src/compiler/graph.h" |
7 #include "src/compiler/instruction.h" | 7 #include "src/compiler/instruction.h" |
8 #include "src/compiler/schedule.h" | 8 #include "src/compiler/schedule.h" |
9 #include "src/compiler/state-values-utils.h" | 9 #include "src/compiler/state-values-utils.h" |
10 | 10 |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 DCHECK_LT(virtual_register, VirtualRegisterCount()); | 829 DCHECK_LT(virtual_register, VirtualRegisterCount()); |
830 if (virtual_register >= static_cast<int>(representations_.size())) { | 830 if (virtual_register >= static_cast<int>(representations_.size())) { |
831 representations_.resize(VirtualRegisterCount(), DefaultRepresentation()); | 831 representations_.resize(VirtualRegisterCount(), DefaultRepresentation()); |
832 } | 832 } |
833 rep = FilterRepresentation(rep); | 833 rep = FilterRepresentation(rep); |
834 DCHECK_IMPLIES(representations_[virtual_register] != rep, | 834 DCHECK_IMPLIES(representations_[virtual_register] != rep, |
835 representations_[virtual_register] == DefaultRepresentation()); | 835 representations_[virtual_register] == DefaultRepresentation()); |
836 representations_[virtual_register] = rep; | 836 representations_[virtual_register] = rep; |
837 } | 837 } |
838 | 838 |
839 | 839 int InstructionSequence::AddDeoptimizationEntry( |
840 InstructionSequence::StateId InstructionSequence::AddFrameStateDescriptor( | 840 FrameStateDescriptor* descriptor, DeoptimizeReason reason) { |
841 FrameStateDescriptor* descriptor) { | |
842 int deoptimization_id = static_cast<int>(deoptimization_entries_.size()); | 841 int deoptimization_id = static_cast<int>(deoptimization_entries_.size()); |
843 deoptimization_entries_.push_back(descriptor); | 842 deoptimization_entries_.push_back(DeoptimizationEntry(descriptor, reason)); |
844 return StateId::FromInt(deoptimization_id); | 843 return deoptimization_id; |
845 } | 844 } |
846 | 845 |
847 FrameStateDescriptor* InstructionSequence::GetFrameStateDescriptor( | 846 DeoptimizationEntry const& InstructionSequence::GetDeoptimizationEntry( |
848 InstructionSequence::StateId state_id) { | 847 int state_id) { |
849 return deoptimization_entries_[state_id.ToInt()]; | 848 return deoptimization_entries_[state_id]; |
850 } | 849 } |
851 | 850 |
852 | 851 |
853 int InstructionSequence::GetFrameStateDescriptorCount() { | |
854 return static_cast<int>(deoptimization_entries_.size()); | |
855 } | |
856 | |
857 | |
858 RpoNumber InstructionSequence::InputRpo(Instruction* instr, size_t index) { | 852 RpoNumber InstructionSequence::InputRpo(Instruction* instr, size_t index) { |
859 InstructionOperand* operand = instr->InputAt(index); | 853 InstructionOperand* operand = instr->InputAt(index); |
860 Constant constant = | 854 Constant constant = |
861 operand->IsImmediate() | 855 operand->IsImmediate() |
862 ? GetImmediate(ImmediateOperand::cast(operand)) | 856 ? GetImmediate(ImmediateOperand::cast(operand)) |
863 : GetConstant(ConstantOperand::cast(operand)->virtual_register()); | 857 : GetConstant(ConstantOperand::cast(operand)->virtual_register()); |
864 return constant.ToRpoNumber(); | 858 return constant.ToRpoNumber(); |
865 } | 859 } |
866 | 860 |
867 | 861 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 } | 1021 } |
1028 for (int i = 0; i < code.InstructionBlockCount(); i++) { | 1022 for (int i = 0; i < code.InstructionBlockCount(); i++) { |
1029 printable.sequence_->PrintBlock(printable.register_configuration_, i); | 1023 printable.sequence_->PrintBlock(printable.register_configuration_, i); |
1030 } | 1024 } |
1031 return os; | 1025 return os; |
1032 } | 1026 } |
1033 | 1027 |
1034 } // namespace compiler | 1028 } // namespace compiler |
1035 } // namespace internal | 1029 } // namespace internal |
1036 } // namespace v8 | 1030 } // namespace v8 |
OLD | NEW |