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 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 | 1119 |
1120 | 1120 |
1121 std::ostream& operator<<(std::ostream& os, const Constant& constant); | 1121 std::ostream& operator<<(std::ostream& os, const Constant& constant); |
1122 | 1122 |
1123 | 1123 |
1124 // Forward declarations. | 1124 // Forward declarations. |
1125 class FrameStateDescriptor; | 1125 class FrameStateDescriptor; |
1126 | 1126 |
1127 enum class StateValueKind : uint8_t { | 1127 enum class StateValueKind : uint8_t { |
1128 kArgumentsElements, | 1128 kArgumentsElements, |
| 1129 kArgumentsLength, |
1129 kPlain, | 1130 kPlain, |
1130 kOptimizedOut, | 1131 kOptimizedOut, |
1131 kNested, | 1132 kNested, |
1132 kDuplicate | 1133 kDuplicate |
1133 }; | 1134 }; |
1134 | 1135 |
1135 class StateValueDescriptor { | 1136 class StateValueDescriptor { |
1136 public: | 1137 public: |
1137 StateValueDescriptor() | 1138 StateValueDescriptor() |
1138 : kind_(StateValueKind::kPlain), type_(MachineType::AnyTagged()) {} | 1139 : kind_(StateValueKind::kPlain), type_(MachineType::AnyTagged()) {} |
1139 | 1140 |
1140 static StateValueDescriptor ArgumentsElements(bool is_rest) { | 1141 static StateValueDescriptor ArgumentsElements(bool is_rest) { |
1141 StateValueDescriptor descr(StateValueKind::kArgumentsElements, | 1142 StateValueDescriptor descr(StateValueKind::kArgumentsElements, |
1142 MachineType::AnyTagged()); | 1143 MachineType::AnyTagged()); |
1143 descr.is_rest_ = is_rest; | 1144 descr.is_rest_ = is_rest; |
1144 return descr; | 1145 return descr; |
1145 } | 1146 } |
| 1147 static StateValueDescriptor ArgumentsLength(bool is_rest) { |
| 1148 StateValueDescriptor descr(StateValueKind::kArgumentsLength, |
| 1149 MachineType::AnyTagged()); |
| 1150 descr.is_rest_ = is_rest; |
| 1151 return descr; |
| 1152 } |
1146 static StateValueDescriptor Plain(MachineType type) { | 1153 static StateValueDescriptor Plain(MachineType type) { |
1147 return StateValueDescriptor(StateValueKind::kPlain, type); | 1154 return StateValueDescriptor(StateValueKind::kPlain, type); |
1148 } | 1155 } |
1149 static StateValueDescriptor OptimizedOut() { | 1156 static StateValueDescriptor OptimizedOut() { |
1150 return StateValueDescriptor(StateValueKind::kOptimizedOut, | 1157 return StateValueDescriptor(StateValueKind::kOptimizedOut, |
1151 MachineType::AnyTagged()); | 1158 MachineType::AnyTagged()); |
1152 } | 1159 } |
1153 static StateValueDescriptor Recursive(size_t id) { | 1160 static StateValueDescriptor Recursive(size_t id) { |
1154 StateValueDescriptor descr(StateValueKind::kNested, | 1161 StateValueDescriptor descr(StateValueKind::kNested, |
1155 MachineType::AnyTagged()); | 1162 MachineType::AnyTagged()); |
1156 descr.id_ = id; | 1163 descr.id_ = id; |
1157 return descr; | 1164 return descr; |
1158 } | 1165 } |
1159 static StateValueDescriptor Duplicate(size_t id) { | 1166 static StateValueDescriptor Duplicate(size_t id) { |
1160 StateValueDescriptor descr(StateValueKind::kDuplicate, | 1167 StateValueDescriptor descr(StateValueKind::kDuplicate, |
1161 MachineType::AnyTagged()); | 1168 MachineType::AnyTagged()); |
1162 descr.id_ = id; | 1169 descr.id_ = id; |
1163 return descr; | 1170 return descr; |
1164 } | 1171 } |
1165 | 1172 |
1166 bool IsArgumentsElements() const { | 1173 bool IsArgumentsElements() const { |
1167 return kind_ == StateValueKind::kArgumentsElements; | 1174 return kind_ == StateValueKind::kArgumentsElements; |
1168 } | 1175 } |
| 1176 bool IsArgumentsLength() const { |
| 1177 return kind_ == StateValueKind::kArgumentsLength; |
| 1178 } |
1169 bool IsPlain() const { return kind_ == StateValueKind::kPlain; } | 1179 bool IsPlain() const { return kind_ == StateValueKind::kPlain; } |
1170 bool IsOptimizedOut() const { return kind_ == StateValueKind::kOptimizedOut; } | 1180 bool IsOptimizedOut() const { return kind_ == StateValueKind::kOptimizedOut; } |
1171 bool IsNested() const { return kind_ == StateValueKind::kNested; } | 1181 bool IsNested() const { return kind_ == StateValueKind::kNested; } |
1172 bool IsDuplicate() const { return kind_ == StateValueKind::kDuplicate; } | 1182 bool IsDuplicate() const { return kind_ == StateValueKind::kDuplicate; } |
1173 MachineType type() const { return type_; } | 1183 MachineType type() const { return type_; } |
1174 size_t id() const { | 1184 size_t id() const { |
1175 DCHECK(kind_ == StateValueKind::kDuplicate || | 1185 DCHECK(kind_ == StateValueKind::kDuplicate || |
1176 kind_ == StateValueKind::kNested); | 1186 kind_ == StateValueKind::kNested); |
1177 return id_; | 1187 return id_; |
1178 } | 1188 } |
1179 int is_rest() const { | 1189 int is_rest() const { |
1180 DCHECK(kind_ == StateValueKind::kArgumentsElements); | 1190 DCHECK(kind_ == StateValueKind::kArgumentsElements || |
| 1191 kind_ == StateValueKind::kArgumentsLength); |
1181 return is_rest_; | 1192 return is_rest_; |
1182 } | 1193 } |
1183 | 1194 |
1184 private: | 1195 private: |
1185 StateValueDescriptor(StateValueKind kind, MachineType type) | 1196 StateValueDescriptor(StateValueKind kind, MachineType type) |
1186 : kind_(kind), type_(type) {} | 1197 : kind_(kind), type_(type) {} |
1187 | 1198 |
1188 StateValueKind kind_; | 1199 StateValueKind kind_; |
1189 MachineType type_; | 1200 MachineType type_; |
1190 union { | 1201 union { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 StateValueList* PushRecursiveField(Zone* zone, size_t id) { | 1256 StateValueList* PushRecursiveField(Zone* zone, size_t id) { |
1246 fields_.push_back(StateValueDescriptor::Recursive(id)); | 1257 fields_.push_back(StateValueDescriptor::Recursive(id)); |
1247 StateValueList* nested = | 1258 StateValueList* nested = |
1248 new (zone->New(sizeof(StateValueList))) StateValueList(zone); | 1259 new (zone->New(sizeof(StateValueList))) StateValueList(zone); |
1249 nested_.push_back(nested); | 1260 nested_.push_back(nested); |
1250 return nested; | 1261 return nested; |
1251 } | 1262 } |
1252 void PushArgumentsElements(bool is_rest) { | 1263 void PushArgumentsElements(bool is_rest) { |
1253 fields_.push_back(StateValueDescriptor::ArgumentsElements(is_rest)); | 1264 fields_.push_back(StateValueDescriptor::ArgumentsElements(is_rest)); |
1254 } | 1265 } |
| 1266 void PushArgumentsLength(bool is_rest) { |
| 1267 fields_.push_back(StateValueDescriptor::ArgumentsLength(is_rest)); |
| 1268 } |
1255 void PushDuplicate(size_t id) { | 1269 void PushDuplicate(size_t id) { |
1256 fields_.push_back(StateValueDescriptor::Duplicate(id)); | 1270 fields_.push_back(StateValueDescriptor::Duplicate(id)); |
1257 } | 1271 } |
1258 void PushPlain(MachineType type) { | 1272 void PushPlain(MachineType type) { |
1259 fields_.push_back(StateValueDescriptor::Plain(type)); | 1273 fields_.push_back(StateValueDescriptor::Plain(type)); |
1260 } | 1274 } |
1261 void PushOptimizedOut() { | 1275 void PushOptimizedOut() { |
1262 fields_.push_back(StateValueDescriptor::OptimizedOut()); | 1276 fields_.push_back(StateValueDescriptor::OptimizedOut()); |
1263 } | 1277 } |
1264 | 1278 |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1658 }; | 1672 }; |
1659 | 1673 |
1660 V8_EXPORT_PRIVATE std::ostream& operator<<( | 1674 V8_EXPORT_PRIVATE std::ostream& operator<<( |
1661 std::ostream& os, const PrintableInstructionSequence& code); | 1675 std::ostream& os, const PrintableInstructionSequence& code); |
1662 | 1676 |
1663 } // namespace compiler | 1677 } // namespace compiler |
1664 } // namespace internal | 1678 } // namespace internal |
1665 } // namespace v8 | 1679 } // namespace v8 |
1666 | 1680 |
1667 #endif // V8_COMPILER_INSTRUCTION_H_ | 1681 #endif // V8_COMPILER_INSTRUCTION_H_ |
OLD | NEW |