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 #ifndef V8_COMPILER_INSTRUCTION_H_ | 5 #ifndef V8_COMPILER_INSTRUCTION_H_ |
6 #define V8_COMPILER_INSTRUCTION_H_ | 6 #define V8_COMPILER_INSTRUCTION_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <iosfwd> | 9 #include <iosfwd> |
10 #include <map> | 10 #include <map> |
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 }; | 1115 }; |
1116 | 1116 |
1117 | 1117 |
1118 std::ostream& operator<<(std::ostream& os, const Constant& constant); | 1118 std::ostream& operator<<(std::ostream& os, const Constant& constant); |
1119 | 1119 |
1120 | 1120 |
1121 // Forward declarations. | 1121 // Forward declarations. |
1122 class FrameStateDescriptor; | 1122 class FrameStateDescriptor; |
1123 | 1123 |
1124 enum class StateValueKind : uint8_t { | 1124 enum class StateValueKind : uint8_t { |
| 1125 kArguments, |
1125 kPlain, | 1126 kPlain, |
1126 kOptimizedOut, | 1127 kOptimizedOut, |
1127 kNested, | 1128 kNested, |
1128 kDuplicate | 1129 kDuplicate |
1129 }; | 1130 }; |
1130 | 1131 |
1131 class StateValueDescriptor { | 1132 class StateValueDescriptor { |
1132 public: | 1133 public: |
1133 StateValueDescriptor() | 1134 StateValueDescriptor() |
1134 : kind_(StateValueKind::kPlain), | 1135 : kind_(StateValueKind::kPlain), |
1135 type_(MachineType::AnyTagged()), | 1136 type_(MachineType::AnyTagged()), |
1136 id_(0) {} | 1137 id_(0) {} |
1137 | 1138 |
| 1139 static StateValueDescriptor Arguments() { |
| 1140 return StateValueDescriptor(StateValueKind::kArguments, |
| 1141 MachineType::AnyTagged(), 0); |
| 1142 } |
1138 static StateValueDescriptor Plain(MachineType type) { | 1143 static StateValueDescriptor Plain(MachineType type) { |
1139 return StateValueDescriptor(StateValueKind::kPlain, type, 0); | 1144 return StateValueDescriptor(StateValueKind::kPlain, type, 0); |
1140 } | 1145 } |
1141 static StateValueDescriptor OptimizedOut() { | 1146 static StateValueDescriptor OptimizedOut() { |
1142 return StateValueDescriptor(StateValueKind::kOptimizedOut, | 1147 return StateValueDescriptor(StateValueKind::kOptimizedOut, |
1143 MachineType::AnyTagged(), 0); | 1148 MachineType::AnyTagged(), 0); |
1144 } | 1149 } |
1145 static StateValueDescriptor Recursive(size_t id) { | 1150 static StateValueDescriptor Recursive(size_t id) { |
1146 return StateValueDescriptor(StateValueKind::kNested, | 1151 return StateValueDescriptor(StateValueKind::kNested, |
1147 MachineType::AnyTagged(), id); | 1152 MachineType::AnyTagged(), id); |
1148 } | 1153 } |
1149 static StateValueDescriptor Duplicate(size_t id) { | 1154 static StateValueDescriptor Duplicate(size_t id) { |
1150 return StateValueDescriptor(StateValueKind::kDuplicate, | 1155 return StateValueDescriptor(StateValueKind::kDuplicate, |
1151 MachineType::AnyTagged(), id); | 1156 MachineType::AnyTagged(), id); |
1152 } | 1157 } |
1153 | 1158 |
1154 int IsPlain() { return kind_ == StateValueKind::kPlain; } | 1159 bool IsArguments() const { return kind_ == StateValueKind::kArguments; } |
1155 int IsOptimizedOut() { return kind_ == StateValueKind::kOptimizedOut; } | 1160 bool IsPlain() const { return kind_ == StateValueKind::kPlain; } |
1156 int IsNested() { return kind_ == StateValueKind::kNested; } | 1161 bool IsOptimizedOut() const { return kind_ == StateValueKind::kOptimizedOut; } |
1157 int IsDuplicate() { return kind_ == StateValueKind::kDuplicate; } | 1162 bool IsNested() const { return kind_ == StateValueKind::kNested; } |
| 1163 bool IsDuplicate() const { return kind_ == StateValueKind::kDuplicate; } |
1158 MachineType type() const { return type_; } | 1164 MachineType type() const { return type_; } |
1159 size_t id() const { return id_; } | 1165 size_t id() const { return id_; } |
1160 | 1166 |
1161 private: | 1167 private: |
1162 StateValueDescriptor(StateValueKind kind, MachineType type, size_t id) | 1168 StateValueDescriptor(StateValueKind kind, MachineType type, size_t id) |
1163 : kind_(kind), type_(type), id_(id) {} | 1169 : kind_(kind), type_(type), id_(id) {} |
1164 | 1170 |
1165 StateValueKind kind_; | 1171 StateValueKind kind_; |
1166 MachineType type_; | 1172 MachineType type_; |
1167 size_t id_; | 1173 size_t id_; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 | 1222 |
1217 void ReserveSize(size_t size) { fields_.reserve(size); } | 1223 void ReserveSize(size_t size) { fields_.reserve(size); } |
1218 | 1224 |
1219 StateValueList* PushRecursiveField(Zone* zone, size_t id) { | 1225 StateValueList* PushRecursiveField(Zone* zone, size_t id) { |
1220 fields_.push_back(StateValueDescriptor::Recursive(id)); | 1226 fields_.push_back(StateValueDescriptor::Recursive(id)); |
1221 StateValueList* nested = | 1227 StateValueList* nested = |
1222 new (zone->New(sizeof(StateValueList))) StateValueList(zone); | 1228 new (zone->New(sizeof(StateValueList))) StateValueList(zone); |
1223 nested_.push_back(nested); | 1229 nested_.push_back(nested); |
1224 return nested; | 1230 return nested; |
1225 } | 1231 } |
| 1232 void PushArguments() { fields_.push_back(StateValueDescriptor::Arguments()); } |
1226 void PushDuplicate(size_t id) { | 1233 void PushDuplicate(size_t id) { |
1227 fields_.push_back(StateValueDescriptor::Duplicate(id)); | 1234 fields_.push_back(StateValueDescriptor::Duplicate(id)); |
1228 } | 1235 } |
1229 void PushPlain(MachineType type) { | 1236 void PushPlain(MachineType type) { |
1230 fields_.push_back(StateValueDescriptor::Plain(type)); | 1237 fields_.push_back(StateValueDescriptor::Plain(type)); |
1231 } | 1238 } |
1232 void PushOptimizedOut() { | 1239 void PushOptimizedOut() { |
1233 fields_.push_back(StateValueDescriptor::OptimizedOut()); | 1240 fields_.push_back(StateValueDescriptor::OptimizedOut()); |
1234 } | 1241 } |
1235 | 1242 |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1626 }; | 1633 }; |
1627 | 1634 |
1628 V8_EXPORT_PRIVATE std::ostream& operator<<( | 1635 V8_EXPORT_PRIVATE std::ostream& operator<<( |
1629 std::ostream& os, const PrintableInstructionSequence& code); | 1636 std::ostream& os, const PrintableInstructionSequence& code); |
1630 | 1637 |
1631 } // namespace compiler | 1638 } // namespace compiler |
1632 } // namespace internal | 1639 } // namespace internal |
1633 } // namespace v8 | 1640 } // namespace v8 |
1634 | 1641 |
1635 #endif // V8_COMPILER_INSTRUCTION_H_ | 1642 #endif // V8_COMPILER_INSTRUCTION_H_ |
OLD | NEW |