Index: src/compiler/instruction.h |
diff --git a/src/compiler/instruction.h b/src/compiler/instruction.h |
index 76bc09b6164ab835c527991117642281a2cb2d9b..b839acf6a66f3301baa252c34c7bce69b58128e8 100644 |
--- a/src/compiler/instruction.h |
+++ b/src/compiler/instruction.h |
@@ -1161,9 +1161,23 @@ class FrameStateDescriptor : public ZoneObject { |
FrameStateDescriptor* outer_state_; |
}; |
+// A deoptimization entry is a pair of the reason why we deoptimize and the |
+// frame state descriptor that we have to go back to. |
+class DeoptimizationEntry final { |
+ public: |
+ DeoptimizationEntry() {} |
+ DeoptimizationEntry(FrameStateDescriptor* descriptor, DeoptimizeReason reason) |
+ : descriptor_(descriptor), reason_(reason) {} |
+ |
+ FrameStateDescriptor* descriptor() const { return descriptor_; } |
+ DeoptimizeReason reason() const { return reason_; } |
-typedef ZoneVector<FrameStateDescriptor*> DeoptimizationVector; |
+ private: |
+ FrameStateDescriptor* descriptor_ = nullptr; |
+ DeoptimizeReason reason_ = DeoptimizeReason::kNoReason; |
+}; |
+typedef ZoneVector<DeoptimizationEntry> DeoptimizationVector; |
class PhiInstruction final : public ZoneObject { |
public: |
@@ -1414,21 +1428,11 @@ class InstructionSequence final : public ZoneObject { |
return Constant(static_cast<int32_t>(0)); |
} |
- class StateId { |
- public: |
- static StateId FromInt(int id) { return StateId(id); } |
- int ToInt() const { return id_; } |
- |
- private: |
- explicit StateId(int id) : id_(id) {} |
- int id_; |
- }; |
- |
- StateId AddFrameStateDescriptor(FrameStateDescriptor* descriptor); |
- FrameStateDescriptor* GetFrameStateDescriptor(StateId deoptimization_id); |
- int GetFrameStateDescriptorCount(); |
- DeoptimizationVector const& frame_state_descriptors() const { |
- return deoptimization_entries_; |
+ int AddDeoptimizationEntry(FrameStateDescriptor* descriptor, |
+ DeoptimizeReason reason); |
+ DeoptimizationEntry const& GetDeoptimizationEntry(int deoptimization_id); |
+ int GetDeoptimizationEntryCount() const { |
+ return static_cast<int>(deoptimization_entries_.size()); |
} |
RpoNumber InputRpo(Instruction* instr, size_t index); |