Chromium Code Reviews| Index: src/compiler/instruction.h |
| diff --git a/src/compiler/instruction.h b/src/compiler/instruction.h |
| index f207c7622e90cc8d6144cdab4b3c69ff0f9ee510..114198cfd87394e4f8de8e8d2148e3dec61abb48 100644 |
| --- a/src/compiler/instruction.h |
| +++ b/src/compiler/instruction.h |
| @@ -1122,7 +1122,7 @@ std::ostream& operator<<(std::ostream& os, const Constant& constant); |
| class FrameStateDescriptor; |
| enum class StateValueKind : uint8_t { |
| - kArguments, |
| + kArgumentsElements, |
| kPlain, |
| kOptimizedOut, |
| kNested, |
| @@ -1132,45 +1132,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 { |
| @@ -1229,7 +1246,9 @@ class StateValueList { |
| nested_.push_back(nested); |
| return nested; |
| } |
| - void PushArguments() { fields_.push_back(StateValueDescriptor::Arguments()); } |
| + void PushArgumentsElements(int skip) { |
|
Jarin
2017/02/27 13:24:34
How about
int skip ==> bool is_rest
?
|
| + fields_.push_back(StateValueDescriptor::ArgumentsElements(skip)); |
| + } |
| void PushDuplicate(size_t id) { |
| fields_.push_back(StateValueDescriptor::Duplicate(id)); |
| } |