Index: src/compiler/instruction.h |
diff --git a/src/compiler/instruction.h b/src/compiler/instruction.h |
index ee7865dec05541934ecfaa4a182220ce10385f18..1299995891ee6331c2c359f3c4a38858ee25ee9b 100644 |
--- a/src/compiler/instruction.h |
+++ b/src/compiler/instruction.h |
@@ -1125,7 +1125,7 @@ std::ostream& operator<<(std::ostream& os, const Constant& constant); |
class FrameStateDescriptor; |
enum class StateValueKind : uint8_t { |
- kArguments, |
+ kArgumentsElements, |
kPlain, |
kOptimizedOut, |
kNested, |
@@ -1135,45 +1135,62 @@ enum class StateValueKind : uint8_t { |
class StateValueDescriptor { |
public: |
StateValueDescriptor() |
- : kind_(StateValueKind::kPlain), |
- type_(MachineType::AnyTagged()), |
- id_(0) {} |
+ : kind_(StateValueKind::kPlain), type_(MachineType::AnyTagged()) {} |
- static StateValueDescriptor Arguments() { |
- return StateValueDescriptor(StateValueKind::kArguments, |
- MachineType::AnyTagged(), 0); |
+ static StateValueDescriptor ArgumentsElements(bool is_rest) { |
+ StateValueDescriptor descr(StateValueKind::kArgumentsElements, |
+ MachineType::AnyTagged()); |
+ descr.is_rest_ = is_rest; |
+ return descr; |
} |
static StateValueDescriptor Plain(MachineType type) { |
- return StateValueDescriptor(StateValueKind::kPlain, type, 0); |
+ return StateValueDescriptor(StateValueKind::kPlain, type); |
} |
static StateValueDescriptor OptimizedOut() { |
return StateValueDescriptor(StateValueKind::kOptimizedOut, |
- MachineType::AnyTagged(), 0); |
+ MachineType::AnyTagged()); |
} |
static StateValueDescriptor Recursive(size_t id) { |
- return StateValueDescriptor(StateValueKind::kNested, |
- MachineType::AnyTagged(), id); |
+ StateValueDescriptor descr(StateValueKind::kNested, |
+ MachineType::AnyTagged()); |
+ descr.id_ = id; |
+ return descr; |
} |
static StateValueDescriptor Duplicate(size_t id) { |
- return StateValueDescriptor(StateValueKind::kDuplicate, |
- MachineType::AnyTagged(), id); |
+ StateValueDescriptor descr(StateValueKind::kDuplicate, |
+ MachineType::AnyTagged()); |
+ descr.id_ = id; |
+ return descr; |
} |
- bool IsArguments() const { return kind_ == StateValueKind::kArguments; } |
+ bool IsArgumentsElements() const { |
+ return kind_ == StateValueKind::kArgumentsElements; |
+ } |
bool IsPlain() const { return kind_ == StateValueKind::kPlain; } |
bool IsOptimizedOut() const { return kind_ == StateValueKind::kOptimizedOut; } |
bool IsNested() const { return kind_ == StateValueKind::kNested; } |
bool IsDuplicate() const { return kind_ == StateValueKind::kDuplicate; } |
MachineType type() const { return type_; } |
- size_t id() const { return id_; } |
+ size_t id() const { |
+ DCHECK(kind_ == StateValueKind::kDuplicate || |
+ kind_ == StateValueKind::kNested); |
+ return id_; |
+ } |
+ int is_rest() const { |
+ DCHECK(kind_ == StateValueKind::kArgumentsElements); |
+ return is_rest_; |
+ } |
private: |
- StateValueDescriptor(StateValueKind kind, MachineType type, size_t id) |
- : kind_(kind), type_(type), id_(id) {} |
+ StateValueDescriptor(StateValueKind kind, MachineType type) |
+ : kind_(kind), type_(type) {} |
StateValueKind kind_; |
MachineType type_; |
- size_t id_; |
+ union { |
+ size_t id_; |
+ bool is_rest_; |
+ }; |
}; |
class StateValueList { |
@@ -1232,7 +1249,9 @@ class StateValueList { |
nested_.push_back(nested); |
return nested; |
} |
- void PushArguments() { fields_.push_back(StateValueDescriptor::Arguments()); } |
+ void PushArgumentsElements(bool is_rest) { |
+ fields_.push_back(StateValueDescriptor::ArgumentsElements(is_rest)); |
+ } |
void PushDuplicate(size_t id) { |
fields_.push_back(StateValueDescriptor::Duplicate(id)); |
} |