Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: src/compiler/instruction.h

Issue 2692753004: [turbofan] escape analysis supports arguments object and rest elements (Closed)
Patch Set: handle the case where Deoptimizer::function_ is a Smi Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/graph-assembler.cc ('k') | src/compiler/instruction-selector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 }; 1118 };
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 kArguments, 1128 kArgumentsElements,
1129 kPlain, 1129 kPlain,
1130 kOptimizedOut, 1130 kOptimizedOut,
1131 kNested, 1131 kNested,
1132 kDuplicate 1132 kDuplicate
1133 }; 1133 };
1134 1134
1135 class StateValueDescriptor { 1135 class StateValueDescriptor {
1136 public: 1136 public:
1137 StateValueDescriptor() 1137 StateValueDescriptor()
1138 : kind_(StateValueKind::kPlain), 1138 : kind_(StateValueKind::kPlain), type_(MachineType::AnyTagged()) {}
1139 type_(MachineType::AnyTagged()),
1140 id_(0) {}
1141 1139
1142 static StateValueDescriptor Arguments() { 1140 static StateValueDescriptor ArgumentsElements(bool is_rest) {
1143 return StateValueDescriptor(StateValueKind::kArguments, 1141 StateValueDescriptor descr(StateValueKind::kArgumentsElements,
1144 MachineType::AnyTagged(), 0); 1142 MachineType::AnyTagged());
1143 descr.is_rest_ = is_rest;
1144 return descr;
1145 } 1145 }
1146 static StateValueDescriptor Plain(MachineType type) { 1146 static StateValueDescriptor Plain(MachineType type) {
1147 return StateValueDescriptor(StateValueKind::kPlain, type, 0); 1147 return StateValueDescriptor(StateValueKind::kPlain, type);
1148 } 1148 }
1149 static StateValueDescriptor OptimizedOut() { 1149 static StateValueDescriptor OptimizedOut() {
1150 return StateValueDescriptor(StateValueKind::kOptimizedOut, 1150 return StateValueDescriptor(StateValueKind::kOptimizedOut,
1151 MachineType::AnyTagged(), 0); 1151 MachineType::AnyTagged());
1152 } 1152 }
1153 static StateValueDescriptor Recursive(size_t id) { 1153 static StateValueDescriptor Recursive(size_t id) {
1154 return StateValueDescriptor(StateValueKind::kNested, 1154 StateValueDescriptor descr(StateValueKind::kNested,
1155 MachineType::AnyTagged(), id); 1155 MachineType::AnyTagged());
1156 descr.id_ = id;
1157 return descr;
1156 } 1158 }
1157 static StateValueDescriptor Duplicate(size_t id) { 1159 static StateValueDescriptor Duplicate(size_t id) {
1158 return StateValueDescriptor(StateValueKind::kDuplicate, 1160 StateValueDescriptor descr(StateValueKind::kDuplicate,
1159 MachineType::AnyTagged(), id); 1161 MachineType::AnyTagged());
1162 descr.id_ = id;
1163 return descr;
1160 } 1164 }
1161 1165
1162 bool IsArguments() const { return kind_ == StateValueKind::kArguments; } 1166 bool IsArgumentsElements() const {
1167 return kind_ == StateValueKind::kArgumentsElements;
1168 }
1163 bool IsPlain() const { return kind_ == StateValueKind::kPlain; } 1169 bool IsPlain() const { return kind_ == StateValueKind::kPlain; }
1164 bool IsOptimizedOut() const { return kind_ == StateValueKind::kOptimizedOut; } 1170 bool IsOptimizedOut() const { return kind_ == StateValueKind::kOptimizedOut; }
1165 bool IsNested() const { return kind_ == StateValueKind::kNested; } 1171 bool IsNested() const { return kind_ == StateValueKind::kNested; }
1166 bool IsDuplicate() const { return kind_ == StateValueKind::kDuplicate; } 1172 bool IsDuplicate() const { return kind_ == StateValueKind::kDuplicate; }
1167 MachineType type() const { return type_; } 1173 MachineType type() const { return type_; }
1168 size_t id() const { return id_; } 1174 size_t id() const {
1175 DCHECK(kind_ == StateValueKind::kDuplicate ||
1176 kind_ == StateValueKind::kNested);
1177 return id_;
1178 }
1179 int is_rest() const {
1180 DCHECK(kind_ == StateValueKind::kArgumentsElements);
1181 return is_rest_;
1182 }
1169 1183
1170 private: 1184 private:
1171 StateValueDescriptor(StateValueKind kind, MachineType type, size_t id) 1185 StateValueDescriptor(StateValueKind kind, MachineType type)
1172 : kind_(kind), type_(type), id_(id) {} 1186 : kind_(kind), type_(type) {}
1173 1187
1174 StateValueKind kind_; 1188 StateValueKind kind_;
1175 MachineType type_; 1189 MachineType type_;
1176 size_t id_; 1190 union {
1191 size_t id_;
1192 bool is_rest_;
1193 };
1177 }; 1194 };
1178 1195
1179 class StateValueList { 1196 class StateValueList {
1180 public: 1197 public:
1181 explicit StateValueList(Zone* zone) : fields_(zone), nested_(zone) {} 1198 explicit StateValueList(Zone* zone) : fields_(zone), nested_(zone) {}
1182 1199
1183 size_t size() { return fields_.size(); } 1200 size_t size() { return fields_.size(); }
1184 1201
1185 struct Value { 1202 struct Value {
1186 StateValueDescriptor* desc; 1203 StateValueDescriptor* desc;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 1242
1226 void ReserveSize(size_t size) { fields_.reserve(size); } 1243 void ReserveSize(size_t size) { fields_.reserve(size); }
1227 1244
1228 StateValueList* PushRecursiveField(Zone* zone, size_t id) { 1245 StateValueList* PushRecursiveField(Zone* zone, size_t id) {
1229 fields_.push_back(StateValueDescriptor::Recursive(id)); 1246 fields_.push_back(StateValueDescriptor::Recursive(id));
1230 StateValueList* nested = 1247 StateValueList* nested =
1231 new (zone->New(sizeof(StateValueList))) StateValueList(zone); 1248 new (zone->New(sizeof(StateValueList))) StateValueList(zone);
1232 nested_.push_back(nested); 1249 nested_.push_back(nested);
1233 return nested; 1250 return nested;
1234 } 1251 }
1235 void PushArguments() { fields_.push_back(StateValueDescriptor::Arguments()); } 1252 void PushArgumentsElements(bool is_rest) {
1253 fields_.push_back(StateValueDescriptor::ArgumentsElements(is_rest));
1254 }
1236 void PushDuplicate(size_t id) { 1255 void PushDuplicate(size_t id) {
1237 fields_.push_back(StateValueDescriptor::Duplicate(id)); 1256 fields_.push_back(StateValueDescriptor::Duplicate(id));
1238 } 1257 }
1239 void PushPlain(MachineType type) { 1258 void PushPlain(MachineType type) {
1240 fields_.push_back(StateValueDescriptor::Plain(type)); 1259 fields_.push_back(StateValueDescriptor::Plain(type));
1241 } 1260 }
1242 void PushOptimizedOut() { 1261 void PushOptimizedOut() {
1243 fields_.push_back(StateValueDescriptor::OptimizedOut()); 1262 fields_.push_back(StateValueDescriptor::OptimizedOut());
1244 } 1263 }
1245 1264
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1639 }; 1658 };
1640 1659
1641 V8_EXPORT_PRIVATE std::ostream& operator<<( 1660 V8_EXPORT_PRIVATE std::ostream& operator<<(
1642 std::ostream& os, const PrintableInstructionSequence& code); 1661 std::ostream& os, const PrintableInstructionSequence& code);
1643 1662
1644 } // namespace compiler 1663 } // namespace compiler
1645 } // namespace internal 1664 } // namespace internal
1646 } // namespace v8 1665 } // namespace v8
1647 1666
1648 #endif // V8_COMPILER_INSTRUCTION_H_ 1667 #endif // V8_COMPILER_INSTRUCTION_H_
OLDNEW
« no previous file with comments | « src/compiler/graph-assembler.cc ('k') | src/compiler/instruction-selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698