OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_HYDROGEN_INSTRUCTIONS_H_ | 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ |
6 #define V8_HYDROGEN_INSTRUCTIONS_H_ | 6 #define V8_HYDROGEN_INSTRUCTIONS_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/v8.h" | 10 #include "src/v8.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 V(ElementsPointer) \ | 183 V(ElementsPointer) \ |
184 V(GlobalVars) \ | 184 V(GlobalVars) \ |
185 V(InobjectFields) \ | 185 V(InobjectFields) \ |
186 V(Maps) \ | 186 V(Maps) \ |
187 V(OsrEntries) \ | 187 V(OsrEntries) \ |
188 V(ExternalMemory) \ | 188 V(ExternalMemory) \ |
189 V(StringChars) \ | 189 V(StringChars) \ |
190 V(TypedArrayElements) | 190 V(TypedArrayElements) |
191 | 191 |
192 | 192 |
193 #define DECLARE_ABSTRACT_INSTRUCTION(type) \ | 193 #define DECLARE_ABSTRACT_INSTRUCTION(type) \ |
194 virtual bool Is##type() const FINAL OVERRIDE { return true; } \ | 194 bool Is##type() const FINAL { return true; } \ |
195 static H##type* cast(HValue* value) { \ | 195 static H##type* cast(HValue* value) { \ |
196 DCHECK(value->Is##type()); \ | 196 DCHECK(value->Is##type()); \ |
197 return reinterpret_cast<H##type*>(value); \ | 197 return reinterpret_cast<H##type*>(value); \ |
198 } | 198 } |
199 | 199 |
200 | 200 |
201 #define DECLARE_CONCRETE_INSTRUCTION(type) \ | 201 #define DECLARE_CONCRETE_INSTRUCTION(type) \ |
202 virtual LInstruction* CompileToLithium( \ | 202 LInstruction* CompileToLithium(LChunkBuilder* builder) FINAL; \ |
203 LChunkBuilder* builder) FINAL OVERRIDE; \ | 203 static H##type* cast(HValue* value) { \ |
204 static H##type* cast(HValue* value) { \ | 204 DCHECK(value->Is##type()); \ |
205 DCHECK(value->Is##type()); \ | 205 return reinterpret_cast<H##type*>(value); \ |
206 return reinterpret_cast<H##type*>(value); \ | 206 } \ |
207 } \ | 207 Opcode opcode() const FINAL { return HValue::k##type; } |
208 virtual Opcode opcode() const FINAL OVERRIDE { \ | |
209 return HValue::k##type; \ | |
210 } | |
211 | 208 |
212 | 209 |
213 enum PropertyAccessType { LOAD, STORE }; | 210 enum PropertyAccessType { LOAD, STORE }; |
214 | 211 |
215 | 212 |
216 class Range FINAL : public ZoneObject { | 213 class Range FINAL : public ZoneObject { |
217 public: | 214 public: |
218 Range() | 215 Range() |
219 : lower_(kMinInt), | 216 : lower_(kMinInt), |
220 upper_(kMaxInt), | 217 upper_(kMaxInt), |
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 | 1137 |
1141 intptr_t data_; | 1138 intptr_t data_; |
1142 }; | 1139 }; |
1143 | 1140 |
1144 | 1141 |
1145 class HInstruction : public HValue { | 1142 class HInstruction : public HValue { |
1146 public: | 1143 public: |
1147 HInstruction* next() const { return next_; } | 1144 HInstruction* next() const { return next_; } |
1148 HInstruction* previous() const { return previous_; } | 1145 HInstruction* previous() const { return previous_; } |
1149 | 1146 |
1150 virtual std::ostream& PrintTo(std::ostream& os) const OVERRIDE; // NOLINT | 1147 std::ostream& PrintTo(std::ostream& os) const OVERRIDE; // NOLINT |
1151 virtual std::ostream& PrintDataTo(std::ostream& os) const; // NOLINT | 1148 virtual std::ostream& PrintDataTo(std::ostream& os) const; // NOLINT |
1152 | 1149 |
1153 bool IsLinked() const { return block() != NULL; } | 1150 bool IsLinked() const { return block() != NULL; } |
1154 void Unlink(); | 1151 void Unlink(); |
1155 | 1152 |
1156 void InsertBefore(HInstruction* next); | 1153 void InsertBefore(HInstruction* next); |
1157 | 1154 |
1158 template<class T> T* Prepend(T* instr) { | 1155 template<class T> T* Prepend(T* instr) { |
1159 instr->InsertBefore(this); | 1156 instr->InsertBefore(this); |
1160 return instr; | 1157 return instr; |
1161 } | 1158 } |
1162 | 1159 |
1163 void InsertAfter(HInstruction* previous); | 1160 void InsertAfter(HInstruction* previous); |
1164 | 1161 |
1165 template<class T> T* Append(T* instr) { | 1162 template<class T> T* Append(T* instr) { |
1166 instr->InsertAfter(this); | 1163 instr->InsertAfter(this); |
1167 return instr; | 1164 return instr; |
1168 } | 1165 } |
1169 | 1166 |
1170 // The position is a write-once variable. | 1167 // The position is a write-once variable. |
1171 virtual HSourcePosition position() const OVERRIDE { | 1168 HSourcePosition position() const OVERRIDE { |
1172 return HSourcePosition(position_.position()); | 1169 return HSourcePosition(position_.position()); |
1173 } | 1170 } |
1174 bool has_position() const { | 1171 bool has_position() const { |
1175 return !position().IsUnknown(); | 1172 return !position().IsUnknown(); |
1176 } | 1173 } |
1177 void set_position(HSourcePosition position) { | 1174 void set_position(HSourcePosition position) { |
1178 DCHECK(!has_position()); | 1175 DCHECK(!has_position()); |
1179 DCHECK(!position.IsUnknown()); | 1176 DCHECK(!position.IsUnknown()); |
1180 position_.set_position(position); | 1177 position_.set_position(position); |
1181 } | 1178 } |
1182 | 1179 |
1183 virtual HSourcePosition operand_position(int index) const OVERRIDE { | 1180 HSourcePosition operand_position(int index) const OVERRIDE { |
1184 const HSourcePosition pos = position_.operand_position(index); | 1181 const HSourcePosition pos = position_.operand_position(index); |
1185 return pos.IsUnknown() ? position() : pos; | 1182 return pos.IsUnknown() ? position() : pos; |
1186 } | 1183 } |
1187 void set_operand_position(Zone* zone, int index, HSourcePosition pos) { | 1184 void set_operand_position(Zone* zone, int index, HSourcePosition pos) { |
1188 DCHECK(0 <= index && index < OperandCount()); | 1185 DCHECK(0 <= index && index < OperandCount()); |
1189 position_.ensure_storage_for_operand_positions(zone, OperandCount()); | 1186 position_.ensure_storage_for_operand_positions(zone, OperandCount()); |
1190 position_.set_operand_position(index, pos); | 1187 position_.set_operand_position(index, pos); |
1191 } | 1188 } |
1192 | 1189 |
1193 bool Dominates(HInstruction* other); | 1190 bool Dominates(HInstruction* other); |
1194 bool CanTruncateToSmi() const { return CheckFlag(kTruncatingToSmi); } | 1191 bool CanTruncateToSmi() const { return CheckFlag(kTruncatingToSmi); } |
1195 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } | 1192 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } |
1196 | 1193 |
1197 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; | 1194 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; |
1198 | 1195 |
1199 #ifdef DEBUG | 1196 #ifdef DEBUG |
1200 virtual void Verify() OVERRIDE; | 1197 void Verify() OVERRIDE; |
1201 #endif | 1198 #endif |
1202 | 1199 |
1203 bool CanDeoptimize(); | 1200 bool CanDeoptimize(); |
1204 | 1201 |
1205 virtual bool HasStackCheck() { return false; } | 1202 virtual bool HasStackCheck() { return false; } |
1206 | 1203 |
1207 DECLARE_ABSTRACT_INSTRUCTION(Instruction) | 1204 DECLARE_ABSTRACT_INSTRUCTION(Instruction) |
1208 | 1205 |
1209 protected: | 1206 protected: |
1210 explicit HInstruction(HType type = HType::Tagged()) | 1207 explicit HInstruction(HType type = HType::Tagged()) |
1211 : HValue(type), | 1208 : HValue(type), |
1212 next_(NULL), | 1209 next_(NULL), |
1213 previous_(NULL), | 1210 previous_(NULL), |
1214 position_(RelocInfo::kNoPosition) { | 1211 position_(RelocInfo::kNoPosition) { |
1215 SetDependsOnFlag(kOsrEntries); | 1212 SetDependsOnFlag(kOsrEntries); |
1216 } | 1213 } |
1217 | 1214 |
1218 virtual void DeleteFromGraph() OVERRIDE { Unlink(); } | 1215 void DeleteFromGraph() OVERRIDE { Unlink(); } |
1219 | 1216 |
1220 private: | 1217 private: |
1221 void InitializeAsFirst(HBasicBlock* block) { | 1218 void InitializeAsFirst(HBasicBlock* block) { |
1222 DCHECK(!IsLinked()); | 1219 DCHECK(!IsLinked()); |
1223 SetBlock(block); | 1220 SetBlock(block); |
1224 } | 1221 } |
1225 | 1222 |
1226 HInstruction* next_; | 1223 HInstruction* next_; |
1227 HInstruction* previous_; | 1224 HInstruction* previous_; |
1228 HPositionInfo position_; | 1225 HPositionInfo position_; |
1229 | 1226 |
1230 friend class HBasicBlock; | 1227 friend class HBasicBlock; |
1231 }; | 1228 }; |
1232 | 1229 |
1233 | 1230 |
1234 template<int V> | 1231 template<int V> |
1235 class HTemplateInstruction : public HInstruction { | 1232 class HTemplateInstruction : public HInstruction { |
1236 public: | 1233 public: |
1237 virtual int OperandCount() const FINAL OVERRIDE { return V; } | 1234 int OperandCount() const FINAL { return V; } |
1238 virtual HValue* OperandAt(int i) const FINAL OVERRIDE { | 1235 HValue* OperandAt(int i) const FINAL { return inputs_[i]; } |
1239 return inputs_[i]; | |
1240 } | |
1241 | 1236 |
1242 protected: | 1237 protected: |
1243 explicit HTemplateInstruction(HType type = HType::Tagged()) | 1238 explicit HTemplateInstruction(HType type = HType::Tagged()) |
1244 : HInstruction(type) {} | 1239 : HInstruction(type) {} |
1245 | 1240 |
1246 virtual void InternalSetOperandAt(int i, HValue* value) FINAL OVERRIDE { | 1241 void InternalSetOperandAt(int i, HValue* value) FINAL { inputs_[i] = value; } |
1247 inputs_[i] = value; | |
1248 } | |
1249 | 1242 |
1250 private: | 1243 private: |
1251 EmbeddedContainer<HValue*, V> inputs_; | 1244 EmbeddedContainer<HValue*, V> inputs_; |
1252 }; | 1245 }; |
1253 | 1246 |
1254 | 1247 |
1255 class HControlInstruction : public HInstruction { | 1248 class HControlInstruction : public HInstruction { |
1256 public: | 1249 public: |
1257 virtual HBasicBlock* SuccessorAt(int i) const = 0; | 1250 virtual HBasicBlock* SuccessorAt(int i) const = 0; |
1258 virtual int SuccessorCount() const = 0; | 1251 virtual int SuccessorCount() const = 0; |
1259 virtual void SetSuccessorAt(int i, HBasicBlock* block) = 0; | 1252 virtual void SetSuccessorAt(int i, HBasicBlock* block) = 0; |
1260 | 1253 |
1261 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1254 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
1262 | 1255 |
1263 virtual bool KnownSuccessorBlock(HBasicBlock** block) { | 1256 virtual bool KnownSuccessorBlock(HBasicBlock** block) { |
1264 *block = NULL; | 1257 *block = NULL; |
1265 return false; | 1258 return false; |
1266 } | 1259 } |
1267 | 1260 |
1268 HBasicBlock* FirstSuccessor() { | 1261 HBasicBlock* FirstSuccessor() { |
1269 return SuccessorCount() > 0 ? SuccessorAt(0) : NULL; | 1262 return SuccessorCount() > 0 ? SuccessorAt(0) : NULL; |
1270 } | 1263 } |
1271 HBasicBlock* SecondSuccessor() { | 1264 HBasicBlock* SecondSuccessor() { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 } | 1309 } |
1317 | 1310 |
1318 private: | 1311 private: |
1319 EmbeddedContainer<HBasicBlock*, S> successors_; | 1312 EmbeddedContainer<HBasicBlock*, S> successors_; |
1320 EmbeddedContainer<HValue*, V> inputs_; | 1313 EmbeddedContainer<HValue*, V> inputs_; |
1321 }; | 1314 }; |
1322 | 1315 |
1323 | 1316 |
1324 class HBlockEntry FINAL : public HTemplateInstruction<0> { | 1317 class HBlockEntry FINAL : public HTemplateInstruction<0> { |
1325 public: | 1318 public: |
1326 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 1319 Representation RequiredInputRepresentation(int index) OVERRIDE { |
1327 return Representation::None(); | 1320 return Representation::None(); |
1328 } | 1321 } |
1329 | 1322 |
1330 DECLARE_CONCRETE_INSTRUCTION(BlockEntry) | 1323 DECLARE_CONCRETE_INSTRUCTION(BlockEntry) |
1331 }; | 1324 }; |
1332 | 1325 |
1333 | 1326 |
1334 class HDummyUse FINAL : public HTemplateInstruction<1> { | 1327 class HDummyUse FINAL : public HTemplateInstruction<1> { |
1335 public: | 1328 public: |
1336 explicit HDummyUse(HValue* value) | 1329 explicit HDummyUse(HValue* value) |
1337 : HTemplateInstruction<1>(HType::Smi()) { | 1330 : HTemplateInstruction<1>(HType::Smi()) { |
1338 SetOperandAt(0, value); | 1331 SetOperandAt(0, value); |
1339 // Pretend to be a Smi so that the HChange instructions inserted | 1332 // Pretend to be a Smi so that the HChange instructions inserted |
1340 // before any use generate as little code as possible. | 1333 // before any use generate as little code as possible. |
1341 set_representation(Representation::Tagged()); | 1334 set_representation(Representation::Tagged()); |
1342 } | 1335 } |
1343 | 1336 |
1344 HValue* value() const { return OperandAt(0); } | 1337 HValue* value() const { return OperandAt(0); } |
1345 | 1338 |
1346 virtual bool HasEscapingOperandAt(int index) OVERRIDE { return false; } | 1339 bool HasEscapingOperandAt(int index) OVERRIDE { return false; } |
1347 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 1340 Representation RequiredInputRepresentation(int index) OVERRIDE { |
1348 return Representation::None(); | 1341 return Representation::None(); |
1349 } | 1342 } |
1350 | 1343 |
1351 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1344 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
1352 | 1345 |
1353 DECLARE_CONCRETE_INSTRUCTION(DummyUse); | 1346 DECLARE_CONCRETE_INSTRUCTION(DummyUse); |
1354 }; | 1347 }; |
1355 | 1348 |
1356 | 1349 |
1357 // Inserts an int3/stop break instruction for debugging purposes. | 1350 // Inserts an int3/stop break instruction for debugging purposes. |
1358 class HDebugBreak FINAL : public HTemplateInstruction<0> { | 1351 class HDebugBreak FINAL : public HTemplateInstruction<0> { |
1359 public: | 1352 public: |
1360 DECLARE_INSTRUCTION_FACTORY_P0(HDebugBreak); | 1353 DECLARE_INSTRUCTION_FACTORY_P0(HDebugBreak); |
1361 | 1354 |
1362 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 1355 Representation RequiredInputRepresentation(int index) OVERRIDE { |
1363 return Representation::None(); | 1356 return Representation::None(); |
1364 } | 1357 } |
1365 | 1358 |
1366 DECLARE_CONCRETE_INSTRUCTION(DebugBreak) | 1359 DECLARE_CONCRETE_INSTRUCTION(DebugBreak) |
1367 }; | 1360 }; |
1368 | 1361 |
1369 | 1362 |
1370 class HGoto FINAL : public HTemplateControlInstruction<1, 0> { | 1363 class HGoto FINAL : public HTemplateControlInstruction<1, 0> { |
1371 public: | 1364 public: |
1372 explicit HGoto(HBasicBlock* target) { | 1365 explicit HGoto(HBasicBlock* target) { |
1373 SetSuccessorAt(0, target); | 1366 SetSuccessorAt(0, target); |
1374 } | 1367 } |
1375 | 1368 |
1376 virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE { | 1369 bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE { |
1377 *block = FirstSuccessor(); | 1370 *block = FirstSuccessor(); |
1378 return true; | 1371 return true; |
1379 } | 1372 } |
1380 | 1373 |
1381 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 1374 Representation RequiredInputRepresentation(int index) OVERRIDE { |
1382 return Representation::None(); | 1375 return Representation::None(); |
1383 } | 1376 } |
1384 | 1377 |
1385 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1378 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
1386 | 1379 |
1387 DECLARE_CONCRETE_INSTRUCTION(Goto) | 1380 DECLARE_CONCRETE_INSTRUCTION(Goto) |
1388 }; | 1381 }; |
1389 | 1382 |
1390 | 1383 |
1391 class HDeoptimize FINAL : public HTemplateControlInstruction<1, 0> { | 1384 class HDeoptimize FINAL : public HTemplateControlInstruction<1, 0> { |
1392 public: | 1385 public: |
1393 static HDeoptimize* New(Zone* zone, | 1386 static HDeoptimize* New(Zone* zone, |
1394 HValue* context, | 1387 HValue* context, |
1395 const char* reason, | 1388 const char* reason, |
1396 Deoptimizer::BailoutType type, | 1389 Deoptimizer::BailoutType type, |
1397 HBasicBlock* unreachable_continuation) { | 1390 HBasicBlock* unreachable_continuation) { |
1398 return new(zone) HDeoptimize(reason, type, unreachable_continuation); | 1391 return new(zone) HDeoptimize(reason, type, unreachable_continuation); |
1399 } | 1392 } |
1400 | 1393 |
1401 virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE { | 1394 bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE { |
1402 *block = NULL; | 1395 *block = NULL; |
1403 return true; | 1396 return true; |
1404 } | 1397 } |
1405 | 1398 |
1406 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 1399 Representation RequiredInputRepresentation(int index) OVERRIDE { |
1407 return Representation::None(); | 1400 return Representation::None(); |
1408 } | 1401 } |
1409 | 1402 |
1410 const char* reason() const { return reason_; } | 1403 const char* reason() const { return reason_; } |
1411 Deoptimizer::BailoutType type() { return type_; } | 1404 Deoptimizer::BailoutType type() { return type_; } |
1412 | 1405 |
1413 DECLARE_CONCRETE_INSTRUCTION(Deoptimize) | 1406 DECLARE_CONCRETE_INSTRUCTION(Deoptimize) |
1414 | 1407 |
1415 private: | 1408 private: |
1416 explicit HDeoptimize(const char* reason, | 1409 explicit HDeoptimize(const char* reason, |
(...skipping 11 matching lines...) Expand all Loading... |
1428 class HUnaryControlInstruction : public HTemplateControlInstruction<2, 1> { | 1421 class HUnaryControlInstruction : public HTemplateControlInstruction<2, 1> { |
1429 public: | 1422 public: |
1430 HUnaryControlInstruction(HValue* value, | 1423 HUnaryControlInstruction(HValue* value, |
1431 HBasicBlock* true_target, | 1424 HBasicBlock* true_target, |
1432 HBasicBlock* false_target) { | 1425 HBasicBlock* false_target) { |
1433 SetOperandAt(0, value); | 1426 SetOperandAt(0, value); |
1434 SetSuccessorAt(0, true_target); | 1427 SetSuccessorAt(0, true_target); |
1435 SetSuccessorAt(1, false_target); | 1428 SetSuccessorAt(1, false_target); |
1436 } | 1429 } |
1437 | 1430 |
1438 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1431 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
1439 | 1432 |
1440 HValue* value() const { return OperandAt(0); } | 1433 HValue* value() const { return OperandAt(0); } |
1441 }; | 1434 }; |
1442 | 1435 |
1443 | 1436 |
1444 class HBranch FINAL : public HUnaryControlInstruction { | 1437 class HBranch FINAL : public HUnaryControlInstruction { |
1445 public: | 1438 public: |
1446 DECLARE_INSTRUCTION_FACTORY_P1(HBranch, HValue*); | 1439 DECLARE_INSTRUCTION_FACTORY_P1(HBranch, HValue*); |
1447 DECLARE_INSTRUCTION_FACTORY_P2(HBranch, HValue*, | 1440 DECLARE_INSTRUCTION_FACTORY_P2(HBranch, HValue*, |
1448 ToBooleanStub::Types); | 1441 ToBooleanStub::Types); |
1449 DECLARE_INSTRUCTION_FACTORY_P4(HBranch, HValue*, | 1442 DECLARE_INSTRUCTION_FACTORY_P4(HBranch, HValue*, |
1450 ToBooleanStub::Types, | 1443 ToBooleanStub::Types, |
1451 HBasicBlock*, HBasicBlock*); | 1444 HBasicBlock*, HBasicBlock*); |
1452 | 1445 |
1453 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 1446 Representation RequiredInputRepresentation(int index) OVERRIDE { |
1454 return Representation::None(); | 1447 return Representation::None(); |
1455 } | 1448 } |
1456 virtual Representation observed_input_representation(int index) OVERRIDE; | 1449 Representation observed_input_representation(int index) OVERRIDE; |
1457 | 1450 |
1458 virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; | 1451 bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; |
1459 | 1452 |
1460 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1453 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
1461 | 1454 |
1462 ToBooleanStub::Types expected_input_types() const { | 1455 ToBooleanStub::Types expected_input_types() const { |
1463 return expected_input_types_; | 1456 return expected_input_types_; |
1464 } | 1457 } |
1465 | 1458 |
1466 DECLARE_CONCRETE_INSTRUCTION(Branch) | 1459 DECLARE_CONCRETE_INSTRUCTION(Branch) |
1467 | 1460 |
1468 private: | 1461 private: |
1469 HBranch(HValue* value, | 1462 HBranch(HValue* value, |
1470 ToBooleanStub::Types expected_input_types = ToBooleanStub::Types(), | 1463 ToBooleanStub::Types expected_input_types = ToBooleanStub::Types(), |
1471 HBasicBlock* true_target = NULL, | 1464 HBasicBlock* true_target = NULL, |
1472 HBasicBlock* false_target = NULL) | 1465 HBasicBlock* false_target = NULL) |
1473 : HUnaryControlInstruction(value, true_target, false_target), | 1466 : HUnaryControlInstruction(value, true_target, false_target), |
1474 expected_input_types_(expected_input_types) { | 1467 expected_input_types_(expected_input_types) { |
1475 SetFlag(kAllowUndefinedAsNaN); | 1468 SetFlag(kAllowUndefinedAsNaN); |
1476 } | 1469 } |
1477 | 1470 |
1478 ToBooleanStub::Types expected_input_types_; | 1471 ToBooleanStub::Types expected_input_types_; |
1479 }; | 1472 }; |
1480 | 1473 |
1481 | 1474 |
1482 class HCompareMap FINAL : public HUnaryControlInstruction { | 1475 class HCompareMap FINAL : public HUnaryControlInstruction { |
1483 public: | 1476 public: |
1484 DECLARE_INSTRUCTION_FACTORY_P2(HCompareMap, HValue*, Handle<Map>); | 1477 DECLARE_INSTRUCTION_FACTORY_P2(HCompareMap, HValue*, Handle<Map>); |
1485 DECLARE_INSTRUCTION_FACTORY_P4(HCompareMap, HValue*, Handle<Map>, | 1478 DECLARE_INSTRUCTION_FACTORY_P4(HCompareMap, HValue*, Handle<Map>, |
1486 HBasicBlock*, HBasicBlock*); | 1479 HBasicBlock*, HBasicBlock*); |
1487 | 1480 |
1488 virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE { | 1481 bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE { |
1489 if (known_successor_index() != kNoKnownSuccessorIndex) { | 1482 if (known_successor_index() != kNoKnownSuccessorIndex) { |
1490 *block = SuccessorAt(known_successor_index()); | 1483 *block = SuccessorAt(known_successor_index()); |
1491 return true; | 1484 return true; |
1492 } | 1485 } |
1493 *block = NULL; | 1486 *block = NULL; |
1494 return false; | 1487 return false; |
1495 } | 1488 } |
1496 | 1489 |
1497 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1490 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
1498 | 1491 |
1499 static const int kNoKnownSuccessorIndex = -1; | 1492 static const int kNoKnownSuccessorIndex = -1; |
1500 int known_successor_index() const { | 1493 int known_successor_index() const { |
1501 return KnownSuccessorIndexField::decode(bit_field_) - | 1494 return KnownSuccessorIndexField::decode(bit_field_) - |
1502 kInternalKnownSuccessorOffset; | 1495 kInternalKnownSuccessorOffset; |
1503 } | 1496 } |
1504 void set_known_successor_index(int index) { | 1497 void set_known_successor_index(int index) { |
1505 DCHECK(index >= 0 - kInternalKnownSuccessorOffset); | 1498 DCHECK(index >= 0 - kInternalKnownSuccessorOffset); |
1506 bit_field_ = KnownSuccessorIndexField::update( | 1499 bit_field_ = KnownSuccessorIndexField::update( |
1507 bit_field_, index + kInternalKnownSuccessorOffset); | 1500 bit_field_, index + kInternalKnownSuccessorOffset); |
1508 } | 1501 } |
1509 | 1502 |
1510 Unique<Map> map() const { return map_; } | 1503 Unique<Map> map() const { return map_; } |
1511 bool map_is_stable() const { return MapIsStableField::decode(bit_field_); } | 1504 bool map_is_stable() const { return MapIsStableField::decode(bit_field_); } |
1512 | 1505 |
1513 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 1506 Representation RequiredInputRepresentation(int index) OVERRIDE { |
1514 return Representation::Tagged(); | 1507 return Representation::Tagged(); |
1515 } | 1508 } |
1516 | 1509 |
1517 DECLARE_CONCRETE_INSTRUCTION(CompareMap) | 1510 DECLARE_CONCRETE_INSTRUCTION(CompareMap) |
1518 | 1511 |
1519 protected: | 1512 protected: |
1520 virtual int RedefinedOperandIndex() OVERRIDE { return 0; } | 1513 int RedefinedOperandIndex() OVERRIDE { return 0; } |
1521 | 1514 |
1522 private: | 1515 private: |
1523 HCompareMap(HValue* value, Handle<Map> map, HBasicBlock* true_target = NULL, | 1516 HCompareMap(HValue* value, Handle<Map> map, HBasicBlock* true_target = NULL, |
1524 HBasicBlock* false_target = NULL) | 1517 HBasicBlock* false_target = NULL) |
1525 : HUnaryControlInstruction(value, true_target, false_target), | 1518 : HUnaryControlInstruction(value, true_target, false_target), |
1526 bit_field_(KnownSuccessorIndexField::encode( | 1519 bit_field_(KnownSuccessorIndexField::encode( |
1527 kNoKnownSuccessorIndex + kInternalKnownSuccessorOffset) | | 1520 kNoKnownSuccessorIndex + kInternalKnownSuccessorOffset) | |
1528 MapIsStableField::encode(map->is_stable())), | 1521 MapIsStableField::encode(map->is_stable())), |
1529 map_(Unique<Map>::CreateImmovable(map)) { | 1522 map_(Unique<Map>::CreateImmovable(map)) { |
1530 set_representation(Representation::Tagged()); | 1523 set_representation(Representation::Tagged()); |
(...skipping 11 matching lines...) Expand all Loading... |
1542 Unique<Map> map_; | 1535 Unique<Map> map_; |
1543 }; | 1536 }; |
1544 | 1537 |
1545 | 1538 |
1546 class HContext FINAL : public HTemplateInstruction<0> { | 1539 class HContext FINAL : public HTemplateInstruction<0> { |
1547 public: | 1540 public: |
1548 static HContext* New(Zone* zone) { | 1541 static HContext* New(Zone* zone) { |
1549 return new(zone) HContext(); | 1542 return new(zone) HContext(); |
1550 } | 1543 } |
1551 | 1544 |
1552 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 1545 Representation RequiredInputRepresentation(int index) OVERRIDE { |
1553 return Representation::None(); | 1546 return Representation::None(); |
1554 } | 1547 } |
1555 | 1548 |
1556 DECLARE_CONCRETE_INSTRUCTION(Context) | 1549 DECLARE_CONCRETE_INSTRUCTION(Context) |
1557 | 1550 |
1558 protected: | 1551 protected: |
1559 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 1552 bool DataEquals(HValue* other) OVERRIDE { return true; } |
1560 | 1553 |
1561 private: | 1554 private: |
1562 HContext() { | 1555 HContext() { |
1563 set_representation(Representation::Tagged()); | 1556 set_representation(Representation::Tagged()); |
1564 SetFlag(kUseGVN); | 1557 SetFlag(kUseGVN); |
1565 } | 1558 } |
1566 | 1559 |
1567 virtual bool IsDeletable() const OVERRIDE { return true; } | 1560 bool IsDeletable() const OVERRIDE { return true; } |
1568 }; | 1561 }; |
1569 | 1562 |
1570 | 1563 |
1571 class HReturn FINAL : public HTemplateControlInstruction<0, 3> { | 1564 class HReturn FINAL : public HTemplateControlInstruction<0, 3> { |
1572 public: | 1565 public: |
1573 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HReturn, HValue*, HValue*); | 1566 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HReturn, HValue*, HValue*); |
1574 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HReturn, HValue*); | 1567 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HReturn, HValue*); |
1575 | 1568 |
1576 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 1569 Representation RequiredInputRepresentation(int index) OVERRIDE { |
1577 // TODO(titzer): require an Int32 input for faster returns. | 1570 // TODO(titzer): require an Int32 input for faster returns. |
1578 if (index == 2) return Representation::Smi(); | 1571 if (index == 2) return Representation::Smi(); |
1579 return Representation::Tagged(); | 1572 return Representation::Tagged(); |
1580 } | 1573 } |
1581 | 1574 |
1582 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1575 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
1583 | 1576 |
1584 HValue* value() const { return OperandAt(0); } | 1577 HValue* value() const { return OperandAt(0); } |
1585 HValue* context() const { return OperandAt(1); } | 1578 HValue* context() const { return OperandAt(1); } |
1586 HValue* parameter_count() const { return OperandAt(2); } | 1579 HValue* parameter_count() const { return OperandAt(2); } |
1587 | 1580 |
1588 DECLARE_CONCRETE_INSTRUCTION(Return) | 1581 DECLARE_CONCRETE_INSTRUCTION(Return) |
1589 | 1582 |
1590 private: | 1583 private: |
1591 HReturn(HValue* context, HValue* value, HValue* parameter_count = 0) { | 1584 HReturn(HValue* context, HValue* value, HValue* parameter_count = 0) { |
1592 SetOperandAt(0, value); | 1585 SetOperandAt(0, value); |
1593 SetOperandAt(1, context); | 1586 SetOperandAt(1, context); |
1594 SetOperandAt(2, parameter_count); | 1587 SetOperandAt(2, parameter_count); |
1595 } | 1588 } |
1596 }; | 1589 }; |
1597 | 1590 |
1598 | 1591 |
1599 class HAbnormalExit FINAL : public HTemplateControlInstruction<0, 0> { | 1592 class HAbnormalExit FINAL : public HTemplateControlInstruction<0, 0> { |
1600 public: | 1593 public: |
1601 DECLARE_INSTRUCTION_FACTORY_P0(HAbnormalExit); | 1594 DECLARE_INSTRUCTION_FACTORY_P0(HAbnormalExit); |
1602 | 1595 |
1603 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 1596 Representation RequiredInputRepresentation(int index) OVERRIDE { |
1604 return Representation::None(); | 1597 return Representation::None(); |
1605 } | 1598 } |
1606 | 1599 |
1607 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit) | 1600 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit) |
1608 private: | 1601 private: |
1609 HAbnormalExit() {} | 1602 HAbnormalExit() {} |
1610 }; | 1603 }; |
1611 | 1604 |
1612 | 1605 |
1613 class HUnaryOperation : public HTemplateInstruction<1> { | 1606 class HUnaryOperation : public HTemplateInstruction<1> { |
1614 public: | 1607 public: |
1615 explicit HUnaryOperation(HValue* value, HType type = HType::Tagged()) | 1608 explicit HUnaryOperation(HValue* value, HType type = HType::Tagged()) |
1616 : HTemplateInstruction<1>(type) { | 1609 : HTemplateInstruction<1>(type) { |
1617 SetOperandAt(0, value); | 1610 SetOperandAt(0, value); |
1618 } | 1611 } |
1619 | 1612 |
1620 static HUnaryOperation* cast(HValue* value) { | 1613 static HUnaryOperation* cast(HValue* value) { |
1621 return reinterpret_cast<HUnaryOperation*>(value); | 1614 return reinterpret_cast<HUnaryOperation*>(value); |
1622 } | 1615 } |
1623 | 1616 |
1624 HValue* value() const { return OperandAt(0); } | 1617 HValue* value() const { return OperandAt(0); } |
1625 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1618 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
1626 }; | 1619 }; |
1627 | 1620 |
1628 | 1621 |
1629 class HUseConst FINAL : public HUnaryOperation { | 1622 class HUseConst FINAL : public HUnaryOperation { |
1630 public: | 1623 public: |
1631 DECLARE_INSTRUCTION_FACTORY_P1(HUseConst, HValue*); | 1624 DECLARE_INSTRUCTION_FACTORY_P1(HUseConst, HValue*); |
1632 | 1625 |
1633 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 1626 Representation RequiredInputRepresentation(int index) OVERRIDE { |
1634 return Representation::None(); | 1627 return Representation::None(); |
1635 } | 1628 } |
1636 | 1629 |
1637 DECLARE_CONCRETE_INSTRUCTION(UseConst) | 1630 DECLARE_CONCRETE_INSTRUCTION(UseConst) |
1638 | 1631 |
1639 private: | 1632 private: |
1640 explicit HUseConst(HValue* old_value) : HUnaryOperation(old_value) { } | 1633 explicit HUseConst(HValue* old_value) : HUnaryOperation(old_value) { } |
1641 }; | 1634 }; |
1642 | 1635 |
1643 | 1636 |
1644 class HForceRepresentation FINAL : public HTemplateInstruction<1> { | 1637 class HForceRepresentation FINAL : public HTemplateInstruction<1> { |
1645 public: | 1638 public: |
1646 static HInstruction* New(Zone* zone, HValue* context, HValue* value, | 1639 static HInstruction* New(Zone* zone, HValue* context, HValue* value, |
1647 Representation required_representation); | 1640 Representation required_representation); |
1648 | 1641 |
1649 HValue* value() const { return OperandAt(0); } | 1642 HValue* value() const { return OperandAt(0); } |
1650 | 1643 |
1651 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 1644 Representation RequiredInputRepresentation(int index) OVERRIDE { |
1652 return representation(); // Same as the output representation. | 1645 return representation(); // Same as the output representation. |
1653 } | 1646 } |
1654 | 1647 |
1655 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1648 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
1656 | 1649 |
1657 DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation) | 1650 DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation) |
1658 | 1651 |
1659 private: | 1652 private: |
1660 HForceRepresentation(HValue* value, Representation required_representation) { | 1653 HForceRepresentation(HValue* value, Representation required_representation) { |
1661 SetOperandAt(0, value); | 1654 SetOperandAt(0, value); |
1662 set_representation(required_representation); | 1655 set_representation(required_representation); |
1663 } | 1656 } |
1664 }; | 1657 }; |
1665 | 1658 |
(...skipping 21 matching lines...) Expand all Loading... |
1687 } else { | 1680 } else { |
1688 set_type(HType::TaggedNumber()); | 1681 set_type(HType::TaggedNumber()); |
1689 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); | 1682 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); |
1690 } | 1683 } |
1691 } | 1684 } |
1692 | 1685 |
1693 bool can_convert_undefined_to_nan() { | 1686 bool can_convert_undefined_to_nan() { |
1694 return CheckUsesForFlag(kAllowUndefinedAsNaN); | 1687 return CheckUsesForFlag(kAllowUndefinedAsNaN); |
1695 } | 1688 } |
1696 | 1689 |
1697 virtual HType CalculateInferredType() OVERRIDE; | 1690 HType CalculateInferredType() OVERRIDE; |
1698 virtual HValue* Canonicalize() OVERRIDE; | 1691 HValue* Canonicalize() OVERRIDE; |
1699 | 1692 |
1700 Representation from() const { return value()->representation(); } | 1693 Representation from() const { return value()->representation(); } |
1701 Representation to() const { return representation(); } | 1694 Representation to() const { return representation(); } |
1702 bool deoptimize_on_minus_zero() const { | 1695 bool deoptimize_on_minus_zero() const { |
1703 return CheckFlag(kBailoutOnMinusZero); | 1696 return CheckFlag(kBailoutOnMinusZero); |
1704 } | 1697 } |
1705 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 1698 Representation RequiredInputRepresentation(int index) OVERRIDE { |
1706 return from(); | 1699 return from(); |
1707 } | 1700 } |
1708 | 1701 |
1709 virtual Range* InferRange(Zone* zone) OVERRIDE; | 1702 Range* InferRange(Zone* zone) OVERRIDE; |
1710 | 1703 |
1711 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1704 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
1712 | 1705 |
1713 DECLARE_CONCRETE_INSTRUCTION(Change) | 1706 DECLARE_CONCRETE_INSTRUCTION(Change) |
1714 | 1707 |
1715 protected: | 1708 protected: |
1716 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 1709 bool DataEquals(HValue* other) OVERRIDE { return true; } |
1717 | 1710 |
1718 private: | 1711 private: |
1719 virtual bool IsDeletable() const OVERRIDE { | 1712 bool IsDeletable() const OVERRIDE { |
1720 return !from().IsTagged() || value()->type().IsSmi(); | 1713 return !from().IsTagged() || value()->type().IsSmi(); |
1721 } | 1714 } |
1722 }; | 1715 }; |
1723 | 1716 |
1724 | 1717 |
1725 class HClampToUint8 FINAL : public HUnaryOperation { | 1718 class HClampToUint8 FINAL : public HUnaryOperation { |
1726 public: | 1719 public: |
1727 DECLARE_INSTRUCTION_FACTORY_P1(HClampToUint8, HValue*); | 1720 DECLARE_INSTRUCTION_FACTORY_P1(HClampToUint8, HValue*); |
1728 | 1721 |
1729 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 1722 Representation RequiredInputRepresentation(int index) OVERRIDE { |
1730 return Representation::None(); | 1723 return Representation::None(); |
1731 } | 1724 } |
1732 | 1725 |
1733 DECLARE_CONCRETE_INSTRUCTION(ClampToUint8) | 1726 DECLARE_CONCRETE_INSTRUCTION(ClampToUint8) |
1734 | 1727 |
1735 protected: | 1728 protected: |
1736 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 1729 bool DataEquals(HValue* other) OVERRIDE { return true; } |
1737 | 1730 |
1738 private: | 1731 private: |
1739 explicit HClampToUint8(HValue* value) | 1732 explicit HClampToUint8(HValue* value) |
1740 : HUnaryOperation(value) { | 1733 : HUnaryOperation(value) { |
1741 set_representation(Representation::Integer32()); | 1734 set_representation(Representation::Integer32()); |
1742 SetFlag(kAllowUndefinedAsNaN); | 1735 SetFlag(kAllowUndefinedAsNaN); |
1743 SetFlag(kUseGVN); | 1736 SetFlag(kUseGVN); |
1744 } | 1737 } |
1745 | 1738 |
1746 virtual bool IsDeletable() const OVERRIDE { return true; } | 1739 bool IsDeletable() const OVERRIDE { return true; } |
1747 }; | 1740 }; |
1748 | 1741 |
1749 | 1742 |
1750 class HDoubleBits FINAL : public HUnaryOperation { | 1743 class HDoubleBits FINAL : public HUnaryOperation { |
1751 public: | 1744 public: |
1752 enum Bits { HIGH, LOW }; | 1745 enum Bits { HIGH, LOW }; |
1753 DECLARE_INSTRUCTION_FACTORY_P2(HDoubleBits, HValue*, Bits); | 1746 DECLARE_INSTRUCTION_FACTORY_P2(HDoubleBits, HValue*, Bits); |
1754 | 1747 |
1755 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 1748 Representation RequiredInputRepresentation(int index) OVERRIDE { |
1756 return Representation::Double(); | 1749 return Representation::Double(); |
1757 } | 1750 } |
1758 | 1751 |
1759 DECLARE_CONCRETE_INSTRUCTION(DoubleBits) | 1752 DECLARE_CONCRETE_INSTRUCTION(DoubleBits) |
1760 | 1753 |
1761 Bits bits() { return bits_; } | 1754 Bits bits() { return bits_; } |
1762 | 1755 |
1763 protected: | 1756 protected: |
1764 virtual bool DataEquals(HValue* other) OVERRIDE { | 1757 bool DataEquals(HValue* other) OVERRIDE { |
1765 return other->IsDoubleBits() && HDoubleBits::cast(other)->bits() == bits(); | 1758 return other->IsDoubleBits() && HDoubleBits::cast(other)->bits() == bits(); |
1766 } | 1759 } |
1767 | 1760 |
1768 private: | 1761 private: |
1769 HDoubleBits(HValue* value, Bits bits) | 1762 HDoubleBits(HValue* value, Bits bits) |
1770 : HUnaryOperation(value), bits_(bits) { | 1763 : HUnaryOperation(value), bits_(bits) { |
1771 set_representation(Representation::Integer32()); | 1764 set_representation(Representation::Integer32()); |
1772 SetFlag(kUseGVN); | 1765 SetFlag(kUseGVN); |
1773 } | 1766 } |
1774 | 1767 |
1775 virtual bool IsDeletable() const OVERRIDE { return true; } | 1768 bool IsDeletable() const OVERRIDE { return true; } |
1776 | 1769 |
1777 Bits bits_; | 1770 Bits bits_; |
1778 }; | 1771 }; |
1779 | 1772 |
1780 | 1773 |
1781 class HConstructDouble FINAL : public HTemplateInstruction<2> { | 1774 class HConstructDouble FINAL : public HTemplateInstruction<2> { |
1782 public: | 1775 public: |
1783 DECLARE_INSTRUCTION_FACTORY_P2(HConstructDouble, HValue*, HValue*); | 1776 DECLARE_INSTRUCTION_FACTORY_P2(HConstructDouble, HValue*, HValue*); |
1784 | 1777 |
1785 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 1778 Representation RequiredInputRepresentation(int index) OVERRIDE { |
1786 return Representation::Integer32(); | 1779 return Representation::Integer32(); |
1787 } | 1780 } |
1788 | 1781 |
1789 DECLARE_CONCRETE_INSTRUCTION(ConstructDouble) | 1782 DECLARE_CONCRETE_INSTRUCTION(ConstructDouble) |
1790 | 1783 |
1791 HValue* hi() { return OperandAt(0); } | 1784 HValue* hi() { return OperandAt(0); } |
1792 HValue* lo() { return OperandAt(1); } | 1785 HValue* lo() { return OperandAt(1); } |
1793 | 1786 |
1794 protected: | 1787 protected: |
1795 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 1788 bool DataEquals(HValue* other) OVERRIDE { return true; } |
1796 | 1789 |
1797 private: | 1790 private: |
1798 explicit HConstructDouble(HValue* hi, HValue* lo) { | 1791 explicit HConstructDouble(HValue* hi, HValue* lo) { |
1799 set_representation(Representation::Double()); | 1792 set_representation(Representation::Double()); |
1800 SetFlag(kUseGVN); | 1793 SetFlag(kUseGVN); |
1801 SetOperandAt(0, hi); | 1794 SetOperandAt(0, hi); |
1802 SetOperandAt(1, lo); | 1795 SetOperandAt(1, lo); |
1803 } | 1796 } |
1804 | 1797 |
1805 virtual bool IsDeletable() const OVERRIDE { return true; } | 1798 bool IsDeletable() const OVERRIDE { return true; } |
1806 }; | 1799 }; |
1807 | 1800 |
1808 | 1801 |
1809 enum RemovableSimulate { | 1802 enum RemovableSimulate { |
1810 REMOVABLE_SIMULATE, | 1803 REMOVABLE_SIMULATE, |
1811 FIXED_SIMULATE | 1804 FIXED_SIMULATE |
1812 }; | 1805 }; |
1813 | 1806 |
1814 | 1807 |
1815 class HSimulate FINAL : public HInstruction { | 1808 class HSimulate FINAL : public HInstruction { |
1816 public: | 1809 public: |
1817 HSimulate(BailoutId ast_id, int pop_count, Zone* zone, | 1810 HSimulate(BailoutId ast_id, int pop_count, Zone* zone, |
1818 RemovableSimulate removable) | 1811 RemovableSimulate removable) |
1819 : ast_id_(ast_id), | 1812 : ast_id_(ast_id), |
1820 pop_count_(pop_count), | 1813 pop_count_(pop_count), |
1821 values_(2, zone), | 1814 values_(2, zone), |
1822 assigned_indexes_(2, zone), | 1815 assigned_indexes_(2, zone), |
1823 zone_(zone), | 1816 zone_(zone), |
1824 bit_field_(RemovableField::encode(removable) | | 1817 bit_field_(RemovableField::encode(removable) | |
1825 DoneWithReplayField::encode(false)) {} | 1818 DoneWithReplayField::encode(false)) {} |
1826 ~HSimulate() {} | 1819 ~HSimulate() {} |
1827 | 1820 |
1828 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1821 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
1829 | 1822 |
1830 bool HasAstId() const { return !ast_id_.IsNone(); } | 1823 bool HasAstId() const { return !ast_id_.IsNone(); } |
1831 BailoutId ast_id() const { return ast_id_; } | 1824 BailoutId ast_id() const { return ast_id_; } |
1832 void set_ast_id(BailoutId id) { | 1825 void set_ast_id(BailoutId id) { |
1833 DCHECK(!HasAstId()); | 1826 DCHECK(!HasAstId()); |
1834 ast_id_ = id; | 1827 ast_id_ = id; |
1835 } | 1828 } |
1836 | 1829 |
1837 int pop_count() const { return pop_count_; } | 1830 int pop_count() const { return pop_count_; } |
1838 const ZoneList<HValue*>* values() const { return &values_; } | 1831 const ZoneList<HValue*>* values() const { return &values_; } |
1839 int GetAssignedIndexAt(int index) const { | 1832 int GetAssignedIndexAt(int index) const { |
1840 DCHECK(HasAssignedIndexAt(index)); | 1833 DCHECK(HasAssignedIndexAt(index)); |
1841 return assigned_indexes_[index]; | 1834 return assigned_indexes_[index]; |
1842 } | 1835 } |
1843 bool HasAssignedIndexAt(int index) const { | 1836 bool HasAssignedIndexAt(int index) const { |
1844 return assigned_indexes_[index] != kNoIndex; | 1837 return assigned_indexes_[index] != kNoIndex; |
1845 } | 1838 } |
1846 void AddAssignedValue(int index, HValue* value) { | 1839 void AddAssignedValue(int index, HValue* value) { |
1847 AddValue(index, value); | 1840 AddValue(index, value); |
1848 } | 1841 } |
1849 void AddPushedValue(HValue* value) { | 1842 void AddPushedValue(HValue* value) { |
1850 AddValue(kNoIndex, value); | 1843 AddValue(kNoIndex, value); |
1851 } | 1844 } |
1852 int ToOperandIndex(int environment_index) { | 1845 int ToOperandIndex(int environment_index) { |
1853 for (int i = 0; i < assigned_indexes_.length(); ++i) { | 1846 for (int i = 0; i < assigned_indexes_.length(); ++i) { |
1854 if (assigned_indexes_[i] == environment_index) return i; | 1847 if (assigned_indexes_[i] == environment_index) return i; |
1855 } | 1848 } |
1856 return -1; | 1849 return -1; |
1857 } | 1850 } |
1858 virtual int OperandCount() const OVERRIDE { return values_.length(); } | 1851 int OperandCount() const OVERRIDE { return values_.length(); } |
1859 virtual HValue* OperandAt(int index) const OVERRIDE { | 1852 HValue* OperandAt(int index) const OVERRIDE { return values_[index]; } |
1860 return values_[index]; | |
1861 } | |
1862 | 1853 |
1863 virtual bool HasEscapingOperandAt(int index) OVERRIDE { return false; } | 1854 bool HasEscapingOperandAt(int index) OVERRIDE { return false; } |
1864 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 1855 Representation RequiredInputRepresentation(int index) OVERRIDE { |
1865 return Representation::None(); | 1856 return Representation::None(); |
1866 } | 1857 } |
1867 | 1858 |
1868 void MergeWith(ZoneList<HSimulate*>* list); | 1859 void MergeWith(ZoneList<HSimulate*>* list); |
1869 bool is_candidate_for_removal() { | 1860 bool is_candidate_for_removal() { |
1870 return RemovableField::decode(bit_field_) == REMOVABLE_SIMULATE; | 1861 return RemovableField::decode(bit_field_) == REMOVABLE_SIMULATE; |
1871 } | 1862 } |
1872 | 1863 |
1873 // Replay effects of this instruction on the given environment. | 1864 // Replay effects of this instruction on the given environment. |
1874 void ReplayEnvironment(HEnvironment* env); | 1865 void ReplayEnvironment(HEnvironment* env); |
1875 | 1866 |
1876 DECLARE_CONCRETE_INSTRUCTION(Simulate) | 1867 DECLARE_CONCRETE_INSTRUCTION(Simulate) |
1877 | 1868 |
1878 #ifdef DEBUG | 1869 #ifdef DEBUG |
1879 virtual void Verify() OVERRIDE; | 1870 void Verify() OVERRIDE; |
1880 void set_closure(Handle<JSFunction> closure) { closure_ = closure; } | 1871 void set_closure(Handle<JSFunction> closure) { closure_ = closure; } |
1881 Handle<JSFunction> closure() const { return closure_; } | 1872 Handle<JSFunction> closure() const { return closure_; } |
1882 #endif | 1873 #endif |
1883 | 1874 |
1884 protected: | 1875 protected: |
1885 virtual void InternalSetOperandAt(int index, HValue* value) OVERRIDE { | 1876 void InternalSetOperandAt(int index, HValue* value) OVERRIDE { |
1886 values_[index] = value; | 1877 values_[index] = value; |
1887 } | 1878 } |
1888 | 1879 |
1889 private: | 1880 private: |
1890 static const int kNoIndex = -1; | 1881 static const int kNoIndex = -1; |
1891 void AddValue(int index, HValue* value) { | 1882 void AddValue(int index, HValue* value) { |
1892 assigned_indexes_.Add(index, zone_); | 1883 assigned_indexes_.Add(index, zone_); |
1893 // Resize the list of pushed values. | 1884 // Resize the list of pushed values. |
1894 values_.Add(NULL, zone_); | 1885 values_.Add(NULL, zone_); |
1895 // Set the operand through the base method in HValue to make sure that the | 1886 // Set the operand through the base method in HValue to make sure that the |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1931 | 1922 |
1932 DECLARE_INSTRUCTION_FACTORY_P2(HEnvironmentMarker, Kind, int); | 1923 DECLARE_INSTRUCTION_FACTORY_P2(HEnvironmentMarker, Kind, int); |
1933 | 1924 |
1934 Kind kind() const { return kind_; } | 1925 Kind kind() const { return kind_; } |
1935 int index() const { return index_; } | 1926 int index() const { return index_; } |
1936 HSimulate* next_simulate() { return next_simulate_; } | 1927 HSimulate* next_simulate() { return next_simulate_; } |
1937 void set_next_simulate(HSimulate* simulate) { | 1928 void set_next_simulate(HSimulate* simulate) { |
1938 next_simulate_ = simulate; | 1929 next_simulate_ = simulate; |
1939 } | 1930 } |
1940 | 1931 |
1941 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 1932 Representation RequiredInputRepresentation(int index) OVERRIDE { |
1942 return Representation::None(); | 1933 return Representation::None(); |
1943 } | 1934 } |
1944 | 1935 |
1945 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1936 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
1946 | 1937 |
1947 #ifdef DEBUG | 1938 #ifdef DEBUG |
1948 void set_closure(Handle<JSFunction> closure) { | 1939 void set_closure(Handle<JSFunction> closure) { |
1949 DCHECK(closure_.is_null()); | 1940 DCHECK(closure_.is_null()); |
1950 DCHECK(!closure.is_null()); | 1941 DCHECK(!closure.is_null()); |
1951 closure_ = closure; | 1942 closure_ = closure; |
1952 } | 1943 } |
1953 Handle<JSFunction> closure() const { return closure_; } | 1944 Handle<JSFunction> closure() const { return closure_; } |
1954 #endif | 1945 #endif |
1955 | 1946 |
(...skipping 17 matching lines...) Expand all Loading... |
1973 public: | 1964 public: |
1974 enum Type { | 1965 enum Type { |
1975 kFunctionEntry, | 1966 kFunctionEntry, |
1976 kBackwardsBranch | 1967 kBackwardsBranch |
1977 }; | 1968 }; |
1978 | 1969 |
1979 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HStackCheck, Type); | 1970 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HStackCheck, Type); |
1980 | 1971 |
1981 HValue* context() { return OperandAt(0); } | 1972 HValue* context() { return OperandAt(0); } |
1982 | 1973 |
1983 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 1974 Representation RequiredInputRepresentation(int index) OVERRIDE { |
1984 return Representation::Tagged(); | 1975 return Representation::Tagged(); |
1985 } | 1976 } |
1986 | 1977 |
1987 void Eliminate() { | 1978 void Eliminate() { |
1988 // The stack check eliminator might try to eliminate the same stack | 1979 // The stack check eliminator might try to eliminate the same stack |
1989 // check instruction multiple times. | 1980 // check instruction multiple times. |
1990 if (IsLinked()) { | 1981 if (IsLinked()) { |
1991 DeleteAndReplaceWith(NULL); | 1982 DeleteAndReplaceWith(NULL); |
1992 } | 1983 } |
1993 } | 1984 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2028 InliningKind inlining_kind, Variable* arguments_var, | 2019 InliningKind inlining_kind, Variable* arguments_var, |
2029 HArgumentsObject* arguments_object) { | 2020 HArgumentsObject* arguments_object) { |
2030 return new (zone) HEnterInlined(return_id, closure, closure_context, | 2021 return new (zone) HEnterInlined(return_id, closure, closure_context, |
2031 arguments_count, function, inlining_kind, | 2022 arguments_count, function, inlining_kind, |
2032 arguments_var, arguments_object, zone); | 2023 arguments_var, arguments_object, zone); |
2033 } | 2024 } |
2034 | 2025 |
2035 void RegisterReturnTarget(HBasicBlock* return_target, Zone* zone); | 2026 void RegisterReturnTarget(HBasicBlock* return_target, Zone* zone); |
2036 ZoneList<HBasicBlock*>* return_targets() { return &return_targets_; } | 2027 ZoneList<HBasicBlock*>* return_targets() { return &return_targets_; } |
2037 | 2028 |
2038 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 2029 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
2039 | 2030 |
2040 Handle<JSFunction> closure() const { return closure_; } | 2031 Handle<JSFunction> closure() const { return closure_; } |
2041 HConstant* closure_context() const { return closure_context_; } | 2032 HConstant* closure_context() const { return closure_context_; } |
2042 int arguments_count() const { return arguments_count_; } | 2033 int arguments_count() const { return arguments_count_; } |
2043 bool arguments_pushed() const { return arguments_pushed_; } | 2034 bool arguments_pushed() const { return arguments_pushed_; } |
2044 void set_arguments_pushed() { arguments_pushed_ = true; } | 2035 void set_arguments_pushed() { arguments_pushed_ = true; } |
2045 FunctionLiteral* function() const { return function_; } | 2036 FunctionLiteral* function() const { return function_; } |
2046 InliningKind inlining_kind() const { return inlining_kind_; } | 2037 InliningKind inlining_kind() const { return inlining_kind_; } |
2047 BailoutId ReturnId() const { return return_id_; } | 2038 BailoutId ReturnId() const { return return_id_; } |
2048 | 2039 |
2049 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 2040 Representation RequiredInputRepresentation(int index) OVERRIDE { |
2050 return Representation::None(); | 2041 return Representation::None(); |
2051 } | 2042 } |
2052 | 2043 |
2053 Variable* arguments_var() { return arguments_var_; } | 2044 Variable* arguments_var() { return arguments_var_; } |
2054 HArgumentsObject* arguments_object() { return arguments_object_; } | 2045 HArgumentsObject* arguments_object() { return arguments_object_; } |
2055 | 2046 |
2056 DECLARE_CONCRETE_INSTRUCTION(EnterInlined) | 2047 DECLARE_CONCRETE_INSTRUCTION(EnterInlined) |
2057 | 2048 |
2058 private: | 2049 private: |
2059 HEnterInlined(BailoutId return_id, Handle<JSFunction> closure, | 2050 HEnterInlined(BailoutId return_id, Handle<JSFunction> closure, |
(...skipping 25 matching lines...) Expand all Loading... |
2085 }; | 2076 }; |
2086 | 2077 |
2087 | 2078 |
2088 class HLeaveInlined FINAL : public HTemplateInstruction<0> { | 2079 class HLeaveInlined FINAL : public HTemplateInstruction<0> { |
2089 public: | 2080 public: |
2090 HLeaveInlined(HEnterInlined* entry, | 2081 HLeaveInlined(HEnterInlined* entry, |
2091 int drop_count) | 2082 int drop_count) |
2092 : entry_(entry), | 2083 : entry_(entry), |
2093 drop_count_(drop_count) { } | 2084 drop_count_(drop_count) { } |
2094 | 2085 |
2095 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 2086 Representation RequiredInputRepresentation(int index) OVERRIDE { |
2096 return Representation::None(); | 2087 return Representation::None(); |
2097 } | 2088 } |
2098 | 2089 |
2099 virtual int argument_delta() const OVERRIDE { | 2090 int argument_delta() const OVERRIDE { |
2100 return entry_->arguments_pushed() ? -drop_count_ : 0; | 2091 return entry_->arguments_pushed() ? -drop_count_ : 0; |
2101 } | 2092 } |
2102 | 2093 |
2103 DECLARE_CONCRETE_INSTRUCTION(LeaveInlined) | 2094 DECLARE_CONCRETE_INSTRUCTION(LeaveInlined) |
2104 | 2095 |
2105 private: | 2096 private: |
2106 HEnterInlined* entry_; | 2097 HEnterInlined* entry_; |
2107 int drop_count_; | 2098 int drop_count_; |
2108 }; | 2099 }; |
2109 | 2100 |
(...skipping 26 matching lines...) Expand all Loading... |
2136 static HPushArguments* New(Zone* zone, HValue* context, HValue* arg1, | 2127 static HPushArguments* New(Zone* zone, HValue* context, HValue* arg1, |
2137 HValue* arg2, HValue* arg3, HValue* arg4) { | 2128 HValue* arg2, HValue* arg3, HValue* arg4) { |
2138 HPushArguments* instr = new(zone) HPushArguments(zone); | 2129 HPushArguments* instr = new(zone) HPushArguments(zone); |
2139 instr->AddInput(arg1); | 2130 instr->AddInput(arg1); |
2140 instr->AddInput(arg2); | 2131 instr->AddInput(arg2); |
2141 instr->AddInput(arg3); | 2132 instr->AddInput(arg3); |
2142 instr->AddInput(arg4); | 2133 instr->AddInput(arg4); |
2143 return instr; | 2134 return instr; |
2144 } | 2135 } |
2145 | 2136 |
2146 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 2137 Representation RequiredInputRepresentation(int index) OVERRIDE { |
2147 return Representation::Tagged(); | 2138 return Representation::Tagged(); |
2148 } | 2139 } |
2149 | 2140 |
2150 virtual int argument_delta() const OVERRIDE { return inputs_.length(); } | 2141 int argument_delta() const OVERRIDE { return inputs_.length(); } |
2151 HValue* argument(int i) { return OperandAt(i); } | 2142 HValue* argument(int i) { return OperandAt(i); } |
2152 | 2143 |
2153 virtual int OperandCount() const FINAL OVERRIDE { | 2144 int OperandCount() const FINAL { return inputs_.length(); } |
2154 return inputs_.length(); | 2145 HValue* OperandAt(int i) const FINAL { return inputs_[i]; } |
2155 } | |
2156 virtual HValue* OperandAt(int i) const FINAL OVERRIDE { | |
2157 return inputs_[i]; | |
2158 } | |
2159 | 2146 |
2160 void AddInput(HValue* value); | 2147 void AddInput(HValue* value); |
2161 | 2148 |
2162 DECLARE_CONCRETE_INSTRUCTION(PushArguments) | 2149 DECLARE_CONCRETE_INSTRUCTION(PushArguments) |
2163 | 2150 |
2164 protected: | 2151 protected: |
2165 virtual void InternalSetOperandAt(int i, HValue* value) FINAL OVERRIDE { | 2152 void InternalSetOperandAt(int i, HValue* value) FINAL { inputs_[i] = value; } |
2166 inputs_[i] = value; | |
2167 } | |
2168 | 2153 |
2169 private: | 2154 private: |
2170 explicit HPushArguments(Zone* zone) | 2155 explicit HPushArguments(Zone* zone) |
2171 : HInstruction(HType::Tagged()), inputs_(4, zone) { | 2156 : HInstruction(HType::Tagged()), inputs_(4, zone) { |
2172 set_representation(Representation::Tagged()); | 2157 set_representation(Representation::Tagged()); |
2173 } | 2158 } |
2174 | 2159 |
2175 ZoneList<HValue*> inputs_; | 2160 ZoneList<HValue*> inputs_; |
2176 }; | 2161 }; |
2177 | 2162 |
2178 | 2163 |
2179 class HThisFunction FINAL : public HTemplateInstruction<0> { | 2164 class HThisFunction FINAL : public HTemplateInstruction<0> { |
2180 public: | 2165 public: |
2181 DECLARE_INSTRUCTION_FACTORY_P0(HThisFunction); | 2166 DECLARE_INSTRUCTION_FACTORY_P0(HThisFunction); |
2182 | 2167 |
2183 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 2168 Representation RequiredInputRepresentation(int index) OVERRIDE { |
2184 return Representation::None(); | 2169 return Representation::None(); |
2185 } | 2170 } |
2186 | 2171 |
2187 DECLARE_CONCRETE_INSTRUCTION(ThisFunction) | 2172 DECLARE_CONCRETE_INSTRUCTION(ThisFunction) |
2188 | 2173 |
2189 protected: | 2174 protected: |
2190 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 2175 bool DataEquals(HValue* other) OVERRIDE { return true; } |
2191 | 2176 |
2192 private: | 2177 private: |
2193 HThisFunction() { | 2178 HThisFunction() { |
2194 set_representation(Representation::Tagged()); | 2179 set_representation(Representation::Tagged()); |
2195 SetFlag(kUseGVN); | 2180 SetFlag(kUseGVN); |
2196 } | 2181 } |
2197 | 2182 |
2198 virtual bool IsDeletable() const OVERRIDE { return true; } | 2183 bool IsDeletable() const OVERRIDE { return true; } |
2199 }; | 2184 }; |
2200 | 2185 |
2201 | 2186 |
2202 class HDeclareGlobals FINAL : public HUnaryOperation { | 2187 class HDeclareGlobals FINAL : public HUnaryOperation { |
2203 public: | 2188 public: |
2204 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HDeclareGlobals, | 2189 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HDeclareGlobals, |
2205 Handle<FixedArray>, | 2190 Handle<FixedArray>, |
2206 int); | 2191 int); |
2207 | 2192 |
2208 HValue* context() { return OperandAt(0); } | 2193 HValue* context() { return OperandAt(0); } |
2209 Handle<FixedArray> pairs() const { return pairs_; } | 2194 Handle<FixedArray> pairs() const { return pairs_; } |
2210 int flags() const { return flags_; } | 2195 int flags() const { return flags_; } |
2211 | 2196 |
2212 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals) | 2197 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals) |
2213 | 2198 |
2214 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 2199 Representation RequiredInputRepresentation(int index) OVERRIDE { |
2215 return Representation::Tagged(); | 2200 return Representation::Tagged(); |
2216 } | 2201 } |
2217 | 2202 |
2218 private: | 2203 private: |
2219 HDeclareGlobals(HValue* context, | 2204 HDeclareGlobals(HValue* context, |
2220 Handle<FixedArray> pairs, | 2205 Handle<FixedArray> pairs, |
2221 int flags) | 2206 int flags) |
2222 : HUnaryOperation(context), | 2207 : HUnaryOperation(context), |
2223 pairs_(pairs), | 2208 pairs_(pairs), |
2224 flags_(flags) { | 2209 flags_(flags) { |
2225 set_representation(Representation::Tagged()); | 2210 set_representation(Representation::Tagged()); |
2226 SetAllSideEffects(); | 2211 SetAllSideEffects(); |
2227 } | 2212 } |
2228 | 2213 |
2229 Handle<FixedArray> pairs_; | 2214 Handle<FixedArray> pairs_; |
2230 int flags_; | 2215 int flags_; |
2231 }; | 2216 }; |
2232 | 2217 |
2233 | 2218 |
2234 template <int V> | 2219 template <int V> |
2235 class HCall : public HTemplateInstruction<V> { | 2220 class HCall : public HTemplateInstruction<V> { |
2236 public: | 2221 public: |
2237 // The argument count includes the receiver. | 2222 // The argument count includes the receiver. |
2238 explicit HCall<V>(int argument_count) : argument_count_(argument_count) { | 2223 explicit HCall<V>(int argument_count) : argument_count_(argument_count) { |
2239 this->set_representation(Representation::Tagged()); | 2224 this->set_representation(Representation::Tagged()); |
2240 this->SetAllSideEffects(); | 2225 this->SetAllSideEffects(); |
2241 } | 2226 } |
2242 | 2227 |
2243 virtual HType CalculateInferredType() FINAL OVERRIDE { | 2228 HType CalculateInferredType() FINAL { return HType::Tagged(); } |
2244 return HType::Tagged(); | |
2245 } | |
2246 | 2229 |
2247 virtual int argument_count() const { | 2230 virtual int argument_count() const { |
2248 return argument_count_; | 2231 return argument_count_; |
2249 } | 2232 } |
2250 | 2233 |
2251 virtual int argument_delta() const OVERRIDE { | 2234 int argument_delta() const OVERRIDE { return -argument_count(); } |
2252 return -argument_count(); | |
2253 } | |
2254 | 2235 |
2255 private: | 2236 private: |
2256 int argument_count_; | 2237 int argument_count_; |
2257 }; | 2238 }; |
2258 | 2239 |
2259 | 2240 |
2260 class HUnaryCall : public HCall<1> { | 2241 class HUnaryCall : public HCall<1> { |
2261 public: | 2242 public: |
2262 HUnaryCall(HValue* value, int argument_count) | 2243 HUnaryCall(HValue* value, int argument_count) |
2263 : HCall<1>(argument_count) { | 2244 : HCall<1>(argument_count) { |
2264 SetOperandAt(0, value); | 2245 SetOperandAt(0, value); |
2265 } | 2246 } |
2266 | 2247 |
2267 virtual Representation RequiredInputRepresentation( | 2248 Representation RequiredInputRepresentation(int index) FINAL { |
2268 int index) FINAL OVERRIDE { | |
2269 return Representation::Tagged(); | 2249 return Representation::Tagged(); |
2270 } | 2250 } |
2271 | 2251 |
2272 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 2252 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
2273 | 2253 |
2274 HValue* value() const { return OperandAt(0); } | 2254 HValue* value() const { return OperandAt(0); } |
2275 }; | 2255 }; |
2276 | 2256 |
2277 | 2257 |
2278 class HBinaryCall : public HCall<2> { | 2258 class HBinaryCall : public HCall<2> { |
2279 public: | 2259 public: |
2280 HBinaryCall(HValue* first, HValue* second, int argument_count) | 2260 HBinaryCall(HValue* first, HValue* second, int argument_count) |
2281 : HCall<2>(argument_count) { | 2261 : HCall<2>(argument_count) { |
2282 SetOperandAt(0, first); | 2262 SetOperandAt(0, first); |
2283 SetOperandAt(1, second); | 2263 SetOperandAt(1, second); |
2284 } | 2264 } |
2285 | 2265 |
2286 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 2266 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
2287 | 2267 |
2288 virtual Representation RequiredInputRepresentation( | 2268 Representation RequiredInputRepresentation(int index) FINAL { |
2289 int index) FINAL OVERRIDE { | |
2290 return Representation::Tagged(); | 2269 return Representation::Tagged(); |
2291 } | 2270 } |
2292 | 2271 |
2293 HValue* first() const { return OperandAt(0); } | 2272 HValue* first() const { return OperandAt(0); } |
2294 HValue* second() const { return OperandAt(1); } | 2273 HValue* second() const { return OperandAt(1); } |
2295 }; | 2274 }; |
2296 | 2275 |
2297 | 2276 |
2298 class HCallJSFunction FINAL : public HCall<1> { | 2277 class HCallJSFunction FINAL : public HCall<1> { |
2299 public: | 2278 public: |
2300 static HCallJSFunction* New(Zone* zone, | 2279 static HCallJSFunction* New(Zone* zone, |
2301 HValue* context, | 2280 HValue* context, |
2302 HValue* function, | 2281 HValue* function, |
2303 int argument_count, | 2282 int argument_count, |
2304 bool pass_argument_count); | 2283 bool pass_argument_count); |
2305 | 2284 |
2306 HValue* function() const { return OperandAt(0); } | 2285 HValue* function() const { return OperandAt(0); } |
2307 | 2286 |
2308 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 2287 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
2309 | 2288 |
2310 virtual Representation RequiredInputRepresentation( | 2289 Representation RequiredInputRepresentation(int index) FINAL { |
2311 int index) FINAL OVERRIDE { | |
2312 DCHECK(index == 0); | 2290 DCHECK(index == 0); |
2313 return Representation::Tagged(); | 2291 return Representation::Tagged(); |
2314 } | 2292 } |
2315 | 2293 |
2316 bool pass_argument_count() const { return pass_argument_count_; } | 2294 bool pass_argument_count() const { return pass_argument_count_; } |
2317 | 2295 |
2318 virtual bool HasStackCheck() FINAL OVERRIDE { | 2296 bool HasStackCheck() FINAL { return has_stack_check_; } |
2319 return has_stack_check_; | |
2320 } | |
2321 | 2297 |
2322 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction) | 2298 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction) |
2323 | 2299 |
2324 private: | 2300 private: |
2325 // The argument count includes the receiver. | 2301 // The argument count includes the receiver. |
2326 HCallJSFunction(HValue* function, | 2302 HCallJSFunction(HValue* function, |
2327 int argument_count, | 2303 int argument_count, |
2328 bool pass_argument_count, | 2304 bool pass_argument_count, |
2329 bool has_stack_check) | 2305 bool has_stack_check) |
2330 : HCall<1>(argument_count), | 2306 : HCall<1>(argument_count), |
(...skipping 12 matching lines...) Expand all Loading... |
2343 static HCallWithDescriptor* New(Zone* zone, HValue* context, HValue* target, | 2319 static HCallWithDescriptor* New(Zone* zone, HValue* context, HValue* target, |
2344 int argument_count, | 2320 int argument_count, |
2345 CallInterfaceDescriptor descriptor, | 2321 CallInterfaceDescriptor descriptor, |
2346 const Vector<HValue*>& operands) { | 2322 const Vector<HValue*>& operands) { |
2347 DCHECK(operands.length() == descriptor.GetEnvironmentLength()); | 2323 DCHECK(operands.length() == descriptor.GetEnvironmentLength()); |
2348 HCallWithDescriptor* res = new (zone) | 2324 HCallWithDescriptor* res = new (zone) |
2349 HCallWithDescriptor(target, argument_count, descriptor, operands, zone); | 2325 HCallWithDescriptor(target, argument_count, descriptor, operands, zone); |
2350 return res; | 2326 return res; |
2351 } | 2327 } |
2352 | 2328 |
2353 virtual int OperandCount() const FINAL OVERRIDE { | 2329 int OperandCount() const FINAL { return values_.length(); } |
2354 return values_.length(); | 2330 HValue* OperandAt(int index) const FINAL { return values_[index]; } |
2355 } | |
2356 virtual HValue* OperandAt(int index) const FINAL OVERRIDE { | |
2357 return values_[index]; | |
2358 } | |
2359 | 2331 |
2360 virtual Representation RequiredInputRepresentation( | 2332 Representation RequiredInputRepresentation(int index) FINAL { |
2361 int index) FINAL OVERRIDE { | |
2362 if (index == 0) { | 2333 if (index == 0) { |
2363 return Representation::Tagged(); | 2334 return Representation::Tagged(); |
2364 } else { | 2335 } else { |
2365 int par_index = index - 1; | 2336 int par_index = index - 1; |
2366 DCHECK(par_index < descriptor_.GetEnvironmentLength()); | 2337 DCHECK(par_index < descriptor_.GetEnvironmentLength()); |
2367 return descriptor_.GetParameterRepresentation(par_index); | 2338 return descriptor_.GetParameterRepresentation(par_index); |
2368 } | 2339 } |
2369 } | 2340 } |
2370 | 2341 |
2371 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor) | 2342 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor) |
2372 | 2343 |
2373 virtual HType CalculateInferredType() FINAL OVERRIDE { | 2344 HType CalculateInferredType() FINAL { return HType::Tagged(); } |
2374 return HType::Tagged(); | |
2375 } | |
2376 | 2345 |
2377 virtual int argument_count() const { | 2346 virtual int argument_count() const { |
2378 return argument_count_; | 2347 return argument_count_; |
2379 } | 2348 } |
2380 | 2349 |
2381 virtual int argument_delta() const OVERRIDE { | 2350 int argument_delta() const OVERRIDE { return -argument_count_; } |
2382 return -argument_count_; | |
2383 } | |
2384 | 2351 |
2385 CallInterfaceDescriptor descriptor() const { return descriptor_; } | 2352 CallInterfaceDescriptor descriptor() const { return descriptor_; } |
2386 | 2353 |
2387 HValue* target() { | 2354 HValue* target() { |
2388 return OperandAt(0); | 2355 return OperandAt(0); |
2389 } | 2356 } |
2390 | 2357 |
2391 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 2358 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
2392 | 2359 |
2393 private: | 2360 private: |
2394 // The argument count includes the receiver. | 2361 // The argument count includes the receiver. |
2395 HCallWithDescriptor(HValue* target, int argument_count, | 2362 HCallWithDescriptor(HValue* target, int argument_count, |
2396 CallInterfaceDescriptor descriptor, | 2363 CallInterfaceDescriptor descriptor, |
2397 const Vector<HValue*>& operands, Zone* zone) | 2364 const Vector<HValue*>& operands, Zone* zone) |
2398 : descriptor_(descriptor), | 2365 : descriptor_(descriptor), |
2399 values_(descriptor.GetEnvironmentLength() + 1, zone) { | 2366 values_(descriptor.GetEnvironmentLength() + 1, zone) { |
2400 argument_count_ = argument_count; | 2367 argument_count_ = argument_count; |
2401 AddOperand(target, zone); | 2368 AddOperand(target, zone); |
2402 for (int i = 0; i < operands.length(); i++) { | 2369 for (int i = 0; i < operands.length(); i++) { |
2403 AddOperand(operands[i], zone); | 2370 AddOperand(operands[i], zone); |
2404 } | 2371 } |
2405 this->set_representation(Representation::Tagged()); | 2372 this->set_representation(Representation::Tagged()); |
2406 this->SetAllSideEffects(); | 2373 this->SetAllSideEffects(); |
2407 } | 2374 } |
2408 | 2375 |
2409 void AddOperand(HValue* v, Zone* zone) { | 2376 void AddOperand(HValue* v, Zone* zone) { |
2410 values_.Add(NULL, zone); | 2377 values_.Add(NULL, zone); |
2411 SetOperandAt(values_.length() - 1, v); | 2378 SetOperandAt(values_.length() - 1, v); |
2412 } | 2379 } |
2413 | 2380 |
2414 void InternalSetOperandAt(int index, | 2381 void InternalSetOperandAt(int index, HValue* value) FINAL { |
2415 HValue* value) FINAL OVERRIDE { | |
2416 values_[index] = value; | 2382 values_[index] = value; |
2417 } | 2383 } |
2418 | 2384 |
2419 CallInterfaceDescriptor descriptor_; | 2385 CallInterfaceDescriptor descriptor_; |
2420 ZoneList<HValue*> values_; | 2386 ZoneList<HValue*> values_; |
2421 int argument_count_; | 2387 int argument_count_; |
2422 }; | 2388 }; |
2423 | 2389 |
2424 | 2390 |
2425 class HInvokeFunction FINAL : public HBinaryCall { | 2391 class HInvokeFunction FINAL : public HBinaryCall { |
(...skipping 20 matching lines...) Expand all Loading... |
2446 int argument_count) { | 2412 int argument_count) { |
2447 return new(zone) HInvokeFunction(context, function, | 2413 return new(zone) HInvokeFunction(context, function, |
2448 known_function, argument_count); | 2414 known_function, argument_count); |
2449 } | 2415 } |
2450 | 2416 |
2451 HValue* context() { return first(); } | 2417 HValue* context() { return first(); } |
2452 HValue* function() { return second(); } | 2418 HValue* function() { return second(); } |
2453 Handle<JSFunction> known_function() { return known_function_; } | 2419 Handle<JSFunction> known_function() { return known_function_; } |
2454 int formal_parameter_count() const { return formal_parameter_count_; } | 2420 int formal_parameter_count() const { return formal_parameter_count_; } |
2455 | 2421 |
2456 virtual bool HasStackCheck() FINAL OVERRIDE { | 2422 bool HasStackCheck() FINAL { return has_stack_check_; } |
2457 return has_stack_check_; | |
2458 } | |
2459 | 2423 |
2460 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction) | 2424 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction) |
2461 | 2425 |
2462 private: | 2426 private: |
2463 HInvokeFunction(HValue* context, HValue* function, int argument_count) | 2427 HInvokeFunction(HValue* context, HValue* function, int argument_count) |
2464 : HBinaryCall(context, function, argument_count), | 2428 : HBinaryCall(context, function, argument_count), |
2465 has_stack_check_(false) { | 2429 has_stack_check_(false) { |
2466 } | 2430 } |
2467 | 2431 |
2468 Handle<JSFunction> known_function_; | 2432 Handle<JSFunction> known_function_; |
2469 int formal_parameter_count_; | 2433 int formal_parameter_count_; |
2470 bool has_stack_check_; | 2434 bool has_stack_check_; |
2471 }; | 2435 }; |
2472 | 2436 |
2473 | 2437 |
2474 class HCallFunction FINAL : public HBinaryCall { | 2438 class HCallFunction FINAL : public HBinaryCall { |
2475 public: | 2439 public: |
2476 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallFunction, HValue*, int); | 2440 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallFunction, HValue*, int); |
2477 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3( | 2441 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3( |
2478 HCallFunction, HValue*, int, CallFunctionFlags); | 2442 HCallFunction, HValue*, int, CallFunctionFlags); |
2479 | 2443 |
2480 HValue* context() { return first(); } | 2444 HValue* context() { return first(); } |
2481 HValue* function() { return second(); } | 2445 HValue* function() { return second(); } |
2482 CallFunctionFlags function_flags() const { return function_flags_; } | 2446 CallFunctionFlags function_flags() const { return function_flags_; } |
2483 | 2447 |
2484 DECLARE_CONCRETE_INSTRUCTION(CallFunction) | 2448 DECLARE_CONCRETE_INSTRUCTION(CallFunction) |
2485 | 2449 |
2486 virtual int argument_delta() const OVERRIDE { return -argument_count(); } | 2450 int argument_delta() const OVERRIDE { return -argument_count(); } |
2487 | 2451 |
2488 private: | 2452 private: |
2489 HCallFunction(HValue* context, | 2453 HCallFunction(HValue* context, |
2490 HValue* function, | 2454 HValue* function, |
2491 int argument_count, | 2455 int argument_count, |
2492 CallFunctionFlags flags = NO_CALL_FUNCTION_FLAGS) | 2456 CallFunctionFlags flags = NO_CALL_FUNCTION_FLAGS) |
2493 : HBinaryCall(context, function, argument_count), function_flags_(flags) { | 2457 : HBinaryCall(context, function, argument_count), function_flags_(flags) { |
2494 } | 2458 } |
2495 CallFunctionFlags function_flags_; | 2459 CallFunctionFlags function_flags_; |
2496 }; | 2460 }; |
(...skipping 17 matching lines...) Expand all Loading... |
2514 class HCallNewArray FINAL : public HBinaryCall { | 2478 class HCallNewArray FINAL : public HBinaryCall { |
2515 public: | 2479 public: |
2516 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCallNewArray, | 2480 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCallNewArray, |
2517 HValue*, | 2481 HValue*, |
2518 int, | 2482 int, |
2519 ElementsKind); | 2483 ElementsKind); |
2520 | 2484 |
2521 HValue* context() { return first(); } | 2485 HValue* context() { return first(); } |
2522 HValue* constructor() { return second(); } | 2486 HValue* constructor() { return second(); } |
2523 | 2487 |
2524 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 2488 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
2525 | 2489 |
2526 ElementsKind elements_kind() const { return elements_kind_; } | 2490 ElementsKind elements_kind() const { return elements_kind_; } |
2527 | 2491 |
2528 DECLARE_CONCRETE_INSTRUCTION(CallNewArray) | 2492 DECLARE_CONCRETE_INSTRUCTION(CallNewArray) |
2529 | 2493 |
2530 private: | 2494 private: |
2531 HCallNewArray(HValue* context, HValue* constructor, int argument_count, | 2495 HCallNewArray(HValue* context, HValue* constructor, int argument_count, |
2532 ElementsKind elements_kind) | 2496 ElementsKind elements_kind) |
2533 : HBinaryCall(context, constructor, argument_count), | 2497 : HBinaryCall(context, constructor, argument_count), |
2534 elements_kind_(elements_kind) {} | 2498 elements_kind_(elements_kind) {} |
2535 | 2499 |
2536 ElementsKind elements_kind_; | 2500 ElementsKind elements_kind_; |
2537 }; | 2501 }; |
2538 | 2502 |
2539 | 2503 |
2540 class HCallRuntime FINAL : public HCall<1> { | 2504 class HCallRuntime FINAL : public HCall<1> { |
2541 public: | 2505 public: |
2542 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCallRuntime, | 2506 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCallRuntime, |
2543 Handle<String>, | 2507 Handle<String>, |
2544 const Runtime::Function*, | 2508 const Runtime::Function*, |
2545 int); | 2509 int); |
2546 | 2510 |
2547 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 2511 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
2548 | 2512 |
2549 HValue* context() { return OperandAt(0); } | 2513 HValue* context() { return OperandAt(0); } |
2550 const Runtime::Function* function() const { return c_function_; } | 2514 const Runtime::Function* function() const { return c_function_; } |
2551 Handle<String> name() const { return name_; } | 2515 Handle<String> name() const { return name_; } |
2552 SaveFPRegsMode save_doubles() const { return save_doubles_; } | 2516 SaveFPRegsMode save_doubles() const { return save_doubles_; } |
2553 void set_save_doubles(SaveFPRegsMode save_doubles) { | 2517 void set_save_doubles(SaveFPRegsMode save_doubles) { |
2554 save_doubles_ = save_doubles; | 2518 save_doubles_ = save_doubles; |
2555 } | 2519 } |
2556 | 2520 |
2557 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 2521 Representation RequiredInputRepresentation(int index) OVERRIDE { |
2558 return Representation::Tagged(); | 2522 return Representation::Tagged(); |
2559 } | 2523 } |
2560 | 2524 |
2561 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) | 2525 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) |
2562 | 2526 |
2563 private: | 2527 private: |
2564 HCallRuntime(HValue* context, | 2528 HCallRuntime(HValue* context, |
2565 Handle<String> name, | 2529 Handle<String> name, |
2566 const Runtime::Function* c_function, | 2530 const Runtime::Function* c_function, |
2567 int argument_count) | 2531 int argument_count) |
2568 : HCall<1>(argument_count), c_function_(c_function), name_(name), | 2532 : HCall<1>(argument_count), c_function_(c_function), name_(name), |
2569 save_doubles_(kDontSaveFPRegs) { | 2533 save_doubles_(kDontSaveFPRegs) { |
2570 SetOperandAt(0, context); | 2534 SetOperandAt(0, context); |
2571 } | 2535 } |
2572 | 2536 |
2573 const Runtime::Function* c_function_; | 2537 const Runtime::Function* c_function_; |
2574 Handle<String> name_; | 2538 Handle<String> name_; |
2575 SaveFPRegsMode save_doubles_; | 2539 SaveFPRegsMode save_doubles_; |
2576 }; | 2540 }; |
2577 | 2541 |
2578 | 2542 |
2579 class HMapEnumLength FINAL : public HUnaryOperation { | 2543 class HMapEnumLength FINAL : public HUnaryOperation { |
2580 public: | 2544 public: |
2581 DECLARE_INSTRUCTION_FACTORY_P1(HMapEnumLength, HValue*); | 2545 DECLARE_INSTRUCTION_FACTORY_P1(HMapEnumLength, HValue*); |
2582 | 2546 |
2583 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 2547 Representation RequiredInputRepresentation(int index) OVERRIDE { |
2584 return Representation::Tagged(); | 2548 return Representation::Tagged(); |
2585 } | 2549 } |
2586 | 2550 |
2587 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength) | 2551 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength) |
2588 | 2552 |
2589 protected: | 2553 protected: |
2590 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 2554 bool DataEquals(HValue* other) OVERRIDE { return true; } |
2591 | 2555 |
2592 private: | 2556 private: |
2593 explicit HMapEnumLength(HValue* value) | 2557 explicit HMapEnumLength(HValue* value) |
2594 : HUnaryOperation(value, HType::Smi()) { | 2558 : HUnaryOperation(value, HType::Smi()) { |
2595 set_representation(Representation::Smi()); | 2559 set_representation(Representation::Smi()); |
2596 SetFlag(kUseGVN); | 2560 SetFlag(kUseGVN); |
2597 SetDependsOnFlag(kMaps); | 2561 SetDependsOnFlag(kMaps); |
2598 } | 2562 } |
2599 | 2563 |
2600 virtual bool IsDeletable() const OVERRIDE { return true; } | 2564 bool IsDeletable() const OVERRIDE { return true; } |
2601 }; | 2565 }; |
2602 | 2566 |
2603 | 2567 |
2604 class HUnaryMathOperation FINAL : public HTemplateInstruction<2> { | 2568 class HUnaryMathOperation FINAL : public HTemplateInstruction<2> { |
2605 public: | 2569 public: |
2606 static HInstruction* New(Zone* zone, | 2570 static HInstruction* New(Zone* zone, |
2607 HValue* context, | 2571 HValue* context, |
2608 HValue* value, | 2572 HValue* value, |
2609 BuiltinFunctionId op); | 2573 BuiltinFunctionId op); |
2610 | 2574 |
2611 HValue* context() const { return OperandAt(0); } | 2575 HValue* context() const { return OperandAt(0); } |
2612 HValue* value() const { return OperandAt(1); } | 2576 HValue* value() const { return OperandAt(1); } |
2613 | 2577 |
2614 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 2578 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
2615 | 2579 |
2616 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 2580 Representation RequiredInputRepresentation(int index) OVERRIDE { |
2617 if (index == 0) { | 2581 if (index == 0) { |
2618 return Representation::Tagged(); | 2582 return Representation::Tagged(); |
2619 } else { | 2583 } else { |
2620 switch (op_) { | 2584 switch (op_) { |
2621 case kMathFloor: | 2585 case kMathFloor: |
2622 case kMathRound: | 2586 case kMathRound: |
2623 case kMathFround: | 2587 case kMathFround: |
2624 case kMathSqrt: | 2588 case kMathSqrt: |
2625 case kMathPowHalf: | 2589 case kMathPowHalf: |
2626 case kMathLog: | 2590 case kMathLog: |
2627 case kMathExp: | 2591 case kMathExp: |
2628 return Representation::Double(); | 2592 return Representation::Double(); |
2629 case kMathAbs: | 2593 case kMathAbs: |
2630 return representation(); | 2594 return representation(); |
2631 case kMathClz32: | 2595 case kMathClz32: |
2632 return Representation::Integer32(); | 2596 return Representation::Integer32(); |
2633 default: | 2597 default: |
2634 UNREACHABLE(); | 2598 UNREACHABLE(); |
2635 return Representation::None(); | 2599 return Representation::None(); |
2636 } | 2600 } |
2637 } | 2601 } |
2638 } | 2602 } |
2639 | 2603 |
2640 virtual Range* InferRange(Zone* zone) OVERRIDE; | 2604 Range* InferRange(Zone* zone) OVERRIDE; |
2641 | 2605 |
2642 virtual HValue* Canonicalize() OVERRIDE; | 2606 HValue* Canonicalize() OVERRIDE; |
2643 virtual Representation RepresentationFromUses() OVERRIDE; | 2607 Representation RepresentationFromUses() OVERRIDE; |
2644 virtual Representation RepresentationFromInputs() OVERRIDE; | 2608 Representation RepresentationFromInputs() OVERRIDE; |
2645 | 2609 |
2646 BuiltinFunctionId op() const { return op_; } | 2610 BuiltinFunctionId op() const { return op_; } |
2647 const char* OpName() const; | 2611 const char* OpName() const; |
2648 | 2612 |
2649 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation) | 2613 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation) |
2650 | 2614 |
2651 protected: | 2615 protected: |
2652 virtual bool DataEquals(HValue* other) OVERRIDE { | 2616 bool DataEquals(HValue* other) OVERRIDE { |
2653 HUnaryMathOperation* b = HUnaryMathOperation::cast(other); | 2617 HUnaryMathOperation* b = HUnaryMathOperation::cast(other); |
2654 return op_ == b->op(); | 2618 return op_ == b->op(); |
2655 } | 2619 } |
2656 | 2620 |
2657 private: | 2621 private: |
2658 // Indicates if we support a double (and int32) output for Math.floor and | 2622 // Indicates if we support a double (and int32) output for Math.floor and |
2659 // Math.round. | 2623 // Math.round. |
2660 bool SupportsFlexibleFloorAndRound() const { | 2624 bool SupportsFlexibleFloorAndRound() const { |
2661 #ifdef V8_TARGET_ARCH_ARM64 | 2625 #ifdef V8_TARGET_ARCH_ARM64 |
2662 return true; | 2626 return true; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2694 case kMathPowHalf: | 2658 case kMathPowHalf: |
2695 set_representation(Representation::Double()); | 2659 set_representation(Representation::Double()); |
2696 break; | 2660 break; |
2697 default: | 2661 default: |
2698 UNREACHABLE(); | 2662 UNREACHABLE(); |
2699 } | 2663 } |
2700 SetFlag(kUseGVN); | 2664 SetFlag(kUseGVN); |
2701 SetFlag(kAllowUndefinedAsNaN); | 2665 SetFlag(kAllowUndefinedAsNaN); |
2702 } | 2666 } |
2703 | 2667 |
2704 virtual bool IsDeletable() const OVERRIDE { return true; } | 2668 bool IsDeletable() const OVERRIDE { return true; } |
2705 | 2669 |
2706 HValue* SimplifiedDividendForMathFloorOfDiv(HDiv* hdiv); | 2670 HValue* SimplifiedDividendForMathFloorOfDiv(HDiv* hdiv); |
2707 HValue* SimplifiedDivisorForMathFloorOfDiv(HDiv* hdiv); | 2671 HValue* SimplifiedDivisorForMathFloorOfDiv(HDiv* hdiv); |
2708 | 2672 |
2709 BuiltinFunctionId op_; | 2673 BuiltinFunctionId op_; |
2710 }; | 2674 }; |
2711 | 2675 |
2712 | 2676 |
2713 class HLoadRoot FINAL : public HTemplateInstruction<0> { | 2677 class HLoadRoot FINAL : public HTemplateInstruction<0> { |
2714 public: | 2678 public: |
2715 DECLARE_INSTRUCTION_FACTORY_P1(HLoadRoot, Heap::RootListIndex); | 2679 DECLARE_INSTRUCTION_FACTORY_P1(HLoadRoot, Heap::RootListIndex); |
2716 DECLARE_INSTRUCTION_FACTORY_P2(HLoadRoot, Heap::RootListIndex, HType); | 2680 DECLARE_INSTRUCTION_FACTORY_P2(HLoadRoot, Heap::RootListIndex, HType); |
2717 | 2681 |
2718 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 2682 Representation RequiredInputRepresentation(int index) OVERRIDE { |
2719 return Representation::None(); | 2683 return Representation::None(); |
2720 } | 2684 } |
2721 | 2685 |
2722 Heap::RootListIndex index() const { return index_; } | 2686 Heap::RootListIndex index() const { return index_; } |
2723 | 2687 |
2724 DECLARE_CONCRETE_INSTRUCTION(LoadRoot) | 2688 DECLARE_CONCRETE_INSTRUCTION(LoadRoot) |
2725 | 2689 |
2726 protected: | 2690 protected: |
2727 virtual bool DataEquals(HValue* other) OVERRIDE { | 2691 bool DataEquals(HValue* other) OVERRIDE { |
2728 HLoadRoot* b = HLoadRoot::cast(other); | 2692 HLoadRoot* b = HLoadRoot::cast(other); |
2729 return index_ == b->index_; | 2693 return index_ == b->index_; |
2730 } | 2694 } |
2731 | 2695 |
2732 private: | 2696 private: |
2733 explicit HLoadRoot(Heap::RootListIndex index, HType type = HType::Tagged()) | 2697 explicit HLoadRoot(Heap::RootListIndex index, HType type = HType::Tagged()) |
2734 : HTemplateInstruction<0>(type), index_(index) { | 2698 : HTemplateInstruction<0>(type), index_(index) { |
2735 SetFlag(kUseGVN); | 2699 SetFlag(kUseGVN); |
2736 // TODO(bmeurer): We'll need kDependsOnRoots once we add the | 2700 // TODO(bmeurer): We'll need kDependsOnRoots once we add the |
2737 // corresponding HStoreRoot instruction. | 2701 // corresponding HStoreRoot instruction. |
2738 SetDependsOnFlag(kCalls); | 2702 SetDependsOnFlag(kCalls); |
2739 set_representation(Representation::Tagged()); | 2703 set_representation(Representation::Tagged()); |
2740 } | 2704 } |
2741 | 2705 |
2742 virtual bool IsDeletable() const OVERRIDE { return true; } | 2706 bool IsDeletable() const OVERRIDE { return true; } |
2743 | 2707 |
2744 const Heap::RootListIndex index_; | 2708 const Heap::RootListIndex index_; |
2745 }; | 2709 }; |
2746 | 2710 |
2747 | 2711 |
2748 class HCheckMaps FINAL : public HTemplateInstruction<2> { | 2712 class HCheckMaps FINAL : public HTemplateInstruction<2> { |
2749 public: | 2713 public: |
2750 static HCheckMaps* New(Zone* zone, HValue* context, HValue* value, | 2714 static HCheckMaps* New(Zone* zone, HValue* context, HValue* value, |
2751 Handle<Map> map, HValue* typecheck = NULL) { | 2715 Handle<Map> map, HValue* typecheck = NULL) { |
2752 return new(zone) HCheckMaps(value, new(zone) UniqueSet<Map>( | 2716 return new(zone) HCheckMaps(value, new(zone) UniqueSet<Map>( |
(...skipping 14 matching lines...) Expand all Loading... |
2767 } | 2731 } |
2768 void MarkAsStabilityCheck() { | 2732 void MarkAsStabilityCheck() { |
2769 bit_field_ = MapsAreStableField::encode(true) | | 2733 bit_field_ = MapsAreStableField::encode(true) | |
2770 HasMigrationTargetField::encode(false) | | 2734 HasMigrationTargetField::encode(false) | |
2771 IsStabilityCheckField::encode(true); | 2735 IsStabilityCheckField::encode(true); |
2772 ClearChangesFlag(kNewSpacePromotion); | 2736 ClearChangesFlag(kNewSpacePromotion); |
2773 ClearDependsOnFlag(kElementsKind); | 2737 ClearDependsOnFlag(kElementsKind); |
2774 ClearDependsOnFlag(kMaps); | 2738 ClearDependsOnFlag(kMaps); |
2775 } | 2739 } |
2776 | 2740 |
2777 virtual bool HasEscapingOperandAt(int index) OVERRIDE { return false; } | 2741 bool HasEscapingOperandAt(int index) OVERRIDE { return false; } |
2778 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 2742 Representation RequiredInputRepresentation(int index) OVERRIDE { |
2779 return Representation::Tagged(); | 2743 return Representation::Tagged(); |
2780 } | 2744 } |
2781 | 2745 |
2782 virtual HType CalculateInferredType() OVERRIDE { | 2746 HType CalculateInferredType() OVERRIDE { |
2783 if (value()->type().IsHeapObject()) return value()->type(); | 2747 if (value()->type().IsHeapObject()) return value()->type(); |
2784 return HType::HeapObject(); | 2748 return HType::HeapObject(); |
2785 } | 2749 } |
2786 | 2750 |
2787 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 2751 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
2788 | 2752 |
2789 HValue* value() const { return OperandAt(0); } | 2753 HValue* value() const { return OperandAt(0); } |
2790 HValue* typecheck() const { return OperandAt(1); } | 2754 HValue* typecheck() const { return OperandAt(1); } |
2791 | 2755 |
2792 const UniqueSet<Map>* maps() const { return maps_; } | 2756 const UniqueSet<Map>* maps() const { return maps_; } |
2793 void set_maps(const UniqueSet<Map>* maps) { maps_ = maps; } | 2757 void set_maps(const UniqueSet<Map>* maps) { maps_ = maps; } |
2794 | 2758 |
2795 bool maps_are_stable() const { | 2759 bool maps_are_stable() const { |
2796 return MapsAreStableField::decode(bit_field_); | 2760 return MapsAreStableField::decode(bit_field_); |
2797 } | 2761 } |
2798 | 2762 |
2799 bool HasMigrationTarget() const { | 2763 bool HasMigrationTarget() const { |
2800 return HasMigrationTargetField::decode(bit_field_); | 2764 return HasMigrationTargetField::decode(bit_field_); |
2801 } | 2765 } |
2802 | 2766 |
2803 virtual HValue* Canonicalize() OVERRIDE; | 2767 HValue* Canonicalize() OVERRIDE; |
2804 | 2768 |
2805 static HCheckMaps* CreateAndInsertAfter(Zone* zone, | 2769 static HCheckMaps* CreateAndInsertAfter(Zone* zone, |
2806 HValue* value, | 2770 HValue* value, |
2807 Unique<Map> map, | 2771 Unique<Map> map, |
2808 bool map_is_stable, | 2772 bool map_is_stable, |
2809 HInstruction* instr) { | 2773 HInstruction* instr) { |
2810 return instr->Append(new(zone) HCheckMaps( | 2774 return instr->Append(new(zone) HCheckMaps( |
2811 value, new(zone) UniqueSet<Map>(map, zone), map_is_stable)); | 2775 value, new(zone) UniqueSet<Map>(map, zone), map_is_stable)); |
2812 } | 2776 } |
2813 | 2777 |
2814 static HCheckMaps* CreateAndInsertBefore(Zone* zone, | 2778 static HCheckMaps* CreateAndInsertBefore(Zone* zone, |
2815 HValue* value, | 2779 HValue* value, |
2816 const UniqueSet<Map>* maps, | 2780 const UniqueSet<Map>* maps, |
2817 bool maps_are_stable, | 2781 bool maps_are_stable, |
2818 HInstruction* instr) { | 2782 HInstruction* instr) { |
2819 return instr->Prepend(new(zone) HCheckMaps(value, maps, maps_are_stable)); | 2783 return instr->Prepend(new(zone) HCheckMaps(value, maps, maps_are_stable)); |
2820 } | 2784 } |
2821 | 2785 |
2822 DECLARE_CONCRETE_INSTRUCTION(CheckMaps) | 2786 DECLARE_CONCRETE_INSTRUCTION(CheckMaps) |
2823 | 2787 |
2824 protected: | 2788 protected: |
2825 virtual bool DataEquals(HValue* other) OVERRIDE { | 2789 bool DataEquals(HValue* other) OVERRIDE { |
2826 return this->maps()->Equals(HCheckMaps::cast(other)->maps()); | 2790 return this->maps()->Equals(HCheckMaps::cast(other)->maps()); |
2827 } | 2791 } |
2828 | 2792 |
2829 virtual int RedefinedOperandIndex() OVERRIDE { return 0; } | 2793 int RedefinedOperandIndex() OVERRIDE { return 0; } |
2830 | 2794 |
2831 private: | 2795 private: |
2832 HCheckMaps(HValue* value, const UniqueSet<Map>* maps, bool maps_are_stable) | 2796 HCheckMaps(HValue* value, const UniqueSet<Map>* maps, bool maps_are_stable) |
2833 : HTemplateInstruction<2>(HType::HeapObject()), | 2797 : HTemplateInstruction<2>(HType::HeapObject()), |
2834 maps_(maps), | 2798 maps_(maps), |
2835 bit_field_(HasMigrationTargetField::encode(false) | | 2799 bit_field_(HasMigrationTargetField::encode(false) | |
2836 IsStabilityCheckField::encode(false) | | 2800 IsStabilityCheckField::encode(false) | |
2837 MapsAreStableField::encode(maps_are_stable)) { | 2801 MapsAreStableField::encode(maps_are_stable)) { |
2838 DCHECK_NE(0, maps->size()); | 2802 DCHECK_NE(0, maps->size()); |
2839 SetOperandAt(0, value); | 2803 SetOperandAt(0, value); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2892 Unique<JSFunction> target = Unique<JSFunction>::CreateUninitialized(func); | 2856 Unique<JSFunction> target = Unique<JSFunction>::CreateUninitialized(func); |
2893 HCheckValue* check = new(zone) HCheckValue(value, target, in_new_space); | 2857 HCheckValue* check = new(zone) HCheckValue(value, target, in_new_space); |
2894 return check; | 2858 return check; |
2895 } | 2859 } |
2896 static HCheckValue* New(Zone* zone, HValue* context, | 2860 static HCheckValue* New(Zone* zone, HValue* context, |
2897 HValue* value, Unique<HeapObject> target, | 2861 HValue* value, Unique<HeapObject> target, |
2898 bool object_in_new_space) { | 2862 bool object_in_new_space) { |
2899 return new(zone) HCheckValue(value, target, object_in_new_space); | 2863 return new(zone) HCheckValue(value, target, object_in_new_space); |
2900 } | 2864 } |
2901 | 2865 |
2902 virtual void FinalizeUniqueness() OVERRIDE { | 2866 void FinalizeUniqueness() OVERRIDE { |
2903 object_ = Unique<HeapObject>(object_.handle()); | 2867 object_ = Unique<HeapObject>(object_.handle()); |
2904 } | 2868 } |
2905 | 2869 |
2906 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 2870 Representation RequiredInputRepresentation(int index) OVERRIDE { |
2907 return Representation::Tagged(); | 2871 return Representation::Tagged(); |
2908 } | 2872 } |
2909 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 2873 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
2910 | 2874 |
2911 virtual HValue* Canonicalize() OVERRIDE; | 2875 HValue* Canonicalize() OVERRIDE; |
2912 | 2876 |
2913 #ifdef DEBUG | 2877 #ifdef DEBUG |
2914 virtual void Verify() OVERRIDE; | 2878 void Verify() OVERRIDE; |
2915 #endif | 2879 #endif |
2916 | 2880 |
2917 Unique<HeapObject> object() const { return object_; } | 2881 Unique<HeapObject> object() const { return object_; } |
2918 bool object_in_new_space() const { return object_in_new_space_; } | 2882 bool object_in_new_space() const { return object_in_new_space_; } |
2919 | 2883 |
2920 DECLARE_CONCRETE_INSTRUCTION(CheckValue) | 2884 DECLARE_CONCRETE_INSTRUCTION(CheckValue) |
2921 | 2885 |
2922 protected: | 2886 protected: |
2923 virtual bool DataEquals(HValue* other) OVERRIDE { | 2887 bool DataEquals(HValue* other) OVERRIDE { |
2924 HCheckValue* b = HCheckValue::cast(other); | 2888 HCheckValue* b = HCheckValue::cast(other); |
2925 return object_ == b->object_; | 2889 return object_ == b->object_; |
2926 } | 2890 } |
2927 | 2891 |
2928 private: | 2892 private: |
2929 HCheckValue(HValue* value, Unique<HeapObject> object, | 2893 HCheckValue(HValue* value, Unique<HeapObject> object, |
2930 bool object_in_new_space) | 2894 bool object_in_new_space) |
2931 : HUnaryOperation(value, value->type()), | 2895 : HUnaryOperation(value, value->type()), |
2932 object_(object), | 2896 object_(object), |
2933 object_in_new_space_(object_in_new_space) { | 2897 object_in_new_space_(object_in_new_space) { |
(...skipping 11 matching lines...) Expand all Loading... |
2945 enum Check { | 2909 enum Check { |
2946 IS_SPEC_OBJECT, | 2910 IS_SPEC_OBJECT, |
2947 IS_JS_ARRAY, | 2911 IS_JS_ARRAY, |
2948 IS_STRING, | 2912 IS_STRING, |
2949 IS_INTERNALIZED_STRING, | 2913 IS_INTERNALIZED_STRING, |
2950 LAST_INTERVAL_CHECK = IS_JS_ARRAY | 2914 LAST_INTERVAL_CHECK = IS_JS_ARRAY |
2951 }; | 2915 }; |
2952 | 2916 |
2953 DECLARE_INSTRUCTION_FACTORY_P2(HCheckInstanceType, HValue*, Check); | 2917 DECLARE_INSTRUCTION_FACTORY_P2(HCheckInstanceType, HValue*, Check); |
2954 | 2918 |
2955 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 2919 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
2956 | 2920 |
2957 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 2921 Representation RequiredInputRepresentation(int index) OVERRIDE { |
2958 return Representation::Tagged(); | 2922 return Representation::Tagged(); |
2959 } | 2923 } |
2960 | 2924 |
2961 virtual HType CalculateInferredType() OVERRIDE { | 2925 HType CalculateInferredType() OVERRIDE { |
2962 switch (check_) { | 2926 switch (check_) { |
2963 case IS_SPEC_OBJECT: return HType::JSObject(); | 2927 case IS_SPEC_OBJECT: return HType::JSObject(); |
2964 case IS_JS_ARRAY: return HType::JSArray(); | 2928 case IS_JS_ARRAY: return HType::JSArray(); |
2965 case IS_STRING: return HType::String(); | 2929 case IS_STRING: return HType::String(); |
2966 case IS_INTERNALIZED_STRING: return HType::String(); | 2930 case IS_INTERNALIZED_STRING: return HType::String(); |
2967 } | 2931 } |
2968 UNREACHABLE(); | 2932 UNREACHABLE(); |
2969 return HType::Tagged(); | 2933 return HType::Tagged(); |
2970 } | 2934 } |
2971 | 2935 |
2972 virtual HValue* Canonicalize() OVERRIDE; | 2936 HValue* Canonicalize() OVERRIDE; |
2973 | 2937 |
2974 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; } | 2938 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; } |
2975 void GetCheckInterval(InstanceType* first, InstanceType* last); | 2939 void GetCheckInterval(InstanceType* first, InstanceType* last); |
2976 void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag); | 2940 void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag); |
2977 | 2941 |
2978 Check check() const { return check_; } | 2942 Check check() const { return check_; } |
2979 | 2943 |
2980 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType) | 2944 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType) |
2981 | 2945 |
2982 protected: | 2946 protected: |
2983 // TODO(ager): It could be nice to allow the ommision of instance | 2947 // TODO(ager): It could be nice to allow the ommision of instance |
2984 // type checks if we have already performed an instance type check | 2948 // type checks if we have already performed an instance type check |
2985 // with a larger range. | 2949 // with a larger range. |
2986 virtual bool DataEquals(HValue* other) OVERRIDE { | 2950 bool DataEquals(HValue* other) OVERRIDE { |
2987 HCheckInstanceType* b = HCheckInstanceType::cast(other); | 2951 HCheckInstanceType* b = HCheckInstanceType::cast(other); |
2988 return check_ == b->check_; | 2952 return check_ == b->check_; |
2989 } | 2953 } |
2990 | 2954 |
2991 virtual int RedefinedOperandIndex() OVERRIDE { return 0; } | 2955 int RedefinedOperandIndex() OVERRIDE { return 0; } |
2992 | 2956 |
2993 private: | 2957 private: |
2994 const char* GetCheckName() const; | 2958 const char* GetCheckName() const; |
2995 | 2959 |
2996 HCheckInstanceType(HValue* value, Check check) | 2960 HCheckInstanceType(HValue* value, Check check) |
2997 : HUnaryOperation(value, HType::HeapObject()), check_(check) { | 2961 : HUnaryOperation(value, HType::HeapObject()), check_(check) { |
2998 set_representation(Representation::Tagged()); | 2962 set_representation(Representation::Tagged()); |
2999 SetFlag(kUseGVN); | 2963 SetFlag(kUseGVN); |
3000 } | 2964 } |
3001 | 2965 |
3002 const Check check_; | 2966 const Check check_; |
3003 }; | 2967 }; |
3004 | 2968 |
3005 | 2969 |
3006 class HCheckSmi FINAL : public HUnaryOperation { | 2970 class HCheckSmi FINAL : public HUnaryOperation { |
3007 public: | 2971 public: |
3008 DECLARE_INSTRUCTION_FACTORY_P1(HCheckSmi, HValue*); | 2972 DECLARE_INSTRUCTION_FACTORY_P1(HCheckSmi, HValue*); |
3009 | 2973 |
3010 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 2974 Representation RequiredInputRepresentation(int index) OVERRIDE { |
3011 return Representation::Tagged(); | 2975 return Representation::Tagged(); |
3012 } | 2976 } |
3013 | 2977 |
3014 virtual HValue* Canonicalize() OVERRIDE { | 2978 HValue* Canonicalize() OVERRIDE { |
3015 HType value_type = value()->type(); | 2979 HType value_type = value()->type(); |
3016 if (value_type.IsSmi()) { | 2980 if (value_type.IsSmi()) { |
3017 return NULL; | 2981 return NULL; |
3018 } | 2982 } |
3019 return this; | 2983 return this; |
3020 } | 2984 } |
3021 | 2985 |
3022 DECLARE_CONCRETE_INSTRUCTION(CheckSmi) | 2986 DECLARE_CONCRETE_INSTRUCTION(CheckSmi) |
3023 | 2987 |
3024 protected: | 2988 protected: |
3025 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 2989 bool DataEquals(HValue* other) OVERRIDE { return true; } |
3026 | 2990 |
3027 private: | 2991 private: |
3028 explicit HCheckSmi(HValue* value) : HUnaryOperation(value, HType::Smi()) { | 2992 explicit HCheckSmi(HValue* value) : HUnaryOperation(value, HType::Smi()) { |
3029 set_representation(Representation::Smi()); | 2993 set_representation(Representation::Smi()); |
3030 SetFlag(kUseGVN); | 2994 SetFlag(kUseGVN); |
3031 } | 2995 } |
3032 }; | 2996 }; |
3033 | 2997 |
3034 | 2998 |
3035 class HCheckHeapObject FINAL : public HUnaryOperation { | 2999 class HCheckHeapObject FINAL : public HUnaryOperation { |
3036 public: | 3000 public: |
3037 DECLARE_INSTRUCTION_FACTORY_P1(HCheckHeapObject, HValue*); | 3001 DECLARE_INSTRUCTION_FACTORY_P1(HCheckHeapObject, HValue*); |
3038 | 3002 |
3039 virtual bool HasEscapingOperandAt(int index) OVERRIDE { return false; } | 3003 bool HasEscapingOperandAt(int index) OVERRIDE { return false; } |
3040 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 3004 Representation RequiredInputRepresentation(int index) OVERRIDE { |
3041 return Representation::Tagged(); | 3005 return Representation::Tagged(); |
3042 } | 3006 } |
3043 | 3007 |
3044 virtual HType CalculateInferredType() OVERRIDE { | 3008 HType CalculateInferredType() OVERRIDE { |
3045 if (value()->type().IsHeapObject()) return value()->type(); | 3009 if (value()->type().IsHeapObject()) return value()->type(); |
3046 return HType::HeapObject(); | 3010 return HType::HeapObject(); |
3047 } | 3011 } |
3048 | 3012 |
3049 #ifdef DEBUG | 3013 #ifdef DEBUG |
3050 virtual void Verify() OVERRIDE; | 3014 void Verify() OVERRIDE; |
3051 #endif | 3015 #endif |
3052 | 3016 |
3053 virtual HValue* Canonicalize() OVERRIDE { | 3017 HValue* Canonicalize() OVERRIDE { |
3054 return value()->type().IsHeapObject() ? NULL : this; | 3018 return value()->type().IsHeapObject() ? NULL : this; |
3055 } | 3019 } |
3056 | 3020 |
3057 DECLARE_CONCRETE_INSTRUCTION(CheckHeapObject) | 3021 DECLARE_CONCRETE_INSTRUCTION(CheckHeapObject) |
3058 | 3022 |
3059 protected: | 3023 protected: |
3060 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 3024 bool DataEquals(HValue* other) OVERRIDE { return true; } |
3061 | 3025 |
3062 private: | 3026 private: |
3063 explicit HCheckHeapObject(HValue* value) : HUnaryOperation(value) { | 3027 explicit HCheckHeapObject(HValue* value) : HUnaryOperation(value) { |
3064 set_representation(Representation::Tagged()); | 3028 set_representation(Representation::Tagged()); |
3065 SetFlag(kUseGVN); | 3029 SetFlag(kUseGVN); |
3066 } | 3030 } |
3067 }; | 3031 }; |
3068 | 3032 |
3069 | 3033 |
3070 class InductionVariableData; | 3034 class InductionVariableData; |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3296 induction_variable_data_(NULL) { | 3260 induction_variable_data_(NULL) { |
3297 for (int i = 0; i < Representation::kNumRepresentations; i++) { | 3261 for (int i = 0; i < Representation::kNumRepresentations; i++) { |
3298 non_phi_uses_[i] = 0; | 3262 non_phi_uses_[i] = 0; |
3299 indirect_uses_[i] = 0; | 3263 indirect_uses_[i] = 0; |
3300 } | 3264 } |
3301 DCHECK(merged_index >= 0 || merged_index == kInvalidMergedIndex); | 3265 DCHECK(merged_index >= 0 || merged_index == kInvalidMergedIndex); |
3302 SetFlag(kFlexibleRepresentation); | 3266 SetFlag(kFlexibleRepresentation); |
3303 SetFlag(kAllowUndefinedAsNaN); | 3267 SetFlag(kAllowUndefinedAsNaN); |
3304 } | 3268 } |
3305 | 3269 |
3306 virtual Representation RepresentationFromInputs() OVERRIDE; | 3270 Representation RepresentationFromInputs() OVERRIDE; |
3307 | 3271 |
3308 virtual Range* InferRange(Zone* zone) OVERRIDE; | 3272 Range* InferRange(Zone* zone) OVERRIDE; |
3309 virtual void InferRepresentation( | 3273 virtual void InferRepresentation( |
3310 HInferRepresentationPhase* h_infer) OVERRIDE; | 3274 HInferRepresentationPhase* h_infer) OVERRIDE; |
3311 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 3275 Representation RequiredInputRepresentation(int index) OVERRIDE { |
3312 return representation(); | 3276 return representation(); |
3313 } | 3277 } |
3314 virtual Representation KnownOptimalRepresentation() OVERRIDE { | 3278 Representation KnownOptimalRepresentation() OVERRIDE { |
3315 return representation(); | 3279 return representation(); |
3316 } | 3280 } |
3317 virtual HType CalculateInferredType() OVERRIDE; | 3281 HType CalculateInferredType() OVERRIDE; |
3318 virtual int OperandCount() const OVERRIDE { return inputs_.length(); } | 3282 int OperandCount() const OVERRIDE { return inputs_.length(); } |
3319 virtual HValue* OperandAt(int index) const OVERRIDE { | 3283 HValue* OperandAt(int index) const OVERRIDE { return inputs_[index]; } |
3320 return inputs_[index]; | |
3321 } | |
3322 HValue* GetRedundantReplacement(); | 3284 HValue* GetRedundantReplacement(); |
3323 void AddInput(HValue* value); | 3285 void AddInput(HValue* value); |
3324 bool HasRealUses(); | 3286 bool HasRealUses(); |
3325 | 3287 |
3326 bool IsReceiver() const { return merged_index_ == 0; } | 3288 bool IsReceiver() const { return merged_index_ == 0; } |
3327 bool HasMergedIndex() const { return merged_index_ != kInvalidMergedIndex; } | 3289 bool HasMergedIndex() const { return merged_index_ != kInvalidMergedIndex; } |
3328 | 3290 |
3329 virtual HSourcePosition position() const OVERRIDE; | 3291 HSourcePosition position() const OVERRIDE; |
3330 | 3292 |
3331 int merged_index() const { return merged_index_; } | 3293 int merged_index() const { return merged_index_; } |
3332 | 3294 |
3333 InductionVariableData* induction_variable_data() { | 3295 InductionVariableData* induction_variable_data() { |
3334 return induction_variable_data_; | 3296 return induction_variable_data_; |
3335 } | 3297 } |
3336 bool IsInductionVariable() { | 3298 bool IsInductionVariable() { |
3337 return induction_variable_data_ != NULL; | 3299 return induction_variable_data_ != NULL; |
3338 } | 3300 } |
3339 bool IsLimitedInductionVariable() { | 3301 bool IsLimitedInductionVariable() { |
3340 return IsInductionVariable() && | 3302 return IsInductionVariable() && |
3341 induction_variable_data_->limit() != NULL; | 3303 induction_variable_data_->limit() != NULL; |
3342 } | 3304 } |
3343 void DetectInductionVariable() { | 3305 void DetectInductionVariable() { |
3344 DCHECK(induction_variable_data_ == NULL); | 3306 DCHECK(induction_variable_data_ == NULL); |
3345 induction_variable_data_ = InductionVariableData::ExaminePhi(this); | 3307 induction_variable_data_ = InductionVariableData::ExaminePhi(this); |
3346 } | 3308 } |
3347 | 3309 |
3348 virtual std::ostream& PrintTo(std::ostream& os) const OVERRIDE; // NOLINT | 3310 std::ostream& PrintTo(std::ostream& os) const OVERRIDE; // NOLINT |
3349 | 3311 |
3350 #ifdef DEBUG | 3312 #ifdef DEBUG |
3351 virtual void Verify() OVERRIDE; | 3313 void Verify() OVERRIDE; |
3352 #endif | 3314 #endif |
3353 | 3315 |
3354 void InitRealUses(int id); | 3316 void InitRealUses(int id); |
3355 void AddNonPhiUsesFrom(HPhi* other); | 3317 void AddNonPhiUsesFrom(HPhi* other); |
3356 void AddIndirectUsesTo(int* use_count); | 3318 void AddIndirectUsesTo(int* use_count); |
3357 | 3319 |
3358 int tagged_non_phi_uses() const { | 3320 int tagged_non_phi_uses() const { |
3359 return non_phi_uses_[Representation::kTagged]; | 3321 return non_phi_uses_[Representation::kTagged]; |
3360 } | 3322 } |
3361 int smi_non_phi_uses() const { | 3323 int smi_non_phi_uses() const { |
(...skipping 16 matching lines...) Expand all Loading... |
3378 } | 3340 } |
3379 int double_indirect_uses() const { | 3341 int double_indirect_uses() const { |
3380 return indirect_uses_[Representation::kDouble]; | 3342 return indirect_uses_[Representation::kDouble]; |
3381 } | 3343 } |
3382 int phi_id() { return phi_id_; } | 3344 int phi_id() { return phi_id_; } |
3383 | 3345 |
3384 static HPhi* cast(HValue* value) { | 3346 static HPhi* cast(HValue* value) { |
3385 DCHECK(value->IsPhi()); | 3347 DCHECK(value->IsPhi()); |
3386 return reinterpret_cast<HPhi*>(value); | 3348 return reinterpret_cast<HPhi*>(value); |
3387 } | 3349 } |
3388 virtual Opcode opcode() const OVERRIDE { return HValue::kPhi; } | 3350 Opcode opcode() const OVERRIDE { return HValue::kPhi; } |
3389 | 3351 |
3390 void SimplifyConstantInputs(); | 3352 void SimplifyConstantInputs(); |
3391 | 3353 |
3392 // Marker value representing an invalid merge index. | 3354 // Marker value representing an invalid merge index. |
3393 static const int kInvalidMergedIndex = -1; | 3355 static const int kInvalidMergedIndex = -1; |
3394 | 3356 |
3395 protected: | 3357 protected: |
3396 virtual void DeleteFromGraph() OVERRIDE; | 3358 void DeleteFromGraph() OVERRIDE; |
3397 virtual void InternalSetOperandAt(int index, HValue* value) OVERRIDE { | 3359 void InternalSetOperandAt(int index, HValue* value) OVERRIDE { |
3398 inputs_[index] = value; | 3360 inputs_[index] = value; |
3399 } | 3361 } |
3400 | 3362 |
3401 private: | 3363 private: |
3402 ZoneList<HValue*> inputs_; | 3364 ZoneList<HValue*> inputs_; |
3403 int merged_index_; | 3365 int merged_index_; |
3404 | 3366 |
3405 int non_phi_uses_[Representation::kNumRepresentations]; | 3367 int non_phi_uses_[Representation::kNumRepresentations]; |
3406 int indirect_uses_[Representation::kNumRepresentations]; | 3368 int indirect_uses_[Representation::kNumRepresentations]; |
3407 int phi_id_; | 3369 int phi_id_; |
3408 InductionVariableData* induction_variable_data_; | 3370 InductionVariableData* induction_variable_data_; |
3409 | 3371 |
3410 // TODO(titzer): we can't eliminate the receiver for generating backtraces | 3372 // TODO(titzer): we can't eliminate the receiver for generating backtraces |
3411 virtual bool IsDeletable() const OVERRIDE { return !IsReceiver(); } | 3373 bool IsDeletable() const OVERRIDE { return !IsReceiver(); } |
3412 }; | 3374 }; |
3413 | 3375 |
3414 | 3376 |
3415 // Common base class for HArgumentsObject and HCapturedObject. | 3377 // Common base class for HArgumentsObject and HCapturedObject. |
3416 class HDematerializedObject : public HInstruction { | 3378 class HDematerializedObject : public HInstruction { |
3417 public: | 3379 public: |
3418 HDematerializedObject(int count, Zone* zone) : values_(count, zone) {} | 3380 HDematerializedObject(int count, Zone* zone) : values_(count, zone) {} |
3419 | 3381 |
3420 virtual int OperandCount() const FINAL OVERRIDE { | 3382 int OperandCount() const FINAL { return values_.length(); } |
3421 return values_.length(); | 3383 HValue* OperandAt(int index) const FINAL { return values_[index]; } |
3422 } | |
3423 virtual HValue* OperandAt(int index) const FINAL OVERRIDE { | |
3424 return values_[index]; | |
3425 } | |
3426 | 3384 |
3427 virtual bool HasEscapingOperandAt(int index) FINAL OVERRIDE { | 3385 bool HasEscapingOperandAt(int index) FINAL { return false; } |
3428 return false; | 3386 Representation RequiredInputRepresentation(int index) FINAL { |
3429 } | |
3430 virtual Representation RequiredInputRepresentation( | |
3431 int index) FINAL OVERRIDE { | |
3432 return Representation::None(); | 3387 return Representation::None(); |
3433 } | 3388 } |
3434 | 3389 |
3435 protected: | 3390 protected: |
3436 virtual void InternalSetOperandAt(int index, | 3391 void InternalSetOperandAt(int index, HValue* value) FINAL { |
3437 HValue* value) FINAL OVERRIDE { | |
3438 values_[index] = value; | 3392 values_[index] = value; |
3439 } | 3393 } |
3440 | 3394 |
3441 // List of values tracked by this marker. | 3395 // List of values tracked by this marker. |
3442 ZoneList<HValue*> values_; | 3396 ZoneList<HValue*> values_; |
3443 }; | 3397 }; |
3444 | 3398 |
3445 | 3399 |
3446 class HArgumentsObject FINAL : public HDematerializedObject { | 3400 class HArgumentsObject FINAL : public HDematerializedObject { |
3447 public: | 3401 public: |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3490 | 3444 |
3491 void ReuseSideEffectsFromStore(HInstruction* store) { | 3445 void ReuseSideEffectsFromStore(HInstruction* store) { |
3492 DCHECK(store->HasObservableSideEffects()); | 3446 DCHECK(store->HasObservableSideEffects()); |
3493 DCHECK(store->IsStoreNamedField()); | 3447 DCHECK(store->IsStoreNamedField()); |
3494 changes_flags_.Add(store->ChangesFlags()); | 3448 changes_flags_.Add(store->ChangesFlags()); |
3495 } | 3449 } |
3496 | 3450 |
3497 // Replay effects of this instruction on the given environment. | 3451 // Replay effects of this instruction on the given environment. |
3498 void ReplayEnvironment(HEnvironment* env); | 3452 void ReplayEnvironment(HEnvironment* env); |
3499 | 3453 |
3500 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 3454 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
3501 | 3455 |
3502 DECLARE_CONCRETE_INSTRUCTION(CapturedObject) | 3456 DECLARE_CONCRETE_INSTRUCTION(CapturedObject) |
3503 | 3457 |
3504 private: | 3458 private: |
3505 int capture_id_; | 3459 int capture_id_; |
3506 | 3460 |
3507 // Note that we cannot DCE captured objects as they are used to replay | 3461 // Note that we cannot DCE captured objects as they are used to replay |
3508 // the environment. This method is here as an explicit reminder. | 3462 // the environment. This method is here as an explicit reminder. |
3509 // TODO(mstarzinger): Turn HSimulates into full snapshots maybe? | 3463 // TODO(mstarzinger): Turn HSimulates into full snapshots maybe? |
3510 virtual bool IsDeletable() const FINAL OVERRIDE { return false; } | 3464 bool IsDeletable() const FINAL { return false; } |
3511 }; | 3465 }; |
3512 | 3466 |
3513 | 3467 |
3514 class HConstant FINAL : public HTemplateInstruction<0> { | 3468 class HConstant FINAL : public HTemplateInstruction<0> { |
3515 public: | 3469 public: |
3516 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t); | 3470 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t); |
3517 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation); | 3471 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation); |
3518 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double); | 3472 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double); |
3519 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>); | 3473 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>); |
3520 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference); | 3474 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference); |
3521 | 3475 |
3522 static HConstant* CreateAndInsertAfter(Zone* zone, | 3476 static HConstant* CreateAndInsertAfter(Zone* zone, |
3523 HValue* context, | 3477 HValue* context, |
3524 int32_t value, | 3478 int32_t value, |
3525 Representation representation, | 3479 Representation representation, |
3526 HInstruction* instruction) { | 3480 HInstruction* instruction) { |
3527 return instruction->Append(HConstant::New( | 3481 return instruction->Append(HConstant::New( |
3528 zone, context, value, representation)); | 3482 zone, context, value, representation)); |
3529 } | 3483 } |
3530 | 3484 |
3531 virtual Handle<Map> GetMonomorphicJSObjectMap() OVERRIDE { | 3485 Handle<Map> GetMonomorphicJSObjectMap() OVERRIDE { |
3532 Handle<Object> object = object_.handle(); | 3486 Handle<Object> object = object_.handle(); |
3533 if (!object.is_null() && object->IsHeapObject()) { | 3487 if (!object.is_null() && object->IsHeapObject()) { |
3534 return v8::internal::handle(HeapObject::cast(*object)->map()); | 3488 return v8::internal::handle(HeapObject::cast(*object)->map()); |
3535 } | 3489 } |
3536 return Handle<Map>(); | 3490 return Handle<Map>(); |
3537 } | 3491 } |
3538 | 3492 |
3539 static HConstant* CreateAndInsertBefore(Zone* zone, | 3493 static HConstant* CreateAndInsertBefore(Zone* zone, |
3540 HValue* context, | 3494 HValue* context, |
3541 int32_t value, | 3495 int32_t value, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3588 return IsNotInNewSpaceField::decode(bit_field_); | 3542 return IsNotInNewSpaceField::decode(bit_field_); |
3589 } | 3543 } |
3590 | 3544 |
3591 bool ImmortalImmovable() const; | 3545 bool ImmortalImmovable() const; |
3592 | 3546 |
3593 bool IsCell() const { | 3547 bool IsCell() const { |
3594 InstanceType instance_type = GetInstanceType(); | 3548 InstanceType instance_type = GetInstanceType(); |
3595 return instance_type == CELL_TYPE || instance_type == PROPERTY_CELL_TYPE; | 3549 return instance_type == CELL_TYPE || instance_type == PROPERTY_CELL_TYPE; |
3596 } | 3550 } |
3597 | 3551 |
3598 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 3552 Representation RequiredInputRepresentation(int index) OVERRIDE { |
3599 return Representation::None(); | 3553 return Representation::None(); |
3600 } | 3554 } |
3601 | 3555 |
3602 virtual Representation KnownOptimalRepresentation() OVERRIDE { | 3556 Representation KnownOptimalRepresentation() OVERRIDE { |
3603 if (HasSmiValue() && SmiValuesAre31Bits()) return Representation::Smi(); | 3557 if (HasSmiValue() && SmiValuesAre31Bits()) return Representation::Smi(); |
3604 if (HasInteger32Value()) return Representation::Integer32(); | 3558 if (HasInteger32Value()) return Representation::Integer32(); |
3605 if (HasNumberValue()) return Representation::Double(); | 3559 if (HasNumberValue()) return Representation::Double(); |
3606 if (HasExternalReferenceValue()) return Representation::External(); | 3560 if (HasExternalReferenceValue()) return Representation::External(); |
3607 return Representation::Tagged(); | 3561 return Representation::Tagged(); |
3608 } | 3562 } |
3609 | 3563 |
3610 virtual bool EmitAtUses() OVERRIDE; | 3564 bool EmitAtUses() OVERRIDE; |
3611 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 3565 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
3612 HConstant* CopyToRepresentation(Representation r, Zone* zone) const; | 3566 HConstant* CopyToRepresentation(Representation r, Zone* zone) const; |
3613 Maybe<HConstant*> CopyToTruncatedInt32(Zone* zone); | 3567 Maybe<HConstant*> CopyToTruncatedInt32(Zone* zone); |
3614 Maybe<HConstant*> CopyToTruncatedNumber(Zone* zone); | 3568 Maybe<HConstant*> CopyToTruncatedNumber(Zone* zone); |
3615 bool HasInteger32Value() const { | 3569 bool HasInteger32Value() const { |
3616 return HasInt32ValueField::decode(bit_field_); | 3570 return HasInt32ValueField::decode(bit_field_); |
3617 } | 3571 } |
3618 int32_t Integer32Value() const { | 3572 int32_t Integer32Value() const { |
3619 DCHECK(HasInteger32Value()); | 3573 DCHECK(HasInteger32Value()); |
3620 return int32_value_; | 3574 return int32_value_; |
3621 } | 3575 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3680 DCHECK(HasMapValue() || !HasStableMapValueField::decode(bit_field_)); | 3634 DCHECK(HasMapValue() || !HasStableMapValueField::decode(bit_field_)); |
3681 return HasStableMapValueField::decode(bit_field_); | 3635 return HasStableMapValueField::decode(bit_field_); |
3682 } | 3636 } |
3683 | 3637 |
3684 bool HasObjectMap() const { return !object_map_.IsNull(); } | 3638 bool HasObjectMap() const { return !object_map_.IsNull(); } |
3685 Unique<Map> ObjectMap() const { | 3639 Unique<Map> ObjectMap() const { |
3686 DCHECK(HasObjectMap()); | 3640 DCHECK(HasObjectMap()); |
3687 return object_map_; | 3641 return object_map_; |
3688 } | 3642 } |
3689 | 3643 |
3690 virtual intptr_t Hashcode() OVERRIDE { | 3644 intptr_t Hashcode() OVERRIDE { |
3691 if (HasInteger32Value()) { | 3645 if (HasInteger32Value()) { |
3692 return static_cast<intptr_t>(int32_value_); | 3646 return static_cast<intptr_t>(int32_value_); |
3693 } else if (HasDoubleValue()) { | 3647 } else if (HasDoubleValue()) { |
3694 return static_cast<intptr_t>(bit_cast<int64_t>(double_value_)); | 3648 return static_cast<intptr_t>(bit_cast<int64_t>(double_value_)); |
3695 } else if (HasExternalReferenceValue()) { | 3649 } else if (HasExternalReferenceValue()) { |
3696 return reinterpret_cast<intptr_t>(external_reference_value_.address()); | 3650 return reinterpret_cast<intptr_t>(external_reference_value_.address()); |
3697 } else { | 3651 } else { |
3698 DCHECK(!object_.handle().is_null()); | 3652 DCHECK(!object_.handle().is_null()); |
3699 return object_.Hashcode(); | 3653 return object_.Hashcode(); |
3700 } | 3654 } |
3701 } | 3655 } |
3702 | 3656 |
3703 virtual void FinalizeUniqueness() OVERRIDE { | 3657 void FinalizeUniqueness() OVERRIDE { |
3704 if (!HasDoubleValue() && !HasExternalReferenceValue()) { | 3658 if (!HasDoubleValue() && !HasExternalReferenceValue()) { |
3705 DCHECK(!object_.handle().is_null()); | 3659 DCHECK(!object_.handle().is_null()); |
3706 object_ = Unique<Object>(object_.handle()); | 3660 object_ = Unique<Object>(object_.handle()); |
3707 } | 3661 } |
3708 } | 3662 } |
3709 | 3663 |
3710 Unique<Object> GetUnique() const { | 3664 Unique<Object> GetUnique() const { |
3711 return object_; | 3665 return object_; |
3712 } | 3666 } |
3713 | 3667 |
3714 bool EqualsUnique(Unique<Object> other) const { | 3668 bool EqualsUnique(Unique<Object> other) const { |
3715 return object_.IsInitialized() && object_ == other; | 3669 return object_.IsInitialized() && object_ == other; |
3716 } | 3670 } |
3717 | 3671 |
3718 virtual bool DataEquals(HValue* other) OVERRIDE { | 3672 bool DataEquals(HValue* other) OVERRIDE { |
3719 HConstant* other_constant = HConstant::cast(other); | 3673 HConstant* other_constant = HConstant::cast(other); |
3720 if (HasInteger32Value()) { | 3674 if (HasInteger32Value()) { |
3721 return other_constant->HasInteger32Value() && | 3675 return other_constant->HasInteger32Value() && |
3722 int32_value_ == other_constant->int32_value_; | 3676 int32_value_ == other_constant->int32_value_; |
3723 } else if (HasDoubleValue()) { | 3677 } else if (HasDoubleValue()) { |
3724 return other_constant->HasDoubleValue() && | 3678 return other_constant->HasDoubleValue() && |
3725 bit_cast<int64_t>(double_value_) == | 3679 bit_cast<int64_t>(double_value_) == |
3726 bit_cast<int64_t>(other_constant->double_value_); | 3680 bit_cast<int64_t>(other_constant->double_value_); |
3727 } else if (HasExternalReferenceValue()) { | 3681 } else if (HasExternalReferenceValue()) { |
3728 return other_constant->HasExternalReferenceValue() && | 3682 return other_constant->HasExternalReferenceValue() && |
3729 external_reference_value_ == | 3683 external_reference_value_ == |
3730 other_constant->external_reference_value_; | 3684 other_constant->external_reference_value_; |
3731 } else { | 3685 } else { |
3732 if (other_constant->HasInteger32Value() || | 3686 if (other_constant->HasInteger32Value() || |
3733 other_constant->HasDoubleValue() || | 3687 other_constant->HasDoubleValue() || |
3734 other_constant->HasExternalReferenceValue()) { | 3688 other_constant->HasExternalReferenceValue()) { |
3735 return false; | 3689 return false; |
3736 } | 3690 } |
3737 DCHECK(!object_.handle().is_null()); | 3691 DCHECK(!object_.handle().is_null()); |
3738 return other_constant->object_ == object_; | 3692 return other_constant->object_ == object_; |
3739 } | 3693 } |
3740 } | 3694 } |
3741 | 3695 |
3742 #ifdef DEBUG | 3696 #ifdef DEBUG |
3743 virtual void Verify() OVERRIDE { } | 3697 void Verify() OVERRIDE {} |
3744 #endif | 3698 #endif |
3745 | 3699 |
3746 DECLARE_CONCRETE_INSTRUCTION(Constant) | 3700 DECLARE_CONCRETE_INSTRUCTION(Constant) |
3747 | 3701 |
3748 protected: | 3702 protected: |
3749 virtual Range* InferRange(Zone* zone) OVERRIDE; | 3703 Range* InferRange(Zone* zone) OVERRIDE; |
3750 | 3704 |
3751 private: | 3705 private: |
3752 friend class HGraph; | 3706 friend class HGraph; |
3753 explicit HConstant(Handle<Object> handle, | 3707 explicit HConstant(Handle<Object> handle, |
3754 Representation r = Representation::None()); | 3708 Representation r = Representation::None()); |
3755 HConstant(int32_t value, | 3709 HConstant(int32_t value, |
3756 Representation r = Representation::None(), | 3710 Representation r = Representation::None(), |
3757 bool is_not_in_new_space = true, | 3711 bool is_not_in_new_space = true, |
3758 Unique<Object> optional = Unique<Object>(Handle<Object>::null())); | 3712 Unique<Object> optional = Unique<Object>(Handle<Object>::null())); |
3759 HConstant(double value, | 3713 HConstant(double value, |
3760 Representation r = Representation::None(), | 3714 Representation r = Representation::None(), |
3761 bool is_not_in_new_space = true, | 3715 bool is_not_in_new_space = true, |
3762 Unique<Object> optional = Unique<Object>(Handle<Object>::null())); | 3716 Unique<Object> optional = Unique<Object>(Handle<Object>::null())); |
3763 HConstant(Unique<Object> object, | 3717 HConstant(Unique<Object> object, |
3764 Unique<Map> object_map, | 3718 Unique<Map> object_map, |
3765 bool has_stable_map_value, | 3719 bool has_stable_map_value, |
3766 Representation r, | 3720 Representation r, |
3767 HType type, | 3721 HType type, |
3768 bool is_not_in_new_space, | 3722 bool is_not_in_new_space, |
3769 bool boolean_value, | 3723 bool boolean_value, |
3770 bool is_undetectable, | 3724 bool is_undetectable, |
3771 InstanceType instance_type); | 3725 InstanceType instance_type); |
3772 | 3726 |
3773 explicit HConstant(ExternalReference reference); | 3727 explicit HConstant(ExternalReference reference); |
3774 | 3728 |
3775 void Initialize(Representation r); | 3729 void Initialize(Representation r); |
3776 | 3730 |
3777 virtual bool IsDeletable() const OVERRIDE { return true; } | 3731 bool IsDeletable() const OVERRIDE { return true; } |
3778 | 3732 |
3779 // If object_ is a map, this indicates whether the map is stable. | 3733 // If object_ is a map, this indicates whether the map is stable. |
3780 class HasStableMapValueField : public BitField<bool, 0, 1> {}; | 3734 class HasStableMapValueField : public BitField<bool, 0, 1> {}; |
3781 | 3735 |
3782 // We store the HConstant in the most specific form safely possible. | 3736 // We store the HConstant in the most specific form safely possible. |
3783 // These flags tell us if the respective member fields hold valid, safe | 3737 // These flags tell us if the respective member fields hold valid, safe |
3784 // representations of the constant. More specific flags imply more general | 3738 // representations of the constant. More specific flags imply more general |
3785 // flags, but not the converse (i.e. smi => int32 => double). | 3739 // flags, but not the converse (i.e. smi => int32 => double). |
3786 class HasSmiValueField : public BitField<bool, 1, 1> {}; | 3740 class HasSmiValueField : public BitField<bool, 1, 1> {}; |
3787 class HasInt32ValueField : public BitField<bool, 2, 1> {}; | 3741 class HasInt32ValueField : public BitField<bool, 2, 1> {}; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3855 | 3809 |
3856 void set_observed_input_representation(int index, Representation rep) { | 3810 void set_observed_input_representation(int index, Representation rep) { |
3857 DCHECK(index >= 1 && index <= 2); | 3811 DCHECK(index >= 1 && index <= 2); |
3858 observed_input_representation_[index - 1] = rep; | 3812 observed_input_representation_[index - 1] = rep; |
3859 } | 3813 } |
3860 | 3814 |
3861 virtual void initialize_output_representation(Representation observed) { | 3815 virtual void initialize_output_representation(Representation observed) { |
3862 observed_output_representation_ = observed; | 3816 observed_output_representation_ = observed; |
3863 } | 3817 } |
3864 | 3818 |
3865 virtual Representation observed_input_representation(int index) OVERRIDE { | 3819 Representation observed_input_representation(int index) OVERRIDE { |
3866 if (index == 0) return Representation::Tagged(); | 3820 if (index == 0) return Representation::Tagged(); |
3867 return observed_input_representation_[index - 1]; | 3821 return observed_input_representation_[index - 1]; |
3868 } | 3822 } |
3869 | 3823 |
3870 virtual void UpdateRepresentation(Representation new_rep, | 3824 virtual void UpdateRepresentation(Representation new_rep, |
3871 HInferRepresentationPhase* h_infer, | 3825 HInferRepresentationPhase* h_infer, |
3872 const char* reason) OVERRIDE { | 3826 const char* reason) OVERRIDE { |
3873 Representation rep = !FLAG_smi_binop && new_rep.IsSmi() | 3827 Representation rep = !FLAG_smi_binop && new_rep.IsSmi() |
3874 ? Representation::Integer32() : new_rep; | 3828 ? Representation::Integer32() : new_rep; |
3875 HValue::UpdateRepresentation(rep, h_infer, reason); | 3829 HValue::UpdateRepresentation(rep, h_infer, reason); |
3876 } | 3830 } |
3877 | 3831 |
3878 virtual void InferRepresentation( | 3832 virtual void InferRepresentation( |
3879 HInferRepresentationPhase* h_infer) OVERRIDE; | 3833 HInferRepresentationPhase* h_infer) OVERRIDE; |
3880 virtual Representation RepresentationFromInputs() OVERRIDE; | 3834 Representation RepresentationFromInputs() OVERRIDE; |
3881 Representation RepresentationFromOutput(); | 3835 Representation RepresentationFromOutput(); |
3882 virtual void AssumeRepresentation(Representation r) OVERRIDE; | 3836 void AssumeRepresentation(Representation r) OVERRIDE; |
3883 | 3837 |
3884 virtual bool IsCommutative() const { return false; } | 3838 virtual bool IsCommutative() const { return false; } |
3885 | 3839 |
3886 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 3840 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
3887 | 3841 |
3888 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 3842 Representation RequiredInputRepresentation(int index) OVERRIDE { |
3889 if (index == 0) return Representation::Tagged(); | 3843 if (index == 0) return Representation::Tagged(); |
3890 return representation(); | 3844 return representation(); |
3891 } | 3845 } |
3892 | 3846 |
3893 void SetOperandPositions(Zone* zone, | 3847 void SetOperandPositions(Zone* zone, |
3894 HSourcePosition left_pos, | 3848 HSourcePosition left_pos, |
3895 HSourcePosition right_pos) { | 3849 HSourcePosition right_pos) { |
3896 set_operand_position(zone, 1, left_pos); | 3850 set_operand_position(zone, 1, left_pos); |
3897 set_operand_position(zone, 2, right_pos); | 3851 set_operand_position(zone, 2, right_pos); |
3898 } | 3852 } |
(...skipping 14 matching lines...) Expand all Loading... |
3913 | 3867 |
3914 Representation observed_input_representation_[2]; | 3868 Representation observed_input_representation_[2]; |
3915 Representation observed_output_representation_; | 3869 Representation observed_output_representation_; |
3916 }; | 3870 }; |
3917 | 3871 |
3918 | 3872 |
3919 class HWrapReceiver FINAL : public HTemplateInstruction<2> { | 3873 class HWrapReceiver FINAL : public HTemplateInstruction<2> { |
3920 public: | 3874 public: |
3921 DECLARE_INSTRUCTION_FACTORY_P2(HWrapReceiver, HValue*, HValue*); | 3875 DECLARE_INSTRUCTION_FACTORY_P2(HWrapReceiver, HValue*, HValue*); |
3922 | 3876 |
3923 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 3877 bool DataEquals(HValue* other) OVERRIDE { return true; } |
3924 | 3878 |
3925 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 3879 Representation RequiredInputRepresentation(int index) OVERRIDE { |
3926 return Representation::Tagged(); | 3880 return Representation::Tagged(); |
3927 } | 3881 } |
3928 | 3882 |
3929 HValue* receiver() const { return OperandAt(0); } | 3883 HValue* receiver() const { return OperandAt(0); } |
3930 HValue* function() const { return OperandAt(1); } | 3884 HValue* function() const { return OperandAt(1); } |
3931 | 3885 |
3932 virtual HValue* Canonicalize() OVERRIDE; | 3886 HValue* Canonicalize() OVERRIDE; |
3933 | 3887 |
3934 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 3888 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
3935 bool known_function() const { return known_function_; } | 3889 bool known_function() const { return known_function_; } |
3936 | 3890 |
3937 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver) | 3891 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver) |
3938 | 3892 |
3939 private: | 3893 private: |
3940 HWrapReceiver(HValue* receiver, HValue* function) { | 3894 HWrapReceiver(HValue* receiver, HValue* function) { |
3941 known_function_ = function->IsConstant() && | 3895 known_function_ = function->IsConstant() && |
3942 HConstant::cast(function)->handle(function->isolate())->IsJSFunction(); | 3896 HConstant::cast(function)->handle(function->isolate())->IsJSFunction(); |
3943 set_representation(Representation::Tagged()); | 3897 set_representation(Representation::Tagged()); |
3944 SetOperandAt(0, receiver); | 3898 SetOperandAt(0, receiver); |
3945 SetOperandAt(1, function); | 3899 SetOperandAt(1, function); |
3946 SetFlag(kUseGVN); | 3900 SetFlag(kUseGVN); |
3947 } | 3901 } |
3948 | 3902 |
3949 bool known_function_; | 3903 bool known_function_; |
3950 }; | 3904 }; |
3951 | 3905 |
3952 | 3906 |
3953 class HApplyArguments FINAL : public HTemplateInstruction<4> { | 3907 class HApplyArguments FINAL : public HTemplateInstruction<4> { |
3954 public: | 3908 public: |
3955 DECLARE_INSTRUCTION_FACTORY_P4(HApplyArguments, HValue*, HValue*, HValue*, | 3909 DECLARE_INSTRUCTION_FACTORY_P4(HApplyArguments, HValue*, HValue*, HValue*, |
3956 HValue*); | 3910 HValue*); |
3957 | 3911 |
3958 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 3912 Representation RequiredInputRepresentation(int index) OVERRIDE { |
3959 // The length is untagged, all other inputs are tagged. | 3913 // The length is untagged, all other inputs are tagged. |
3960 return (index == 2) | 3914 return (index == 2) |
3961 ? Representation::Integer32() | 3915 ? Representation::Integer32() |
3962 : Representation::Tagged(); | 3916 : Representation::Tagged(); |
3963 } | 3917 } |
3964 | 3918 |
3965 HValue* function() { return OperandAt(0); } | 3919 HValue* function() { return OperandAt(0); } |
3966 HValue* receiver() { return OperandAt(1); } | 3920 HValue* receiver() { return OperandAt(1); } |
3967 HValue* length() { return OperandAt(2); } | 3921 HValue* length() { return OperandAt(2); } |
3968 HValue* elements() { return OperandAt(3); } | 3922 HValue* elements() { return OperandAt(3); } |
(...skipping 14 matching lines...) Expand all Loading... |
3983 } | 3937 } |
3984 }; | 3938 }; |
3985 | 3939 |
3986 | 3940 |
3987 class HArgumentsElements FINAL : public HTemplateInstruction<0> { | 3941 class HArgumentsElements FINAL : public HTemplateInstruction<0> { |
3988 public: | 3942 public: |
3989 DECLARE_INSTRUCTION_FACTORY_P1(HArgumentsElements, bool); | 3943 DECLARE_INSTRUCTION_FACTORY_P1(HArgumentsElements, bool); |
3990 | 3944 |
3991 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements) | 3945 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements) |
3992 | 3946 |
3993 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 3947 Representation RequiredInputRepresentation(int index) OVERRIDE { |
3994 return Representation::None(); | 3948 return Representation::None(); |
3995 } | 3949 } |
3996 | 3950 |
3997 bool from_inlined() const { return from_inlined_; } | 3951 bool from_inlined() const { return from_inlined_; } |
3998 | 3952 |
3999 protected: | 3953 protected: |
4000 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 3954 bool DataEquals(HValue* other) OVERRIDE { return true; } |
4001 | 3955 |
4002 private: | 3956 private: |
4003 explicit HArgumentsElements(bool from_inlined) : from_inlined_(from_inlined) { | 3957 explicit HArgumentsElements(bool from_inlined) : from_inlined_(from_inlined) { |
4004 // The value produced by this instruction is a pointer into the stack | 3958 // The value produced by this instruction is a pointer into the stack |
4005 // that looks as if it was a smi because of alignment. | 3959 // that looks as if it was a smi because of alignment. |
4006 set_representation(Representation::Tagged()); | 3960 set_representation(Representation::Tagged()); |
4007 SetFlag(kUseGVN); | 3961 SetFlag(kUseGVN); |
4008 } | 3962 } |
4009 | 3963 |
4010 virtual bool IsDeletable() const OVERRIDE { return true; } | 3964 bool IsDeletable() const OVERRIDE { return true; } |
4011 | 3965 |
4012 bool from_inlined_; | 3966 bool from_inlined_; |
4013 }; | 3967 }; |
4014 | 3968 |
4015 | 3969 |
4016 class HArgumentsLength FINAL : public HUnaryOperation { | 3970 class HArgumentsLength FINAL : public HUnaryOperation { |
4017 public: | 3971 public: |
4018 DECLARE_INSTRUCTION_FACTORY_P1(HArgumentsLength, HValue*); | 3972 DECLARE_INSTRUCTION_FACTORY_P1(HArgumentsLength, HValue*); |
4019 | 3973 |
4020 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 3974 Representation RequiredInputRepresentation(int index) OVERRIDE { |
4021 return Representation::Tagged(); | 3975 return Representation::Tagged(); |
4022 } | 3976 } |
4023 | 3977 |
4024 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength) | 3978 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength) |
4025 | 3979 |
4026 protected: | 3980 protected: |
4027 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 3981 bool DataEquals(HValue* other) OVERRIDE { return true; } |
4028 | 3982 |
4029 private: | 3983 private: |
4030 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { | 3984 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { |
4031 set_representation(Representation::Integer32()); | 3985 set_representation(Representation::Integer32()); |
4032 SetFlag(kUseGVN); | 3986 SetFlag(kUseGVN); |
4033 } | 3987 } |
4034 | 3988 |
4035 virtual bool IsDeletable() const OVERRIDE { return true; } | 3989 bool IsDeletable() const OVERRIDE { return true; } |
4036 }; | 3990 }; |
4037 | 3991 |
4038 | 3992 |
4039 class HAccessArgumentsAt FINAL : public HTemplateInstruction<3> { | 3993 class HAccessArgumentsAt FINAL : public HTemplateInstruction<3> { |
4040 public: | 3994 public: |
4041 DECLARE_INSTRUCTION_FACTORY_P3(HAccessArgumentsAt, HValue*, HValue*, HValue*); | 3995 DECLARE_INSTRUCTION_FACTORY_P3(HAccessArgumentsAt, HValue*, HValue*, HValue*); |
4042 | 3996 |
4043 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 3997 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
4044 | 3998 |
4045 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 3999 Representation RequiredInputRepresentation(int index) OVERRIDE { |
4046 // The arguments elements is considered tagged. | 4000 // The arguments elements is considered tagged. |
4047 return index == 0 | 4001 return index == 0 |
4048 ? Representation::Tagged() | 4002 ? Representation::Tagged() |
4049 : Representation::Integer32(); | 4003 : Representation::Integer32(); |
4050 } | 4004 } |
4051 | 4005 |
4052 HValue* arguments() const { return OperandAt(0); } | 4006 HValue* arguments() const { return OperandAt(0); } |
4053 HValue* length() const { return OperandAt(1); } | 4007 HValue* length() const { return OperandAt(1); } |
4054 HValue* index() const { return OperandAt(2); } | 4008 HValue* index() const { return OperandAt(2); } |
4055 | 4009 |
4056 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt) | 4010 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt) |
4057 | 4011 |
4058 private: | 4012 private: |
4059 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { | 4013 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { |
4060 set_representation(Representation::Tagged()); | 4014 set_representation(Representation::Tagged()); |
4061 SetFlag(kUseGVN); | 4015 SetFlag(kUseGVN); |
4062 SetOperandAt(0, arguments); | 4016 SetOperandAt(0, arguments); |
4063 SetOperandAt(1, length); | 4017 SetOperandAt(1, length); |
4064 SetOperandAt(2, index); | 4018 SetOperandAt(2, index); |
4065 } | 4019 } |
4066 | 4020 |
4067 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 4021 bool DataEquals(HValue* other) OVERRIDE { return true; } |
4068 }; | 4022 }; |
4069 | 4023 |
4070 | 4024 |
4071 class HBoundsCheckBaseIndexInformation; | 4025 class HBoundsCheckBaseIndexInformation; |
4072 | 4026 |
4073 | 4027 |
4074 class HBoundsCheck FINAL : public HTemplateInstruction<2> { | 4028 class HBoundsCheck FINAL : public HTemplateInstruction<2> { |
4075 public: | 4029 public: |
4076 DECLARE_INSTRUCTION_FACTORY_P2(HBoundsCheck, HValue*, HValue*); | 4030 DECLARE_INSTRUCTION_FACTORY_P2(HBoundsCheck, HValue*, HValue*); |
4077 | 4031 |
(...skipping 15 matching lines...) Expand all Loading... |
4093 scale_ = decomposition.scale(); | 4047 scale_ = decomposition.scale(); |
4094 return true; | 4048 return true; |
4095 } else { | 4049 } else { |
4096 base_ = index(); | 4050 base_ = index(); |
4097 offset_ = 0; | 4051 offset_ = 0; |
4098 scale_ = 0; | 4052 scale_ = 0; |
4099 return false; | 4053 return false; |
4100 } | 4054 } |
4101 } | 4055 } |
4102 | 4056 |
4103 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 4057 Representation RequiredInputRepresentation(int index) OVERRIDE { |
4104 return representation(); | 4058 return representation(); |
4105 } | 4059 } |
4106 | 4060 |
4107 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 4061 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
4108 virtual void InferRepresentation( | 4062 virtual void InferRepresentation( |
4109 HInferRepresentationPhase* h_infer) OVERRIDE; | 4063 HInferRepresentationPhase* h_infer) OVERRIDE; |
4110 | 4064 |
4111 HValue* index() const { return OperandAt(0); } | 4065 HValue* index() const { return OperandAt(0); } |
4112 HValue* length() const { return OperandAt(1); } | 4066 HValue* length() const { return OperandAt(1); } |
4113 bool allow_equality() const { return allow_equality_; } | 4067 bool allow_equality() const { return allow_equality_; } |
4114 void set_allow_equality(bool v) { allow_equality_ = v; } | 4068 void set_allow_equality(bool v) { allow_equality_ = v; } |
4115 | 4069 |
4116 virtual int RedefinedOperandIndex() OVERRIDE { return 0; } | 4070 int RedefinedOperandIndex() OVERRIDE { return 0; } |
4117 virtual bool IsPurelyInformativeDefinition() OVERRIDE { | 4071 bool IsPurelyInformativeDefinition() OVERRIDE { return skip_check(); } |
4118 return skip_check(); | |
4119 } | |
4120 | 4072 |
4121 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) | 4073 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) |
4122 | 4074 |
4123 protected: | 4075 protected: |
4124 friend class HBoundsCheckBaseIndexInformation; | 4076 friend class HBoundsCheckBaseIndexInformation; |
4125 | 4077 |
4126 virtual Range* InferRange(Zone* zone) OVERRIDE; | 4078 Range* InferRange(Zone* zone) OVERRIDE; |
4127 | 4079 |
4128 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 4080 bool DataEquals(HValue* other) OVERRIDE { return true; } |
4129 bool skip_check_; | 4081 bool skip_check_; |
4130 HValue* base_; | 4082 HValue* base_; |
4131 int offset_; | 4083 int offset_; |
4132 int scale_; | 4084 int scale_; |
4133 bool allow_equality_; | 4085 bool allow_equality_; |
4134 | 4086 |
4135 private: | 4087 private: |
4136 // Normally HBoundsCheck should be created using the | 4088 // Normally HBoundsCheck should be created using the |
4137 // HGraphBuilder::AddBoundsCheck() helper. | 4089 // HGraphBuilder::AddBoundsCheck() helper. |
4138 // However when building stubs, where we know that the arguments are Int32, | 4090 // However when building stubs, where we know that the arguments are Int32, |
4139 // it makes sense to invoke this constructor directly. | 4091 // it makes sense to invoke this constructor directly. |
4140 HBoundsCheck(HValue* index, HValue* length) | 4092 HBoundsCheck(HValue* index, HValue* length) |
4141 : skip_check_(false), | 4093 : skip_check_(false), |
4142 base_(NULL), offset_(0), scale_(0), | 4094 base_(NULL), offset_(0), scale_(0), |
4143 allow_equality_(false) { | 4095 allow_equality_(false) { |
4144 SetOperandAt(0, index); | 4096 SetOperandAt(0, index); |
4145 SetOperandAt(1, length); | 4097 SetOperandAt(1, length); |
4146 SetFlag(kFlexibleRepresentation); | 4098 SetFlag(kFlexibleRepresentation); |
4147 SetFlag(kUseGVN); | 4099 SetFlag(kUseGVN); |
4148 } | 4100 } |
4149 | 4101 |
4150 virtual bool IsDeletable() const OVERRIDE { | 4102 bool IsDeletable() const OVERRIDE { return skip_check() && !FLAG_debug_code; } |
4151 return skip_check() && !FLAG_debug_code; | |
4152 } | |
4153 }; | 4103 }; |
4154 | 4104 |
4155 | 4105 |
4156 class HBoundsCheckBaseIndexInformation FINAL | 4106 class HBoundsCheckBaseIndexInformation FINAL |
4157 : public HTemplateInstruction<2> { | 4107 : public HTemplateInstruction<2> { |
4158 public: | 4108 public: |
4159 explicit HBoundsCheckBaseIndexInformation(HBoundsCheck* check) { | 4109 explicit HBoundsCheckBaseIndexInformation(HBoundsCheck* check) { |
4160 DecompositionResult decomposition; | 4110 DecompositionResult decomposition; |
4161 if (check->index()->TryDecompose(&decomposition)) { | 4111 if (check->index()->TryDecompose(&decomposition)) { |
4162 SetOperandAt(0, decomposition.base()); | 4112 SetOperandAt(0, decomposition.base()); |
4163 SetOperandAt(1, check); | 4113 SetOperandAt(1, check); |
4164 } else { | 4114 } else { |
4165 UNREACHABLE(); | 4115 UNREACHABLE(); |
4166 } | 4116 } |
4167 } | 4117 } |
4168 | 4118 |
4169 HValue* base_index() const { return OperandAt(0); } | 4119 HValue* base_index() const { return OperandAt(0); } |
4170 HBoundsCheck* bounds_check() { return HBoundsCheck::cast(OperandAt(1)); } | 4120 HBoundsCheck* bounds_check() { return HBoundsCheck::cast(OperandAt(1)); } |
4171 | 4121 |
4172 DECLARE_CONCRETE_INSTRUCTION(BoundsCheckBaseIndexInformation) | 4122 DECLARE_CONCRETE_INSTRUCTION(BoundsCheckBaseIndexInformation) |
4173 | 4123 |
4174 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 4124 Representation RequiredInputRepresentation(int index) OVERRIDE { |
4175 return representation(); | 4125 return representation(); |
4176 } | 4126 } |
4177 | 4127 |
4178 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 4128 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
4179 | 4129 |
4180 virtual int RedefinedOperandIndex() OVERRIDE { return 0; } | 4130 int RedefinedOperandIndex() OVERRIDE { return 0; } |
4181 virtual bool IsPurelyInformativeDefinition() OVERRIDE { return true; } | 4131 bool IsPurelyInformativeDefinition() OVERRIDE { return true; } |
4182 }; | 4132 }; |
4183 | 4133 |
4184 | 4134 |
4185 class HBitwiseBinaryOperation : public HBinaryOperation { | 4135 class HBitwiseBinaryOperation : public HBinaryOperation { |
4186 public: | 4136 public: |
4187 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, | 4137 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, |
4188 HType type = HType::TaggedNumber()) | 4138 HType type = HType::TaggedNumber()) |
4189 : HBinaryOperation(context, left, right, type) { | 4139 : HBinaryOperation(context, left, right, type) { |
4190 SetFlag(kFlexibleRepresentation); | 4140 SetFlag(kFlexibleRepresentation); |
4191 SetFlag(kTruncatingToInt32); | 4141 SetFlag(kTruncatingToInt32); |
4192 SetFlag(kAllowUndefinedAsNaN); | 4142 SetFlag(kAllowUndefinedAsNaN); |
4193 SetAllSideEffects(); | 4143 SetAllSideEffects(); |
4194 } | 4144 } |
4195 | 4145 |
4196 virtual void RepresentationChanged(Representation to) OVERRIDE { | 4146 void RepresentationChanged(Representation to) OVERRIDE { |
4197 if (to.IsTagged() && | 4147 if (to.IsTagged() && |
4198 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { | 4148 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { |
4199 SetAllSideEffects(); | 4149 SetAllSideEffects(); |
4200 ClearFlag(kUseGVN); | 4150 ClearFlag(kUseGVN); |
4201 } else { | 4151 } else { |
4202 ClearAllSideEffects(); | 4152 ClearAllSideEffects(); |
4203 SetFlag(kUseGVN); | 4153 SetFlag(kUseGVN); |
4204 } | 4154 } |
4205 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); | 4155 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); |
4206 } | 4156 } |
4207 | 4157 |
4208 virtual void UpdateRepresentation(Representation new_rep, | 4158 virtual void UpdateRepresentation(Representation new_rep, |
4209 HInferRepresentationPhase* h_infer, | 4159 HInferRepresentationPhase* h_infer, |
4210 const char* reason) OVERRIDE { | 4160 const char* reason) OVERRIDE { |
4211 // We only generate either int32 or generic tagged bitwise operations. | 4161 // We only generate either int32 or generic tagged bitwise operations. |
4212 if (new_rep.IsDouble()) new_rep = Representation::Integer32(); | 4162 if (new_rep.IsDouble()) new_rep = Representation::Integer32(); |
4213 HBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4163 HBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
4214 } | 4164 } |
4215 | 4165 |
4216 virtual Representation observed_input_representation(int index) OVERRIDE { | 4166 Representation observed_input_representation(int index) OVERRIDE { |
4217 Representation r = HBinaryOperation::observed_input_representation(index); | 4167 Representation r = HBinaryOperation::observed_input_representation(index); |
4218 if (r.IsDouble()) return Representation::Integer32(); | 4168 if (r.IsDouble()) return Representation::Integer32(); |
4219 return r; | 4169 return r; |
4220 } | 4170 } |
4221 | 4171 |
4222 virtual void initialize_output_representation( | 4172 virtual void initialize_output_representation( |
4223 Representation observed) OVERRIDE { | 4173 Representation observed) OVERRIDE { |
4224 if (observed.IsDouble()) observed = Representation::Integer32(); | 4174 if (observed.IsDouble()) observed = Representation::Integer32(); |
4225 HBinaryOperation::initialize_output_representation(observed); | 4175 HBinaryOperation::initialize_output_representation(observed); |
4226 } | 4176 } |
4227 | 4177 |
4228 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation) | 4178 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation) |
4229 | 4179 |
4230 private: | 4180 private: |
4231 virtual bool IsDeletable() const OVERRIDE { return true; } | 4181 bool IsDeletable() const OVERRIDE { return true; } |
4232 }; | 4182 }; |
4233 | 4183 |
4234 | 4184 |
4235 class HMathFloorOfDiv FINAL : public HBinaryOperation { | 4185 class HMathFloorOfDiv FINAL : public HBinaryOperation { |
4236 public: | 4186 public: |
4237 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HMathFloorOfDiv, | 4187 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HMathFloorOfDiv, |
4238 HValue*, | 4188 HValue*, |
4239 HValue*); | 4189 HValue*); |
4240 | 4190 |
4241 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv) | 4191 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv) |
4242 | 4192 |
4243 protected: | 4193 protected: |
4244 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 4194 bool DataEquals(HValue* other) OVERRIDE { return true; } |
4245 | 4195 |
4246 private: | 4196 private: |
4247 HMathFloorOfDiv(HValue* context, HValue* left, HValue* right) | 4197 HMathFloorOfDiv(HValue* context, HValue* left, HValue* right) |
4248 : HBinaryOperation(context, left, right) { | 4198 : HBinaryOperation(context, left, right) { |
4249 set_representation(Representation::Integer32()); | 4199 set_representation(Representation::Integer32()); |
4250 SetFlag(kUseGVN); | 4200 SetFlag(kUseGVN); |
4251 SetFlag(kCanOverflow); | 4201 SetFlag(kCanOverflow); |
4252 SetFlag(kCanBeDivByZero); | 4202 SetFlag(kCanBeDivByZero); |
4253 SetFlag(kLeftCanBeMinInt); | 4203 SetFlag(kLeftCanBeMinInt); |
4254 SetFlag(kLeftCanBeNegative); | 4204 SetFlag(kLeftCanBeNegative); |
4255 SetFlag(kLeftCanBePositive); | 4205 SetFlag(kLeftCanBePositive); |
4256 SetFlag(kAllowUndefinedAsNaN); | 4206 SetFlag(kAllowUndefinedAsNaN); |
4257 } | 4207 } |
4258 | 4208 |
4259 virtual Range* InferRange(Zone* zone) OVERRIDE; | 4209 Range* InferRange(Zone* zone) OVERRIDE; |
4260 | 4210 |
4261 virtual bool IsDeletable() const OVERRIDE { return true; } | 4211 bool IsDeletable() const OVERRIDE { return true; } |
4262 }; | 4212 }; |
4263 | 4213 |
4264 | 4214 |
4265 class HArithmeticBinaryOperation : public HBinaryOperation { | 4215 class HArithmeticBinaryOperation : public HBinaryOperation { |
4266 public: | 4216 public: |
4267 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right) | 4217 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right) |
4268 : HBinaryOperation(context, left, right, HType::TaggedNumber()) { | 4218 : HBinaryOperation(context, left, right, HType::TaggedNumber()) { |
4269 SetAllSideEffects(); | 4219 SetAllSideEffects(); |
4270 SetFlag(kFlexibleRepresentation); | 4220 SetFlag(kFlexibleRepresentation); |
4271 SetFlag(kAllowUndefinedAsNaN); | 4221 SetFlag(kAllowUndefinedAsNaN); |
4272 } | 4222 } |
4273 | 4223 |
4274 virtual void RepresentationChanged(Representation to) OVERRIDE { | 4224 void RepresentationChanged(Representation to) OVERRIDE { |
4275 if (to.IsTagged() && | 4225 if (to.IsTagged() && |
4276 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { | 4226 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { |
4277 SetAllSideEffects(); | 4227 SetAllSideEffects(); |
4278 ClearFlag(kUseGVN); | 4228 ClearFlag(kUseGVN); |
4279 } else { | 4229 } else { |
4280 ClearAllSideEffects(); | 4230 ClearAllSideEffects(); |
4281 SetFlag(kUseGVN); | 4231 SetFlag(kUseGVN); |
4282 } | 4232 } |
4283 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); | 4233 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); |
4284 } | 4234 } |
4285 | 4235 |
4286 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation) | 4236 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation) |
4287 | 4237 |
4288 private: | 4238 private: |
4289 virtual bool IsDeletable() const OVERRIDE { return true; } | 4239 bool IsDeletable() const OVERRIDE { return true; } |
4290 }; | 4240 }; |
4291 | 4241 |
4292 | 4242 |
4293 class HCompareGeneric FINAL : public HBinaryOperation { | 4243 class HCompareGeneric FINAL : public HBinaryOperation { |
4294 public: | 4244 public: |
4295 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCompareGeneric, HValue*, | 4245 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCompareGeneric, HValue*, |
4296 HValue*, Token::Value); | 4246 HValue*, Token::Value); |
4297 | 4247 |
4298 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 4248 Representation RequiredInputRepresentation(int index) OVERRIDE { |
4299 return index == 0 | 4249 return index == 0 |
4300 ? Representation::Tagged() | 4250 ? Representation::Tagged() |
4301 : representation(); | 4251 : representation(); |
4302 } | 4252 } |
4303 | 4253 |
4304 Token::Value token() const { return token_; } | 4254 Token::Value token() const { return token_; } |
4305 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 4255 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
4306 | 4256 |
4307 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) | 4257 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) |
4308 | 4258 |
4309 private: | 4259 private: |
4310 HCompareGeneric(HValue* context, | 4260 HCompareGeneric(HValue* context, |
4311 HValue* left, | 4261 HValue* left, |
4312 HValue* right, | 4262 HValue* right, |
4313 Token::Value token) | 4263 Token::Value token) |
4314 : HBinaryOperation(context, left, right, HType::Boolean()), | 4264 : HBinaryOperation(context, left, right, HType::Boolean()), |
4315 token_(token) { | 4265 token_(token) { |
(...skipping 20 matching lines...) Expand all Loading... |
4336 | 4286 |
4337 void set_observed_input_representation(Representation left, | 4287 void set_observed_input_representation(Representation left, |
4338 Representation right) { | 4288 Representation right) { |
4339 observed_input_representation_[0] = left; | 4289 observed_input_representation_[0] = left; |
4340 observed_input_representation_[1] = right; | 4290 observed_input_representation_[1] = right; |
4341 } | 4291 } |
4342 | 4292 |
4343 virtual void InferRepresentation( | 4293 virtual void InferRepresentation( |
4344 HInferRepresentationPhase* h_infer) OVERRIDE; | 4294 HInferRepresentationPhase* h_infer) OVERRIDE; |
4345 | 4295 |
4346 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 4296 Representation RequiredInputRepresentation(int index) OVERRIDE { |
4347 return representation(); | 4297 return representation(); |
4348 } | 4298 } |
4349 virtual Representation observed_input_representation(int index) OVERRIDE { | 4299 Representation observed_input_representation(int index) OVERRIDE { |
4350 return observed_input_representation_[index]; | 4300 return observed_input_representation_[index]; |
4351 } | 4301 } |
4352 | 4302 |
4353 virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; | 4303 bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; |
4354 | 4304 |
4355 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 4305 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
4356 | 4306 |
4357 void SetOperandPositions(Zone* zone, | 4307 void SetOperandPositions(Zone* zone, |
4358 HSourcePosition left_pos, | 4308 HSourcePosition left_pos, |
4359 HSourcePosition right_pos) { | 4309 HSourcePosition right_pos) { |
4360 set_operand_position(zone, 0, left_pos); | 4310 set_operand_position(zone, 0, left_pos); |
4361 set_operand_position(zone, 1, right_pos); | 4311 set_operand_position(zone, 1, right_pos); |
4362 } | 4312 } |
4363 | 4313 |
4364 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch) | 4314 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch) |
4365 | 4315 |
(...skipping 19 matching lines...) Expand all Loading... |
4385 | 4335 |
4386 class HCompareHoleAndBranch FINAL : public HUnaryControlInstruction { | 4336 class HCompareHoleAndBranch FINAL : public HUnaryControlInstruction { |
4387 public: | 4337 public: |
4388 DECLARE_INSTRUCTION_FACTORY_P1(HCompareHoleAndBranch, HValue*); | 4338 DECLARE_INSTRUCTION_FACTORY_P1(HCompareHoleAndBranch, HValue*); |
4389 DECLARE_INSTRUCTION_FACTORY_P3(HCompareHoleAndBranch, HValue*, | 4339 DECLARE_INSTRUCTION_FACTORY_P3(HCompareHoleAndBranch, HValue*, |
4390 HBasicBlock*, HBasicBlock*); | 4340 HBasicBlock*, HBasicBlock*); |
4391 | 4341 |
4392 virtual void InferRepresentation( | 4342 virtual void InferRepresentation( |
4393 HInferRepresentationPhase* h_infer) OVERRIDE; | 4343 HInferRepresentationPhase* h_infer) OVERRIDE; |
4394 | 4344 |
4395 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 4345 Representation RequiredInputRepresentation(int index) OVERRIDE { |
4396 return representation(); | 4346 return representation(); |
4397 } | 4347 } |
4398 | 4348 |
4399 DECLARE_CONCRETE_INSTRUCTION(CompareHoleAndBranch) | 4349 DECLARE_CONCRETE_INSTRUCTION(CompareHoleAndBranch) |
4400 | 4350 |
4401 private: | 4351 private: |
4402 HCompareHoleAndBranch(HValue* value, | 4352 HCompareHoleAndBranch(HValue* value, |
4403 HBasicBlock* true_target = NULL, | 4353 HBasicBlock* true_target = NULL, |
4404 HBasicBlock* false_target = NULL) | 4354 HBasicBlock* false_target = NULL) |
4405 : HUnaryControlInstruction(value, true_target, false_target) { | 4355 : HUnaryControlInstruction(value, true_target, false_target) { |
4406 SetFlag(kFlexibleRepresentation); | 4356 SetFlag(kFlexibleRepresentation); |
4407 SetFlag(kAllowUndefinedAsNaN); | 4357 SetFlag(kAllowUndefinedAsNaN); |
4408 } | 4358 } |
4409 }; | 4359 }; |
4410 | 4360 |
4411 | 4361 |
4412 class HCompareMinusZeroAndBranch FINAL : public HUnaryControlInstruction { | 4362 class HCompareMinusZeroAndBranch FINAL : public HUnaryControlInstruction { |
4413 public: | 4363 public: |
4414 DECLARE_INSTRUCTION_FACTORY_P1(HCompareMinusZeroAndBranch, HValue*); | 4364 DECLARE_INSTRUCTION_FACTORY_P1(HCompareMinusZeroAndBranch, HValue*); |
4415 | 4365 |
4416 virtual void InferRepresentation( | 4366 virtual void InferRepresentation( |
4417 HInferRepresentationPhase* h_infer) OVERRIDE; | 4367 HInferRepresentationPhase* h_infer) OVERRIDE; |
4418 | 4368 |
4419 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 4369 Representation RequiredInputRepresentation(int index) OVERRIDE { |
4420 return representation(); | 4370 return representation(); |
4421 } | 4371 } |
4422 | 4372 |
4423 virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; | 4373 bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; |
4424 | 4374 |
4425 DECLARE_CONCRETE_INSTRUCTION(CompareMinusZeroAndBranch) | 4375 DECLARE_CONCRETE_INSTRUCTION(CompareMinusZeroAndBranch) |
4426 | 4376 |
4427 private: | 4377 private: |
4428 explicit HCompareMinusZeroAndBranch(HValue* value) | 4378 explicit HCompareMinusZeroAndBranch(HValue* value) |
4429 : HUnaryControlInstruction(value, NULL, NULL) { | 4379 : HUnaryControlInstruction(value, NULL, NULL) { |
4430 } | 4380 } |
4431 }; | 4381 }; |
4432 | 4382 |
4433 | 4383 |
4434 class HCompareObjectEqAndBranch : public HTemplateControlInstruction<2, 2> { | 4384 class HCompareObjectEqAndBranch : public HTemplateControlInstruction<2, 2> { |
4435 public: | 4385 public: |
4436 DECLARE_INSTRUCTION_FACTORY_P2(HCompareObjectEqAndBranch, HValue*, HValue*); | 4386 DECLARE_INSTRUCTION_FACTORY_P2(HCompareObjectEqAndBranch, HValue*, HValue*); |
4437 DECLARE_INSTRUCTION_FACTORY_P4(HCompareObjectEqAndBranch, HValue*, HValue*, | 4387 DECLARE_INSTRUCTION_FACTORY_P4(HCompareObjectEqAndBranch, HValue*, HValue*, |
4438 HBasicBlock*, HBasicBlock*); | 4388 HBasicBlock*, HBasicBlock*); |
4439 | 4389 |
4440 virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; | 4390 bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; |
4441 | 4391 |
4442 static const int kNoKnownSuccessorIndex = -1; | 4392 static const int kNoKnownSuccessorIndex = -1; |
4443 int known_successor_index() const { return known_successor_index_; } | 4393 int known_successor_index() const { return known_successor_index_; } |
4444 void set_known_successor_index(int known_successor_index) { | 4394 void set_known_successor_index(int known_successor_index) { |
4445 known_successor_index_ = known_successor_index; | 4395 known_successor_index_ = known_successor_index; |
4446 } | 4396 } |
4447 | 4397 |
4448 HValue* left() const { return OperandAt(0); } | 4398 HValue* left() const { return OperandAt(0); } |
4449 HValue* right() const { return OperandAt(1); } | 4399 HValue* right() const { return OperandAt(1); } |
4450 | 4400 |
4451 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 4401 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
4452 | 4402 |
4453 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 4403 Representation RequiredInputRepresentation(int index) OVERRIDE { |
4454 return Representation::Tagged(); | 4404 return Representation::Tagged(); |
4455 } | 4405 } |
4456 | 4406 |
4457 virtual Representation observed_input_representation(int index) OVERRIDE { | 4407 Representation observed_input_representation(int index) OVERRIDE { |
4458 return Representation::Tagged(); | 4408 return Representation::Tagged(); |
4459 } | 4409 } |
4460 | 4410 |
4461 DECLARE_CONCRETE_INSTRUCTION(CompareObjectEqAndBranch) | 4411 DECLARE_CONCRETE_INSTRUCTION(CompareObjectEqAndBranch) |
4462 | 4412 |
4463 private: | 4413 private: |
4464 HCompareObjectEqAndBranch(HValue* left, | 4414 HCompareObjectEqAndBranch(HValue* left, |
4465 HValue* right, | 4415 HValue* right, |
4466 HBasicBlock* true_target = NULL, | 4416 HBasicBlock* true_target = NULL, |
4467 HBasicBlock* false_target = NULL) | 4417 HBasicBlock* false_target = NULL) |
4468 : known_successor_index_(kNoKnownSuccessorIndex) { | 4418 : known_successor_index_(kNoKnownSuccessorIndex) { |
4469 SetOperandAt(0, left); | 4419 SetOperandAt(0, left); |
4470 SetOperandAt(1, right); | 4420 SetOperandAt(1, right); |
4471 SetSuccessorAt(0, true_target); | 4421 SetSuccessorAt(0, true_target); |
4472 SetSuccessorAt(1, false_target); | 4422 SetSuccessorAt(1, false_target); |
4473 } | 4423 } |
4474 | 4424 |
4475 int known_successor_index_; | 4425 int known_successor_index_; |
4476 }; | 4426 }; |
4477 | 4427 |
4478 | 4428 |
4479 class HIsObjectAndBranch FINAL : public HUnaryControlInstruction { | 4429 class HIsObjectAndBranch FINAL : public HUnaryControlInstruction { |
4480 public: | 4430 public: |
4481 DECLARE_INSTRUCTION_FACTORY_P1(HIsObjectAndBranch, HValue*); | 4431 DECLARE_INSTRUCTION_FACTORY_P1(HIsObjectAndBranch, HValue*); |
4482 DECLARE_INSTRUCTION_FACTORY_P3(HIsObjectAndBranch, HValue*, | 4432 DECLARE_INSTRUCTION_FACTORY_P3(HIsObjectAndBranch, HValue*, |
4483 HBasicBlock*, HBasicBlock*); | 4433 HBasicBlock*, HBasicBlock*); |
4484 | 4434 |
4485 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 4435 Representation RequiredInputRepresentation(int index) OVERRIDE { |
4486 return Representation::Tagged(); | 4436 return Representation::Tagged(); |
4487 } | 4437 } |
4488 | 4438 |
4489 virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; | 4439 bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; |
4490 | 4440 |
4491 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch) | 4441 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch) |
4492 | 4442 |
4493 private: | 4443 private: |
4494 HIsObjectAndBranch(HValue* value, | 4444 HIsObjectAndBranch(HValue* value, |
4495 HBasicBlock* true_target = NULL, | 4445 HBasicBlock* true_target = NULL, |
4496 HBasicBlock* false_target = NULL) | 4446 HBasicBlock* false_target = NULL) |
4497 : HUnaryControlInstruction(value, true_target, false_target) {} | 4447 : HUnaryControlInstruction(value, true_target, false_target) {} |
4498 }; | 4448 }; |
4499 | 4449 |
4500 | 4450 |
4501 class HIsStringAndBranch FINAL : public HUnaryControlInstruction { | 4451 class HIsStringAndBranch FINAL : public HUnaryControlInstruction { |
4502 public: | 4452 public: |
4503 DECLARE_INSTRUCTION_FACTORY_P1(HIsStringAndBranch, HValue*); | 4453 DECLARE_INSTRUCTION_FACTORY_P1(HIsStringAndBranch, HValue*); |
4504 DECLARE_INSTRUCTION_FACTORY_P3(HIsStringAndBranch, HValue*, | 4454 DECLARE_INSTRUCTION_FACTORY_P3(HIsStringAndBranch, HValue*, |
4505 HBasicBlock*, HBasicBlock*); | 4455 HBasicBlock*, HBasicBlock*); |
4506 | 4456 |
4507 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 4457 Representation RequiredInputRepresentation(int index) OVERRIDE { |
4508 return Representation::Tagged(); | 4458 return Representation::Tagged(); |
4509 } | 4459 } |
4510 | 4460 |
4511 virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; | 4461 bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; |
4512 | 4462 |
4513 static const int kNoKnownSuccessorIndex = -1; | 4463 static const int kNoKnownSuccessorIndex = -1; |
4514 int known_successor_index() const { return known_successor_index_; } | 4464 int known_successor_index() const { return known_successor_index_; } |
4515 void set_known_successor_index(int known_successor_index) { | 4465 void set_known_successor_index(int known_successor_index) { |
4516 known_successor_index_ = known_successor_index; | 4466 known_successor_index_ = known_successor_index; |
4517 } | 4467 } |
4518 | 4468 |
4519 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch) | 4469 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch) |
4520 | 4470 |
4521 protected: | 4471 protected: |
4522 virtual int RedefinedOperandIndex() OVERRIDE { return 0; } | 4472 int RedefinedOperandIndex() OVERRIDE { return 0; } |
4523 | 4473 |
4524 private: | 4474 private: |
4525 HIsStringAndBranch(HValue* value, HBasicBlock* true_target = NULL, | 4475 HIsStringAndBranch(HValue* value, HBasicBlock* true_target = NULL, |
4526 HBasicBlock* false_target = NULL) | 4476 HBasicBlock* false_target = NULL) |
4527 : HUnaryControlInstruction(value, true_target, false_target), | 4477 : HUnaryControlInstruction(value, true_target, false_target), |
4528 known_successor_index_(kNoKnownSuccessorIndex) { | 4478 known_successor_index_(kNoKnownSuccessorIndex) { |
4529 set_representation(Representation::Tagged()); | 4479 set_representation(Representation::Tagged()); |
4530 } | 4480 } |
4531 | 4481 |
4532 int known_successor_index_; | 4482 int known_successor_index_; |
4533 }; | 4483 }; |
4534 | 4484 |
4535 | 4485 |
4536 class HIsSmiAndBranch FINAL : public HUnaryControlInstruction { | 4486 class HIsSmiAndBranch FINAL : public HUnaryControlInstruction { |
4537 public: | 4487 public: |
4538 DECLARE_INSTRUCTION_FACTORY_P1(HIsSmiAndBranch, HValue*); | 4488 DECLARE_INSTRUCTION_FACTORY_P1(HIsSmiAndBranch, HValue*); |
4539 DECLARE_INSTRUCTION_FACTORY_P3(HIsSmiAndBranch, HValue*, | 4489 DECLARE_INSTRUCTION_FACTORY_P3(HIsSmiAndBranch, HValue*, |
4540 HBasicBlock*, HBasicBlock*); | 4490 HBasicBlock*, HBasicBlock*); |
4541 | 4491 |
4542 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch) | 4492 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch) |
4543 | 4493 |
4544 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 4494 Representation RequiredInputRepresentation(int index) OVERRIDE { |
4545 return Representation::Tagged(); | 4495 return Representation::Tagged(); |
4546 } | 4496 } |
4547 | 4497 |
4548 protected: | 4498 protected: |
4549 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 4499 bool DataEquals(HValue* other) OVERRIDE { return true; } |
4550 virtual int RedefinedOperandIndex() OVERRIDE { return 0; } | 4500 int RedefinedOperandIndex() OVERRIDE { return 0; } |
4551 | 4501 |
4552 private: | 4502 private: |
4553 HIsSmiAndBranch(HValue* value, | 4503 HIsSmiAndBranch(HValue* value, |
4554 HBasicBlock* true_target = NULL, | 4504 HBasicBlock* true_target = NULL, |
4555 HBasicBlock* false_target = NULL) | 4505 HBasicBlock* false_target = NULL) |
4556 : HUnaryControlInstruction(value, true_target, false_target) { | 4506 : HUnaryControlInstruction(value, true_target, false_target) { |
4557 set_representation(Representation::Tagged()); | 4507 set_representation(Representation::Tagged()); |
4558 } | 4508 } |
4559 }; | 4509 }; |
4560 | 4510 |
4561 | 4511 |
4562 class HIsUndetectableAndBranch FINAL : public HUnaryControlInstruction { | 4512 class HIsUndetectableAndBranch FINAL : public HUnaryControlInstruction { |
4563 public: | 4513 public: |
4564 DECLARE_INSTRUCTION_FACTORY_P1(HIsUndetectableAndBranch, HValue*); | 4514 DECLARE_INSTRUCTION_FACTORY_P1(HIsUndetectableAndBranch, HValue*); |
4565 DECLARE_INSTRUCTION_FACTORY_P3(HIsUndetectableAndBranch, HValue*, | 4515 DECLARE_INSTRUCTION_FACTORY_P3(HIsUndetectableAndBranch, HValue*, |
4566 HBasicBlock*, HBasicBlock*); | 4516 HBasicBlock*, HBasicBlock*); |
4567 | 4517 |
4568 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 4518 Representation RequiredInputRepresentation(int index) OVERRIDE { |
4569 return Representation::Tagged(); | 4519 return Representation::Tagged(); |
4570 } | 4520 } |
4571 | 4521 |
4572 virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; | 4522 bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; |
4573 | 4523 |
4574 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch) | 4524 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch) |
4575 | 4525 |
4576 private: | 4526 private: |
4577 HIsUndetectableAndBranch(HValue* value, | 4527 HIsUndetectableAndBranch(HValue* value, |
4578 HBasicBlock* true_target = NULL, | 4528 HBasicBlock* true_target = NULL, |
4579 HBasicBlock* false_target = NULL) | 4529 HBasicBlock* false_target = NULL) |
4580 : HUnaryControlInstruction(value, true_target, false_target) {} | 4530 : HUnaryControlInstruction(value, true_target, false_target) {} |
4581 }; | 4531 }; |
4582 | 4532 |
4583 | 4533 |
4584 class HStringCompareAndBranch : public HTemplateControlInstruction<2, 3> { | 4534 class HStringCompareAndBranch : public HTemplateControlInstruction<2, 3> { |
4585 public: | 4535 public: |
4586 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HStringCompareAndBranch, | 4536 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HStringCompareAndBranch, |
4587 HValue*, | 4537 HValue*, |
4588 HValue*, | 4538 HValue*, |
4589 Token::Value); | 4539 Token::Value); |
4590 | 4540 |
4591 HValue* context() { return OperandAt(0); } | 4541 HValue* context() { return OperandAt(0); } |
4592 HValue* left() { return OperandAt(1); } | 4542 HValue* left() { return OperandAt(1); } |
4593 HValue* right() { return OperandAt(2); } | 4543 HValue* right() { return OperandAt(2); } |
4594 Token::Value token() const { return token_; } | 4544 Token::Value token() const { return token_; } |
4595 | 4545 |
4596 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 4546 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
4597 | 4547 |
4598 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 4548 Representation RequiredInputRepresentation(int index) OVERRIDE { |
4599 return Representation::Tagged(); | 4549 return Representation::Tagged(); |
4600 } | 4550 } |
4601 | 4551 |
4602 Representation GetInputRepresentation() const { | 4552 Representation GetInputRepresentation() const { |
4603 return Representation::Tagged(); | 4553 return Representation::Tagged(); |
4604 } | 4554 } |
4605 | 4555 |
4606 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch) | 4556 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch) |
4607 | 4557 |
4608 private: | 4558 private: |
(...skipping 11 matching lines...) Expand all Loading... |
4620 } | 4570 } |
4621 | 4571 |
4622 Token::Value token_; | 4572 Token::Value token_; |
4623 }; | 4573 }; |
4624 | 4574 |
4625 | 4575 |
4626 class HIsConstructCallAndBranch : public HTemplateControlInstruction<2, 0> { | 4576 class HIsConstructCallAndBranch : public HTemplateControlInstruction<2, 0> { |
4627 public: | 4577 public: |
4628 DECLARE_INSTRUCTION_FACTORY_P0(HIsConstructCallAndBranch); | 4578 DECLARE_INSTRUCTION_FACTORY_P0(HIsConstructCallAndBranch); |
4629 | 4579 |
4630 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 4580 Representation RequiredInputRepresentation(int index) OVERRIDE { |
4631 return Representation::None(); | 4581 return Representation::None(); |
4632 } | 4582 } |
4633 | 4583 |
4634 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch) | 4584 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch) |
4635 private: | 4585 private: |
4636 HIsConstructCallAndBranch() {} | 4586 HIsConstructCallAndBranch() {} |
4637 }; | 4587 }; |
4638 | 4588 |
4639 | 4589 |
4640 class HHasInstanceTypeAndBranch FINAL : public HUnaryControlInstruction { | 4590 class HHasInstanceTypeAndBranch FINAL : public HUnaryControlInstruction { |
4641 public: | 4591 public: |
4642 DECLARE_INSTRUCTION_FACTORY_P2( | 4592 DECLARE_INSTRUCTION_FACTORY_P2( |
4643 HHasInstanceTypeAndBranch, HValue*, InstanceType); | 4593 HHasInstanceTypeAndBranch, HValue*, InstanceType); |
4644 DECLARE_INSTRUCTION_FACTORY_P3( | 4594 DECLARE_INSTRUCTION_FACTORY_P3( |
4645 HHasInstanceTypeAndBranch, HValue*, InstanceType, InstanceType); | 4595 HHasInstanceTypeAndBranch, HValue*, InstanceType, InstanceType); |
4646 | 4596 |
4647 InstanceType from() { return from_; } | 4597 InstanceType from() { return from_; } |
4648 InstanceType to() { return to_; } | 4598 InstanceType to() { return to_; } |
4649 | 4599 |
4650 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 4600 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
4651 | 4601 |
4652 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 4602 Representation RequiredInputRepresentation(int index) OVERRIDE { |
4653 return Representation::Tagged(); | 4603 return Representation::Tagged(); |
4654 } | 4604 } |
4655 | 4605 |
4656 virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; | 4606 bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; |
4657 | 4607 |
4658 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch) | 4608 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch) |
4659 | 4609 |
4660 private: | 4610 private: |
4661 HHasInstanceTypeAndBranch(HValue* value, InstanceType type) | 4611 HHasInstanceTypeAndBranch(HValue* value, InstanceType type) |
4662 : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { } | 4612 : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { } |
4663 HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to) | 4613 HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to) |
4664 : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) { | 4614 : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) { |
4665 DCHECK(to == LAST_TYPE); // Others not implemented yet in backend. | 4615 DCHECK(to == LAST_TYPE); // Others not implemented yet in backend. |
4666 } | 4616 } |
4667 | 4617 |
4668 InstanceType from_; | 4618 InstanceType from_; |
4669 InstanceType to_; // Inclusive range, not all combinations work. | 4619 InstanceType to_; // Inclusive range, not all combinations work. |
4670 }; | 4620 }; |
4671 | 4621 |
4672 | 4622 |
4673 class HHasCachedArrayIndexAndBranch FINAL : public HUnaryControlInstruction { | 4623 class HHasCachedArrayIndexAndBranch FINAL : public HUnaryControlInstruction { |
4674 public: | 4624 public: |
4675 DECLARE_INSTRUCTION_FACTORY_P1(HHasCachedArrayIndexAndBranch, HValue*); | 4625 DECLARE_INSTRUCTION_FACTORY_P1(HHasCachedArrayIndexAndBranch, HValue*); |
4676 | 4626 |
4677 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 4627 Representation RequiredInputRepresentation(int index) OVERRIDE { |
4678 return Representation::Tagged(); | 4628 return Representation::Tagged(); |
4679 } | 4629 } |
4680 | 4630 |
4681 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch) | 4631 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch) |
4682 private: | 4632 private: |
4683 explicit HHasCachedArrayIndexAndBranch(HValue* value) | 4633 explicit HHasCachedArrayIndexAndBranch(HValue* value) |
4684 : HUnaryControlInstruction(value, NULL, NULL) { } | 4634 : HUnaryControlInstruction(value, NULL, NULL) { } |
4685 }; | 4635 }; |
4686 | 4636 |
4687 | 4637 |
4688 class HGetCachedArrayIndex FINAL : public HUnaryOperation { | 4638 class HGetCachedArrayIndex FINAL : public HUnaryOperation { |
4689 public: | 4639 public: |
4690 DECLARE_INSTRUCTION_FACTORY_P1(HGetCachedArrayIndex, HValue*); | 4640 DECLARE_INSTRUCTION_FACTORY_P1(HGetCachedArrayIndex, HValue*); |
4691 | 4641 |
4692 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 4642 Representation RequiredInputRepresentation(int index) OVERRIDE { |
4693 return Representation::Tagged(); | 4643 return Representation::Tagged(); |
4694 } | 4644 } |
4695 | 4645 |
4696 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex) | 4646 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex) |
4697 | 4647 |
4698 protected: | 4648 protected: |
4699 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 4649 bool DataEquals(HValue* other) OVERRIDE { return true; } |
4700 | 4650 |
4701 private: | 4651 private: |
4702 explicit HGetCachedArrayIndex(HValue* value) : HUnaryOperation(value) { | 4652 explicit HGetCachedArrayIndex(HValue* value) : HUnaryOperation(value) { |
4703 set_representation(Representation::Tagged()); | 4653 set_representation(Representation::Tagged()); |
4704 SetFlag(kUseGVN); | 4654 SetFlag(kUseGVN); |
4705 } | 4655 } |
4706 | 4656 |
4707 virtual bool IsDeletable() const OVERRIDE { return true; } | 4657 bool IsDeletable() const OVERRIDE { return true; } |
4708 }; | 4658 }; |
4709 | 4659 |
4710 | 4660 |
4711 class HClassOfTestAndBranch FINAL : public HUnaryControlInstruction { | 4661 class HClassOfTestAndBranch FINAL : public HUnaryControlInstruction { |
4712 public: | 4662 public: |
4713 DECLARE_INSTRUCTION_FACTORY_P2(HClassOfTestAndBranch, HValue*, | 4663 DECLARE_INSTRUCTION_FACTORY_P2(HClassOfTestAndBranch, HValue*, |
4714 Handle<String>); | 4664 Handle<String>); |
4715 | 4665 |
4716 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch) | 4666 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch) |
4717 | 4667 |
4718 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 4668 Representation RequiredInputRepresentation(int index) OVERRIDE { |
4719 return Representation::Tagged(); | 4669 return Representation::Tagged(); |
4720 } | 4670 } |
4721 | 4671 |
4722 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 4672 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
4723 | 4673 |
4724 Handle<String> class_name() const { return class_name_; } | 4674 Handle<String> class_name() const { return class_name_; } |
4725 | 4675 |
4726 private: | 4676 private: |
4727 HClassOfTestAndBranch(HValue* value, Handle<String> class_name) | 4677 HClassOfTestAndBranch(HValue* value, Handle<String> class_name) |
4728 : HUnaryControlInstruction(value, NULL, NULL), | 4678 : HUnaryControlInstruction(value, NULL, NULL), |
4729 class_name_(class_name) { } | 4679 class_name_(class_name) { } |
4730 | 4680 |
4731 Handle<String> class_name_; | 4681 Handle<String> class_name_; |
4732 }; | 4682 }; |
4733 | 4683 |
4734 | 4684 |
4735 class HTypeofIsAndBranch FINAL : public HUnaryControlInstruction { | 4685 class HTypeofIsAndBranch FINAL : public HUnaryControlInstruction { |
4736 public: | 4686 public: |
4737 DECLARE_INSTRUCTION_FACTORY_P2(HTypeofIsAndBranch, HValue*, Handle<String>); | 4687 DECLARE_INSTRUCTION_FACTORY_P2(HTypeofIsAndBranch, HValue*, Handle<String>); |
4738 | 4688 |
4739 Handle<String> type_literal() const { return type_literal_.handle(); } | 4689 Handle<String> type_literal() const { return type_literal_.handle(); } |
4740 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 4690 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
4741 | 4691 |
4742 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch) | 4692 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch) |
4743 | 4693 |
4744 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 4694 Representation RequiredInputRepresentation(int index) OVERRIDE { |
4745 return Representation::None(); | 4695 return Representation::None(); |
4746 } | 4696 } |
4747 | 4697 |
4748 virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; | 4698 bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; |
4749 | 4699 |
4750 virtual void FinalizeUniqueness() OVERRIDE { | 4700 void FinalizeUniqueness() OVERRIDE { |
4751 type_literal_ = Unique<String>(type_literal_.handle()); | 4701 type_literal_ = Unique<String>(type_literal_.handle()); |
4752 } | 4702 } |
4753 | 4703 |
4754 private: | 4704 private: |
4755 HTypeofIsAndBranch(HValue* value, Handle<String> type_literal) | 4705 HTypeofIsAndBranch(HValue* value, Handle<String> type_literal) |
4756 : HUnaryControlInstruction(value, NULL, NULL), | 4706 : HUnaryControlInstruction(value, NULL, NULL), |
4757 type_literal_(Unique<String>::CreateUninitialized(type_literal)) { } | 4707 type_literal_(Unique<String>::CreateUninitialized(type_literal)) { } |
4758 | 4708 |
4759 Unique<String> type_literal_; | 4709 Unique<String> type_literal_; |
4760 }; | 4710 }; |
4761 | 4711 |
4762 | 4712 |
4763 class HInstanceOf FINAL : public HBinaryOperation { | 4713 class HInstanceOf FINAL : public HBinaryOperation { |
4764 public: | 4714 public: |
4765 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOf, HValue*, HValue*); | 4715 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOf, HValue*, HValue*); |
4766 | 4716 |
4767 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 4717 Representation RequiredInputRepresentation(int index) OVERRIDE { |
4768 return Representation::Tagged(); | 4718 return Representation::Tagged(); |
4769 } | 4719 } |
4770 | 4720 |
4771 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 4721 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
4772 | 4722 |
4773 DECLARE_CONCRETE_INSTRUCTION(InstanceOf) | 4723 DECLARE_CONCRETE_INSTRUCTION(InstanceOf) |
4774 | 4724 |
4775 private: | 4725 private: |
4776 HInstanceOf(HValue* context, HValue* left, HValue* right) | 4726 HInstanceOf(HValue* context, HValue* left, HValue* right) |
4777 : HBinaryOperation(context, left, right, HType::Boolean()) { | 4727 : HBinaryOperation(context, left, right, HType::Boolean()) { |
4778 set_representation(Representation::Tagged()); | 4728 set_representation(Representation::Tagged()); |
4779 SetAllSideEffects(); | 4729 SetAllSideEffects(); |
4780 } | 4730 } |
4781 }; | 4731 }; |
4782 | 4732 |
4783 | 4733 |
4784 class HInstanceOfKnownGlobal FINAL : public HTemplateInstruction<2> { | 4734 class HInstanceOfKnownGlobal FINAL : public HTemplateInstruction<2> { |
4785 public: | 4735 public: |
4786 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOfKnownGlobal, | 4736 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOfKnownGlobal, |
4787 HValue*, | 4737 HValue*, |
4788 Handle<JSFunction>); | 4738 Handle<JSFunction>); |
4789 | 4739 |
4790 HValue* context() { return OperandAt(0); } | 4740 HValue* context() { return OperandAt(0); } |
4791 HValue* left() { return OperandAt(1); } | 4741 HValue* left() { return OperandAt(1); } |
4792 Handle<JSFunction> function() { return function_; } | 4742 Handle<JSFunction> function() { return function_; } |
4793 | 4743 |
4794 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 4744 Representation RequiredInputRepresentation(int index) OVERRIDE { |
4795 return Representation::Tagged(); | 4745 return Representation::Tagged(); |
4796 } | 4746 } |
4797 | 4747 |
4798 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal) | 4748 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal) |
4799 | 4749 |
4800 private: | 4750 private: |
4801 HInstanceOfKnownGlobal(HValue* context, | 4751 HInstanceOfKnownGlobal(HValue* context, |
4802 HValue* left, | 4752 HValue* left, |
4803 Handle<JSFunction> right) | 4753 Handle<JSFunction> right) |
4804 : HTemplateInstruction<2>(HType::Boolean()), function_(right) { | 4754 : HTemplateInstruction<2>(HType::Boolean()), function_(right) { |
(...skipping 10 matching lines...) Expand all Loading... |
4815 class HPower FINAL : public HTemplateInstruction<2> { | 4765 class HPower FINAL : public HTemplateInstruction<2> { |
4816 public: | 4766 public: |
4817 static HInstruction* New(Zone* zone, | 4767 static HInstruction* New(Zone* zone, |
4818 HValue* context, | 4768 HValue* context, |
4819 HValue* left, | 4769 HValue* left, |
4820 HValue* right); | 4770 HValue* right); |
4821 | 4771 |
4822 HValue* left() { return OperandAt(0); } | 4772 HValue* left() { return OperandAt(0); } |
4823 HValue* right() const { return OperandAt(1); } | 4773 HValue* right() const { return OperandAt(1); } |
4824 | 4774 |
4825 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 4775 Representation RequiredInputRepresentation(int index) OVERRIDE { |
4826 return index == 0 | 4776 return index == 0 |
4827 ? Representation::Double() | 4777 ? Representation::Double() |
4828 : Representation::None(); | 4778 : Representation::None(); |
4829 } | 4779 } |
4830 virtual Representation observed_input_representation(int index) OVERRIDE { | 4780 Representation observed_input_representation(int index) OVERRIDE { |
4831 return RequiredInputRepresentation(index); | 4781 return RequiredInputRepresentation(index); |
4832 } | 4782 } |
4833 | 4783 |
4834 DECLARE_CONCRETE_INSTRUCTION(Power) | 4784 DECLARE_CONCRETE_INSTRUCTION(Power) |
4835 | 4785 |
4836 protected: | 4786 protected: |
4837 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 4787 bool DataEquals(HValue* other) OVERRIDE { return true; } |
4838 | 4788 |
4839 private: | 4789 private: |
4840 HPower(HValue* left, HValue* right) { | 4790 HPower(HValue* left, HValue* right) { |
4841 SetOperandAt(0, left); | 4791 SetOperandAt(0, left); |
4842 SetOperandAt(1, right); | 4792 SetOperandAt(1, right); |
4843 set_representation(Representation::Double()); | 4793 set_representation(Representation::Double()); |
4844 SetFlag(kUseGVN); | 4794 SetFlag(kUseGVN); |
4845 SetChangesFlag(kNewSpacePromotion); | 4795 SetChangesFlag(kNewSpacePromotion); |
4846 } | 4796 } |
4847 | 4797 |
4848 virtual bool IsDeletable() const OVERRIDE { | 4798 bool IsDeletable() const OVERRIDE { |
4849 return !right()->representation().IsTagged(); | 4799 return !right()->representation().IsTagged(); |
4850 } | 4800 } |
4851 }; | 4801 }; |
4852 | 4802 |
4853 | 4803 |
4854 class HAdd FINAL : public HArithmeticBinaryOperation { | 4804 class HAdd FINAL : public HArithmeticBinaryOperation { |
4855 public: | 4805 public: |
4856 static HInstruction* New(Zone* zone, | 4806 static HInstruction* New(Zone* zone, |
4857 HValue* context, | 4807 HValue* context, |
4858 HValue* left, | 4808 HValue* left, |
4859 HValue* right); | 4809 HValue* right); |
4860 | 4810 |
4861 // Add is only commutative if two integer values are added and not if two | 4811 // Add is only commutative if two integer values are added and not if two |
4862 // tagged values are added (because it might be a String concatenation). | 4812 // tagged values are added (because it might be a String concatenation). |
4863 // We also do not commute (pointer + offset). | 4813 // We also do not commute (pointer + offset). |
4864 virtual bool IsCommutative() const OVERRIDE { | 4814 bool IsCommutative() const OVERRIDE { |
4865 return !representation().IsTagged() && !representation().IsExternal(); | 4815 return !representation().IsTagged() && !representation().IsExternal(); |
4866 } | 4816 } |
4867 | 4817 |
4868 virtual HValue* Canonicalize() OVERRIDE; | 4818 HValue* Canonicalize() OVERRIDE; |
4869 | 4819 |
4870 virtual bool TryDecompose(DecompositionResult* decomposition) OVERRIDE { | 4820 bool TryDecompose(DecompositionResult* decomposition) OVERRIDE { |
4871 if (left()->IsInteger32Constant()) { | 4821 if (left()->IsInteger32Constant()) { |
4872 decomposition->Apply(right(), left()->GetInteger32Constant()); | 4822 decomposition->Apply(right(), left()->GetInteger32Constant()); |
4873 return true; | 4823 return true; |
4874 } else if (right()->IsInteger32Constant()) { | 4824 } else if (right()->IsInteger32Constant()) { |
4875 decomposition->Apply(left(), right()->GetInteger32Constant()); | 4825 decomposition->Apply(left(), right()->GetInteger32Constant()); |
4876 return true; | 4826 return true; |
4877 } else { | 4827 } else { |
4878 return false; | 4828 return false; |
4879 } | 4829 } |
4880 } | 4830 } |
4881 | 4831 |
4882 virtual void RepresentationChanged(Representation to) OVERRIDE { | 4832 void RepresentationChanged(Representation to) OVERRIDE { |
4883 if (to.IsTagged() && | 4833 if (to.IsTagged() && |
4884 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() || | 4834 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() || |
4885 left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) { | 4835 left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) { |
4886 SetAllSideEffects(); | 4836 SetAllSideEffects(); |
4887 ClearFlag(kUseGVN); | 4837 ClearFlag(kUseGVN); |
4888 } else { | 4838 } else { |
4889 ClearAllSideEffects(); | 4839 ClearAllSideEffects(); |
4890 SetFlag(kUseGVN); | 4840 SetFlag(kUseGVN); |
4891 } | 4841 } |
4892 if (to.IsTagged()) { | 4842 if (to.IsTagged()) { |
4893 SetChangesFlag(kNewSpacePromotion); | 4843 SetChangesFlag(kNewSpacePromotion); |
4894 ClearFlag(kAllowUndefinedAsNaN); | 4844 ClearFlag(kAllowUndefinedAsNaN); |
4895 } | 4845 } |
4896 } | 4846 } |
4897 | 4847 |
4898 virtual Representation RepresentationFromInputs() OVERRIDE; | 4848 Representation RepresentationFromInputs() OVERRIDE; |
4899 | 4849 |
4900 virtual Representation RequiredInputRepresentation(int index) OVERRIDE; | 4850 Representation RequiredInputRepresentation(int index) OVERRIDE; |
4901 | 4851 |
4902 DECLARE_CONCRETE_INSTRUCTION(Add) | 4852 DECLARE_CONCRETE_INSTRUCTION(Add) |
4903 | 4853 |
4904 protected: | 4854 protected: |
4905 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 4855 bool DataEquals(HValue* other) OVERRIDE { return true; } |
4906 | 4856 |
4907 virtual Range* InferRange(Zone* zone) OVERRIDE; | 4857 Range* InferRange(Zone* zone) OVERRIDE; |
4908 | 4858 |
4909 private: | 4859 private: |
4910 HAdd(HValue* context, HValue* left, HValue* right) | 4860 HAdd(HValue* context, HValue* left, HValue* right) |
4911 : HArithmeticBinaryOperation(context, left, right) { | 4861 : HArithmeticBinaryOperation(context, left, right) { |
4912 SetFlag(kCanOverflow); | 4862 SetFlag(kCanOverflow); |
4913 } | 4863 } |
4914 }; | 4864 }; |
4915 | 4865 |
4916 | 4866 |
4917 class HSub FINAL : public HArithmeticBinaryOperation { | 4867 class HSub FINAL : public HArithmeticBinaryOperation { |
4918 public: | 4868 public: |
4919 static HInstruction* New(Zone* zone, | 4869 static HInstruction* New(Zone* zone, |
4920 HValue* context, | 4870 HValue* context, |
4921 HValue* left, | 4871 HValue* left, |
4922 HValue* right); | 4872 HValue* right); |
4923 | 4873 |
4924 virtual HValue* Canonicalize() OVERRIDE; | 4874 HValue* Canonicalize() OVERRIDE; |
4925 | 4875 |
4926 virtual bool TryDecompose(DecompositionResult* decomposition) OVERRIDE { | 4876 bool TryDecompose(DecompositionResult* decomposition) OVERRIDE { |
4927 if (right()->IsInteger32Constant()) { | 4877 if (right()->IsInteger32Constant()) { |
4928 decomposition->Apply(left(), -right()->GetInteger32Constant()); | 4878 decomposition->Apply(left(), -right()->GetInteger32Constant()); |
4929 return true; | 4879 return true; |
4930 } else { | 4880 } else { |
4931 return false; | 4881 return false; |
4932 } | 4882 } |
4933 } | 4883 } |
4934 | 4884 |
4935 DECLARE_CONCRETE_INSTRUCTION(Sub) | 4885 DECLARE_CONCRETE_INSTRUCTION(Sub) |
4936 | 4886 |
4937 protected: | 4887 protected: |
4938 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 4888 bool DataEquals(HValue* other) OVERRIDE { return true; } |
4939 | 4889 |
4940 virtual Range* InferRange(Zone* zone) OVERRIDE; | 4890 Range* InferRange(Zone* zone) OVERRIDE; |
4941 | 4891 |
4942 private: | 4892 private: |
4943 HSub(HValue* context, HValue* left, HValue* right) | 4893 HSub(HValue* context, HValue* left, HValue* right) |
4944 : HArithmeticBinaryOperation(context, left, right) { | 4894 : HArithmeticBinaryOperation(context, left, right) { |
4945 SetFlag(kCanOverflow); | 4895 SetFlag(kCanOverflow); |
4946 } | 4896 } |
4947 }; | 4897 }; |
4948 | 4898 |
4949 | 4899 |
4950 class HMul FINAL : public HArithmeticBinaryOperation { | 4900 class HMul FINAL : public HArithmeticBinaryOperation { |
4951 public: | 4901 public: |
4952 static HInstruction* New(Zone* zone, | 4902 static HInstruction* New(Zone* zone, |
4953 HValue* context, | 4903 HValue* context, |
4954 HValue* left, | 4904 HValue* left, |
4955 HValue* right); | 4905 HValue* right); |
4956 | 4906 |
4957 static HInstruction* NewImul(Zone* zone, | 4907 static HInstruction* NewImul(Zone* zone, |
4958 HValue* context, | 4908 HValue* context, |
4959 HValue* left, | 4909 HValue* left, |
4960 HValue* right) { | 4910 HValue* right) { |
4961 HInstruction* instr = HMul::New(zone, context, left, right); | 4911 HInstruction* instr = HMul::New(zone, context, left, right); |
4962 if (!instr->IsMul()) return instr; | 4912 if (!instr->IsMul()) return instr; |
4963 HMul* mul = HMul::cast(instr); | 4913 HMul* mul = HMul::cast(instr); |
4964 // TODO(mstarzinger): Prevent bailout on minus zero for imul. | 4914 // TODO(mstarzinger): Prevent bailout on minus zero for imul. |
4965 mul->AssumeRepresentation(Representation::Integer32()); | 4915 mul->AssumeRepresentation(Representation::Integer32()); |
4966 mul->ClearFlag(HValue::kCanOverflow); | 4916 mul->ClearFlag(HValue::kCanOverflow); |
4967 return mul; | 4917 return mul; |
4968 } | 4918 } |
4969 | 4919 |
4970 virtual HValue* Canonicalize() OVERRIDE; | 4920 HValue* Canonicalize() OVERRIDE; |
4971 | 4921 |
4972 // Only commutative if it is certain that not two objects are multiplicated. | 4922 // Only commutative if it is certain that not two objects are multiplicated. |
4973 virtual bool IsCommutative() const OVERRIDE { | 4923 bool IsCommutative() const OVERRIDE { return !representation().IsTagged(); } |
4974 return !representation().IsTagged(); | |
4975 } | |
4976 | 4924 |
4977 virtual void UpdateRepresentation(Representation new_rep, | 4925 virtual void UpdateRepresentation(Representation new_rep, |
4978 HInferRepresentationPhase* h_infer, | 4926 HInferRepresentationPhase* h_infer, |
4979 const char* reason) OVERRIDE { | 4927 const char* reason) OVERRIDE { |
4980 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4928 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
4981 } | 4929 } |
4982 | 4930 |
4983 bool MulMinusOne(); | 4931 bool MulMinusOne(); |
4984 | 4932 |
4985 DECLARE_CONCRETE_INSTRUCTION(Mul) | 4933 DECLARE_CONCRETE_INSTRUCTION(Mul) |
4986 | 4934 |
4987 protected: | 4935 protected: |
4988 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 4936 bool DataEquals(HValue* other) OVERRIDE { return true; } |
4989 | 4937 |
4990 virtual Range* InferRange(Zone* zone) OVERRIDE; | 4938 Range* InferRange(Zone* zone) OVERRIDE; |
4991 | 4939 |
4992 private: | 4940 private: |
4993 HMul(HValue* context, HValue* left, HValue* right) | 4941 HMul(HValue* context, HValue* left, HValue* right) |
4994 : HArithmeticBinaryOperation(context, left, right) { | 4942 : HArithmeticBinaryOperation(context, left, right) { |
4995 SetFlag(kCanOverflow); | 4943 SetFlag(kCanOverflow); |
4996 } | 4944 } |
4997 }; | 4945 }; |
4998 | 4946 |
4999 | 4947 |
5000 class HMod FINAL : public HArithmeticBinaryOperation { | 4948 class HMod FINAL : public HArithmeticBinaryOperation { |
5001 public: | 4949 public: |
5002 static HInstruction* New(Zone* zone, | 4950 static HInstruction* New(Zone* zone, |
5003 HValue* context, | 4951 HValue* context, |
5004 HValue* left, | 4952 HValue* left, |
5005 HValue* right); | 4953 HValue* right); |
5006 | 4954 |
5007 virtual HValue* Canonicalize() OVERRIDE; | 4955 HValue* Canonicalize() OVERRIDE; |
5008 | 4956 |
5009 virtual void UpdateRepresentation(Representation new_rep, | 4957 virtual void UpdateRepresentation(Representation new_rep, |
5010 HInferRepresentationPhase* h_infer, | 4958 HInferRepresentationPhase* h_infer, |
5011 const char* reason) OVERRIDE { | 4959 const char* reason) OVERRIDE { |
5012 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 4960 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
5013 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4961 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
5014 } | 4962 } |
5015 | 4963 |
5016 DECLARE_CONCRETE_INSTRUCTION(Mod) | 4964 DECLARE_CONCRETE_INSTRUCTION(Mod) |
5017 | 4965 |
5018 protected: | 4966 protected: |
5019 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 4967 bool DataEquals(HValue* other) OVERRIDE { return true; } |
5020 | 4968 |
5021 virtual Range* InferRange(Zone* zone) OVERRIDE; | 4969 Range* InferRange(Zone* zone) OVERRIDE; |
5022 | 4970 |
5023 private: | 4971 private: |
5024 HMod(HValue* context, | 4972 HMod(HValue* context, |
5025 HValue* left, | 4973 HValue* left, |
5026 HValue* right) : HArithmeticBinaryOperation(context, left, right) { | 4974 HValue* right) : HArithmeticBinaryOperation(context, left, right) { |
5027 SetFlag(kCanBeDivByZero); | 4975 SetFlag(kCanBeDivByZero); |
5028 SetFlag(kCanOverflow); | 4976 SetFlag(kCanOverflow); |
5029 SetFlag(kLeftCanBeNegative); | 4977 SetFlag(kLeftCanBeNegative); |
5030 } | 4978 } |
5031 }; | 4979 }; |
5032 | 4980 |
5033 | 4981 |
5034 class HDiv FINAL : public HArithmeticBinaryOperation { | 4982 class HDiv FINAL : public HArithmeticBinaryOperation { |
5035 public: | 4983 public: |
5036 static HInstruction* New(Zone* zone, | 4984 static HInstruction* New(Zone* zone, |
5037 HValue* context, | 4985 HValue* context, |
5038 HValue* left, | 4986 HValue* left, |
5039 HValue* right); | 4987 HValue* right); |
5040 | 4988 |
5041 virtual HValue* Canonicalize() OVERRIDE; | 4989 HValue* Canonicalize() OVERRIDE; |
5042 | 4990 |
5043 virtual void UpdateRepresentation(Representation new_rep, | 4991 virtual void UpdateRepresentation(Representation new_rep, |
5044 HInferRepresentationPhase* h_infer, | 4992 HInferRepresentationPhase* h_infer, |
5045 const char* reason) OVERRIDE { | 4993 const char* reason) OVERRIDE { |
5046 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 4994 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
5047 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4995 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
5048 } | 4996 } |
5049 | 4997 |
5050 DECLARE_CONCRETE_INSTRUCTION(Div) | 4998 DECLARE_CONCRETE_INSTRUCTION(Div) |
5051 | 4999 |
5052 protected: | 5000 protected: |
5053 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 5001 bool DataEquals(HValue* other) OVERRIDE { return true; } |
5054 | 5002 |
5055 virtual Range* InferRange(Zone* zone) OVERRIDE; | 5003 Range* InferRange(Zone* zone) OVERRIDE; |
5056 | 5004 |
5057 private: | 5005 private: |
5058 HDiv(HValue* context, HValue* left, HValue* right) | 5006 HDiv(HValue* context, HValue* left, HValue* right) |
5059 : HArithmeticBinaryOperation(context, left, right) { | 5007 : HArithmeticBinaryOperation(context, left, right) { |
5060 SetFlag(kCanBeDivByZero); | 5008 SetFlag(kCanBeDivByZero); |
5061 SetFlag(kCanOverflow); | 5009 SetFlag(kCanOverflow); |
5062 } | 5010 } |
5063 }; | 5011 }; |
5064 | 5012 |
5065 | 5013 |
5066 class HMathMinMax FINAL : public HArithmeticBinaryOperation { | 5014 class HMathMinMax FINAL : public HArithmeticBinaryOperation { |
5067 public: | 5015 public: |
5068 enum Operation { kMathMin, kMathMax }; | 5016 enum Operation { kMathMin, kMathMax }; |
5069 | 5017 |
5070 static HInstruction* New(Zone* zone, | 5018 static HInstruction* New(Zone* zone, |
5071 HValue* context, | 5019 HValue* context, |
5072 HValue* left, | 5020 HValue* left, |
5073 HValue* right, | 5021 HValue* right, |
5074 Operation op); | 5022 Operation op); |
5075 | 5023 |
5076 virtual Representation observed_input_representation(int index) OVERRIDE { | 5024 Representation observed_input_representation(int index) OVERRIDE { |
5077 return RequiredInputRepresentation(index); | 5025 return RequiredInputRepresentation(index); |
5078 } | 5026 } |
5079 | 5027 |
5080 virtual void InferRepresentation( | 5028 virtual void InferRepresentation( |
5081 HInferRepresentationPhase* h_infer) OVERRIDE; | 5029 HInferRepresentationPhase* h_infer) OVERRIDE; |
5082 | 5030 |
5083 virtual Representation RepresentationFromInputs() OVERRIDE { | 5031 Representation RepresentationFromInputs() OVERRIDE { |
5084 Representation left_rep = left()->representation(); | 5032 Representation left_rep = left()->representation(); |
5085 Representation right_rep = right()->representation(); | 5033 Representation right_rep = right()->representation(); |
5086 Representation result = Representation::Smi(); | 5034 Representation result = Representation::Smi(); |
5087 result = result.generalize(left_rep); | 5035 result = result.generalize(left_rep); |
5088 result = result.generalize(right_rep); | 5036 result = result.generalize(right_rep); |
5089 if (result.IsTagged()) return Representation::Double(); | 5037 if (result.IsTagged()) return Representation::Double(); |
5090 return result; | 5038 return result; |
5091 } | 5039 } |
5092 | 5040 |
5093 virtual bool IsCommutative() const OVERRIDE { return true; } | 5041 bool IsCommutative() const OVERRIDE { return true; } |
5094 | 5042 |
5095 Operation operation() { return operation_; } | 5043 Operation operation() { return operation_; } |
5096 | 5044 |
5097 DECLARE_CONCRETE_INSTRUCTION(MathMinMax) | 5045 DECLARE_CONCRETE_INSTRUCTION(MathMinMax) |
5098 | 5046 |
5099 protected: | 5047 protected: |
5100 virtual bool DataEquals(HValue* other) OVERRIDE { | 5048 bool DataEquals(HValue* other) OVERRIDE { |
5101 return other->IsMathMinMax() && | 5049 return other->IsMathMinMax() && |
5102 HMathMinMax::cast(other)->operation_ == operation_; | 5050 HMathMinMax::cast(other)->operation_ == operation_; |
5103 } | 5051 } |
5104 | 5052 |
5105 virtual Range* InferRange(Zone* zone) OVERRIDE; | 5053 Range* InferRange(Zone* zone) OVERRIDE; |
5106 | 5054 |
5107 private: | 5055 private: |
5108 HMathMinMax(HValue* context, HValue* left, HValue* right, Operation op) | 5056 HMathMinMax(HValue* context, HValue* left, HValue* right, Operation op) |
5109 : HArithmeticBinaryOperation(context, left, right), | 5057 : HArithmeticBinaryOperation(context, left, right), |
5110 operation_(op) { } | 5058 operation_(op) { } |
5111 | 5059 |
5112 Operation operation_; | 5060 Operation operation_; |
5113 }; | 5061 }; |
5114 | 5062 |
5115 | 5063 |
5116 class HBitwise FINAL : public HBitwiseBinaryOperation { | 5064 class HBitwise FINAL : public HBitwiseBinaryOperation { |
5117 public: | 5065 public: |
5118 static HInstruction* New(Zone* zone, | 5066 static HInstruction* New(Zone* zone, |
5119 HValue* context, | 5067 HValue* context, |
5120 Token::Value op, | 5068 Token::Value op, |
5121 HValue* left, | 5069 HValue* left, |
5122 HValue* right); | 5070 HValue* right); |
5123 | 5071 |
5124 Token::Value op() const { return op_; } | 5072 Token::Value op() const { return op_; } |
5125 | 5073 |
5126 virtual bool IsCommutative() const OVERRIDE { return true; } | 5074 bool IsCommutative() const OVERRIDE { return true; } |
5127 | 5075 |
5128 virtual HValue* Canonicalize() OVERRIDE; | 5076 HValue* Canonicalize() OVERRIDE; |
5129 | 5077 |
5130 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 5078 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
5131 | 5079 |
5132 DECLARE_CONCRETE_INSTRUCTION(Bitwise) | 5080 DECLARE_CONCRETE_INSTRUCTION(Bitwise) |
5133 | 5081 |
5134 protected: | 5082 protected: |
5135 virtual bool DataEquals(HValue* other) OVERRIDE { | 5083 bool DataEquals(HValue* other) OVERRIDE { |
5136 return op() == HBitwise::cast(other)->op(); | 5084 return op() == HBitwise::cast(other)->op(); |
5137 } | 5085 } |
5138 | 5086 |
5139 virtual Range* InferRange(Zone* zone) OVERRIDE; | 5087 Range* InferRange(Zone* zone) OVERRIDE; |
5140 | 5088 |
5141 private: | 5089 private: |
5142 HBitwise(HValue* context, | 5090 HBitwise(HValue* context, |
5143 Token::Value op, | 5091 Token::Value op, |
5144 HValue* left, | 5092 HValue* left, |
5145 HValue* right) | 5093 HValue* right) |
5146 : HBitwiseBinaryOperation(context, left, right), | 5094 : HBitwiseBinaryOperation(context, left, right), |
5147 op_(op) { | 5095 op_(op) { |
5148 DCHECK(op == Token::BIT_AND || op == Token::BIT_OR || op == Token::BIT_XOR); | 5096 DCHECK(op == Token::BIT_AND || op == Token::BIT_OR || op == Token::BIT_XOR); |
5149 // BIT_AND with a smi-range positive value will always unset the | 5097 // BIT_AND with a smi-range positive value will always unset the |
(...skipping 25 matching lines...) Expand all Loading... |
5175 }; | 5123 }; |
5176 | 5124 |
5177 | 5125 |
5178 class HShl FINAL : public HBitwiseBinaryOperation { | 5126 class HShl FINAL : public HBitwiseBinaryOperation { |
5179 public: | 5127 public: |
5180 static HInstruction* New(Zone* zone, | 5128 static HInstruction* New(Zone* zone, |
5181 HValue* context, | 5129 HValue* context, |
5182 HValue* left, | 5130 HValue* left, |
5183 HValue* right); | 5131 HValue* right); |
5184 | 5132 |
5185 virtual Range* InferRange(Zone* zone) OVERRIDE; | 5133 Range* InferRange(Zone* zone) OVERRIDE; |
5186 | 5134 |
5187 virtual void UpdateRepresentation(Representation new_rep, | 5135 virtual void UpdateRepresentation(Representation new_rep, |
5188 HInferRepresentationPhase* h_infer, | 5136 HInferRepresentationPhase* h_infer, |
5189 const char* reason) OVERRIDE { | 5137 const char* reason) OVERRIDE { |
5190 if (new_rep.IsSmi() && | 5138 if (new_rep.IsSmi() && |
5191 !(right()->IsInteger32Constant() && | 5139 !(right()->IsInteger32Constant() && |
5192 right()->GetInteger32Constant() >= 0)) { | 5140 right()->GetInteger32Constant() >= 0)) { |
5193 new_rep = Representation::Integer32(); | 5141 new_rep = Representation::Integer32(); |
5194 } | 5142 } |
5195 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 5143 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
5196 } | 5144 } |
5197 | 5145 |
5198 DECLARE_CONCRETE_INSTRUCTION(Shl) | 5146 DECLARE_CONCRETE_INSTRUCTION(Shl) |
5199 | 5147 |
5200 protected: | 5148 protected: |
5201 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 5149 bool DataEquals(HValue* other) OVERRIDE { return true; } |
5202 | 5150 |
5203 private: | 5151 private: |
5204 HShl(HValue* context, HValue* left, HValue* right) | 5152 HShl(HValue* context, HValue* left, HValue* right) |
5205 : HBitwiseBinaryOperation(context, left, right) { } | 5153 : HBitwiseBinaryOperation(context, left, right) { } |
5206 }; | 5154 }; |
5207 | 5155 |
5208 | 5156 |
5209 class HShr FINAL : public HBitwiseBinaryOperation { | 5157 class HShr FINAL : public HBitwiseBinaryOperation { |
5210 public: | 5158 public: |
5211 static HInstruction* New(Zone* zone, | 5159 static HInstruction* New(Zone* zone, |
5212 HValue* context, | 5160 HValue* context, |
5213 HValue* left, | 5161 HValue* left, |
5214 HValue* right); | 5162 HValue* right); |
5215 | 5163 |
5216 virtual bool TryDecompose(DecompositionResult* decomposition) OVERRIDE { | 5164 bool TryDecompose(DecompositionResult* decomposition) OVERRIDE { |
5217 if (right()->IsInteger32Constant()) { | 5165 if (right()->IsInteger32Constant()) { |
5218 if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) { | 5166 if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) { |
5219 // This is intended to look for HAdd and HSub, to handle compounds | 5167 // This is intended to look for HAdd and HSub, to handle compounds |
5220 // like ((base + offset) >> scale) with one single decomposition. | 5168 // like ((base + offset) >> scale) with one single decomposition. |
5221 left()->TryDecompose(decomposition); | 5169 left()->TryDecompose(decomposition); |
5222 return true; | 5170 return true; |
5223 } | 5171 } |
5224 } | 5172 } |
5225 return false; | 5173 return false; |
5226 } | 5174 } |
5227 | 5175 |
5228 virtual Range* InferRange(Zone* zone) OVERRIDE; | 5176 Range* InferRange(Zone* zone) OVERRIDE; |
5229 | 5177 |
5230 virtual void UpdateRepresentation(Representation new_rep, | 5178 virtual void UpdateRepresentation(Representation new_rep, |
5231 HInferRepresentationPhase* h_infer, | 5179 HInferRepresentationPhase* h_infer, |
5232 const char* reason) OVERRIDE { | 5180 const char* reason) OVERRIDE { |
5233 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 5181 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
5234 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 5182 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
5235 } | 5183 } |
5236 | 5184 |
5237 DECLARE_CONCRETE_INSTRUCTION(Shr) | 5185 DECLARE_CONCRETE_INSTRUCTION(Shr) |
5238 | 5186 |
5239 protected: | 5187 protected: |
5240 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 5188 bool DataEquals(HValue* other) OVERRIDE { return true; } |
5241 | 5189 |
5242 private: | 5190 private: |
5243 HShr(HValue* context, HValue* left, HValue* right) | 5191 HShr(HValue* context, HValue* left, HValue* right) |
5244 : HBitwiseBinaryOperation(context, left, right) { } | 5192 : HBitwiseBinaryOperation(context, left, right) { } |
5245 }; | 5193 }; |
5246 | 5194 |
5247 | 5195 |
5248 class HSar FINAL : public HBitwiseBinaryOperation { | 5196 class HSar FINAL : public HBitwiseBinaryOperation { |
5249 public: | 5197 public: |
5250 static HInstruction* New(Zone* zone, | 5198 static HInstruction* New(Zone* zone, |
5251 HValue* context, | 5199 HValue* context, |
5252 HValue* left, | 5200 HValue* left, |
5253 HValue* right); | 5201 HValue* right); |
5254 | 5202 |
5255 virtual bool TryDecompose(DecompositionResult* decomposition) OVERRIDE { | 5203 bool TryDecompose(DecompositionResult* decomposition) OVERRIDE { |
5256 if (right()->IsInteger32Constant()) { | 5204 if (right()->IsInteger32Constant()) { |
5257 if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) { | 5205 if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) { |
5258 // This is intended to look for HAdd and HSub, to handle compounds | 5206 // This is intended to look for HAdd and HSub, to handle compounds |
5259 // like ((base + offset) >> scale) with one single decomposition. | 5207 // like ((base + offset) >> scale) with one single decomposition. |
5260 left()->TryDecompose(decomposition); | 5208 left()->TryDecompose(decomposition); |
5261 return true; | 5209 return true; |
5262 } | 5210 } |
5263 } | 5211 } |
5264 return false; | 5212 return false; |
5265 } | 5213 } |
5266 | 5214 |
5267 virtual Range* InferRange(Zone* zone) OVERRIDE; | 5215 Range* InferRange(Zone* zone) OVERRIDE; |
5268 | 5216 |
5269 virtual void UpdateRepresentation(Representation new_rep, | 5217 virtual void UpdateRepresentation(Representation new_rep, |
5270 HInferRepresentationPhase* h_infer, | 5218 HInferRepresentationPhase* h_infer, |
5271 const char* reason) OVERRIDE { | 5219 const char* reason) OVERRIDE { |
5272 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 5220 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
5273 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 5221 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
5274 } | 5222 } |
5275 | 5223 |
5276 DECLARE_CONCRETE_INSTRUCTION(Sar) | 5224 DECLARE_CONCRETE_INSTRUCTION(Sar) |
5277 | 5225 |
5278 protected: | 5226 protected: |
5279 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 5227 bool DataEquals(HValue* other) OVERRIDE { return true; } |
5280 | 5228 |
5281 private: | 5229 private: |
5282 HSar(HValue* context, HValue* left, HValue* right) | 5230 HSar(HValue* context, HValue* left, HValue* right) |
5283 : HBitwiseBinaryOperation(context, left, right) { } | 5231 : HBitwiseBinaryOperation(context, left, right) { } |
5284 }; | 5232 }; |
5285 | 5233 |
5286 | 5234 |
5287 class HRor FINAL : public HBitwiseBinaryOperation { | 5235 class HRor FINAL : public HBitwiseBinaryOperation { |
5288 public: | 5236 public: |
5289 static HInstruction* New(Zone* zone, | 5237 static HInstruction* New(Zone* zone, |
5290 HValue* context, | 5238 HValue* context, |
5291 HValue* left, | 5239 HValue* left, |
5292 HValue* right) { | 5240 HValue* right) { |
5293 return new(zone) HRor(context, left, right); | 5241 return new(zone) HRor(context, left, right); |
5294 } | 5242 } |
5295 | 5243 |
5296 virtual void UpdateRepresentation(Representation new_rep, | 5244 virtual void UpdateRepresentation(Representation new_rep, |
5297 HInferRepresentationPhase* h_infer, | 5245 HInferRepresentationPhase* h_infer, |
5298 const char* reason) OVERRIDE { | 5246 const char* reason) OVERRIDE { |
5299 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 5247 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
5300 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 5248 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
5301 } | 5249 } |
5302 | 5250 |
5303 DECLARE_CONCRETE_INSTRUCTION(Ror) | 5251 DECLARE_CONCRETE_INSTRUCTION(Ror) |
5304 | 5252 |
5305 protected: | 5253 protected: |
5306 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 5254 bool DataEquals(HValue* other) OVERRIDE { return true; } |
5307 | 5255 |
5308 private: | 5256 private: |
5309 HRor(HValue* context, HValue* left, HValue* right) | 5257 HRor(HValue* context, HValue* left, HValue* right) |
5310 : HBitwiseBinaryOperation(context, left, right) { | 5258 : HBitwiseBinaryOperation(context, left, right) { |
5311 ChangeRepresentation(Representation::Integer32()); | 5259 ChangeRepresentation(Representation::Integer32()); |
5312 } | 5260 } |
5313 }; | 5261 }; |
5314 | 5262 |
5315 | 5263 |
5316 class HOsrEntry FINAL : public HTemplateInstruction<0> { | 5264 class HOsrEntry FINAL : public HTemplateInstruction<0> { |
5317 public: | 5265 public: |
5318 DECLARE_INSTRUCTION_FACTORY_P1(HOsrEntry, BailoutId); | 5266 DECLARE_INSTRUCTION_FACTORY_P1(HOsrEntry, BailoutId); |
5319 | 5267 |
5320 BailoutId ast_id() const { return ast_id_; } | 5268 BailoutId ast_id() const { return ast_id_; } |
5321 | 5269 |
5322 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 5270 Representation RequiredInputRepresentation(int index) OVERRIDE { |
5323 return Representation::None(); | 5271 return Representation::None(); |
5324 } | 5272 } |
5325 | 5273 |
5326 DECLARE_CONCRETE_INSTRUCTION(OsrEntry) | 5274 DECLARE_CONCRETE_INSTRUCTION(OsrEntry) |
5327 | 5275 |
5328 private: | 5276 private: |
5329 explicit HOsrEntry(BailoutId ast_id) : ast_id_(ast_id) { | 5277 explicit HOsrEntry(BailoutId ast_id) : ast_id_(ast_id) { |
5330 SetChangesFlag(kOsrEntries); | 5278 SetChangesFlag(kOsrEntries); |
5331 SetChangesFlag(kNewSpacePromotion); | 5279 SetChangesFlag(kNewSpacePromotion); |
5332 } | 5280 } |
(...skipping 10 matching lines...) Expand all Loading... |
5343 }; | 5291 }; |
5344 | 5292 |
5345 DECLARE_INSTRUCTION_FACTORY_P1(HParameter, unsigned); | 5293 DECLARE_INSTRUCTION_FACTORY_P1(HParameter, unsigned); |
5346 DECLARE_INSTRUCTION_FACTORY_P2(HParameter, unsigned, ParameterKind); | 5294 DECLARE_INSTRUCTION_FACTORY_P2(HParameter, unsigned, ParameterKind); |
5347 DECLARE_INSTRUCTION_FACTORY_P3(HParameter, unsigned, ParameterKind, | 5295 DECLARE_INSTRUCTION_FACTORY_P3(HParameter, unsigned, ParameterKind, |
5348 Representation); | 5296 Representation); |
5349 | 5297 |
5350 unsigned index() const { return index_; } | 5298 unsigned index() const { return index_; } |
5351 ParameterKind kind() const { return kind_; } | 5299 ParameterKind kind() const { return kind_; } |
5352 | 5300 |
5353 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 5301 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
5354 | 5302 |
5355 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 5303 Representation RequiredInputRepresentation(int index) OVERRIDE { |
5356 return Representation::None(); | 5304 return Representation::None(); |
5357 } | 5305 } |
5358 | 5306 |
5359 virtual Representation KnownOptimalRepresentation() OVERRIDE { | 5307 Representation KnownOptimalRepresentation() OVERRIDE { |
5360 // If a parameter is an input to a phi, that phi should not | 5308 // If a parameter is an input to a phi, that phi should not |
5361 // choose any more optimistic representation than Tagged. | 5309 // choose any more optimistic representation than Tagged. |
5362 return Representation::Tagged(); | 5310 return Representation::Tagged(); |
5363 } | 5311 } |
5364 | 5312 |
5365 DECLARE_CONCRETE_INSTRUCTION(Parameter) | 5313 DECLARE_CONCRETE_INSTRUCTION(Parameter) |
5366 | 5314 |
5367 private: | 5315 private: |
5368 explicit HParameter(unsigned index, | 5316 explicit HParameter(unsigned index, |
5369 ParameterKind kind = STACK_PARAMETER) | 5317 ParameterKind kind = STACK_PARAMETER) |
(...skipping 15 matching lines...) Expand all Loading... |
5385 }; | 5333 }; |
5386 | 5334 |
5387 | 5335 |
5388 class HCallStub FINAL : public HUnaryCall { | 5336 class HCallStub FINAL : public HUnaryCall { |
5389 public: | 5337 public: |
5390 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallStub, CodeStub::Major, int); | 5338 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallStub, CodeStub::Major, int); |
5391 CodeStub::Major major_key() { return major_key_; } | 5339 CodeStub::Major major_key() { return major_key_; } |
5392 | 5340 |
5393 HValue* context() { return value(); } | 5341 HValue* context() { return value(); } |
5394 | 5342 |
5395 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 5343 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
5396 | 5344 |
5397 DECLARE_CONCRETE_INSTRUCTION(CallStub) | 5345 DECLARE_CONCRETE_INSTRUCTION(CallStub) |
5398 | 5346 |
5399 private: | 5347 private: |
5400 HCallStub(HValue* context, CodeStub::Major major_key, int argument_count) | 5348 HCallStub(HValue* context, CodeStub::Major major_key, int argument_count) |
5401 : HUnaryCall(context, argument_count), | 5349 : HUnaryCall(context, argument_count), |
5402 major_key_(major_key) { | 5350 major_key_(major_key) { |
5403 } | 5351 } |
5404 | 5352 |
5405 CodeStub::Major major_key_; | 5353 CodeStub::Major major_key_; |
5406 }; | 5354 }; |
5407 | 5355 |
5408 | 5356 |
5409 class HTailCallThroughMegamorphicCache FINAL : public HTemplateInstruction<3> { | 5357 class HTailCallThroughMegamorphicCache FINAL : public HTemplateInstruction<3> { |
5410 public: | 5358 public: |
5411 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HTailCallThroughMegamorphicCache, | 5359 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HTailCallThroughMegamorphicCache, |
5412 HValue*, HValue*, Code::Flags); | 5360 HValue*, HValue*, Code::Flags); |
5413 | 5361 |
5414 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 5362 Representation RequiredInputRepresentation(int index) OVERRIDE { |
5415 return Representation::Tagged(); | 5363 return Representation::Tagged(); |
5416 } | 5364 } |
5417 | 5365 |
5418 HValue* context() const { return OperandAt(0); } | 5366 HValue* context() const { return OperandAt(0); } |
5419 HValue* receiver() const { return OperandAt(1); } | 5367 HValue* receiver() const { return OperandAt(1); } |
5420 HValue* name() const { return OperandAt(2); } | 5368 HValue* name() const { return OperandAt(2); } |
5421 Code::Flags flags() const { return flags_; } | 5369 Code::Flags flags() const { return flags_; } |
5422 | 5370 |
5423 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 5371 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
5424 | 5372 |
5425 DECLARE_CONCRETE_INSTRUCTION(TailCallThroughMegamorphicCache) | 5373 DECLARE_CONCRETE_INSTRUCTION(TailCallThroughMegamorphicCache) |
5426 | 5374 |
5427 private: | 5375 private: |
5428 HTailCallThroughMegamorphicCache(HValue* context, HValue* receiver, | 5376 HTailCallThroughMegamorphicCache(HValue* context, HValue* receiver, |
5429 HValue* name, Code::Flags flags) | 5377 HValue* name, Code::Flags flags) |
5430 : flags_(flags) { | 5378 : flags_(flags) { |
5431 SetOperandAt(0, context); | 5379 SetOperandAt(0, context); |
5432 SetOperandAt(1, receiver); | 5380 SetOperandAt(1, receiver); |
5433 SetOperandAt(2, name); | 5381 SetOperandAt(2, name); |
5434 } | 5382 } |
5435 | 5383 |
5436 Code::Flags flags_; | 5384 Code::Flags flags_; |
5437 }; | 5385 }; |
5438 | 5386 |
5439 | 5387 |
5440 class HUnknownOSRValue FINAL : public HTemplateInstruction<0> { | 5388 class HUnknownOSRValue FINAL : public HTemplateInstruction<0> { |
5441 public: | 5389 public: |
5442 DECLARE_INSTRUCTION_FACTORY_P2(HUnknownOSRValue, HEnvironment*, int); | 5390 DECLARE_INSTRUCTION_FACTORY_P2(HUnknownOSRValue, HEnvironment*, int); |
5443 | 5391 |
5444 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 5392 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
5445 | 5393 |
5446 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 5394 Representation RequiredInputRepresentation(int index) OVERRIDE { |
5447 return Representation::None(); | 5395 return Representation::None(); |
5448 } | 5396 } |
5449 | 5397 |
5450 void set_incoming_value(HPhi* value) { incoming_value_ = value; } | 5398 void set_incoming_value(HPhi* value) { incoming_value_ = value; } |
5451 HPhi* incoming_value() { return incoming_value_; } | 5399 HPhi* incoming_value() { return incoming_value_; } |
5452 HEnvironment *environment() { return environment_; } | 5400 HEnvironment *environment() { return environment_; } |
5453 int index() { return index_; } | 5401 int index() { return index_; } |
5454 | 5402 |
5455 virtual Representation KnownOptimalRepresentation() OVERRIDE { | 5403 Representation KnownOptimalRepresentation() OVERRIDE { |
5456 if (incoming_value_ == NULL) return Representation::None(); | 5404 if (incoming_value_ == NULL) return Representation::None(); |
5457 return incoming_value_->KnownOptimalRepresentation(); | 5405 return incoming_value_->KnownOptimalRepresentation(); |
5458 } | 5406 } |
5459 | 5407 |
5460 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue) | 5408 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue) |
5461 | 5409 |
5462 private: | 5410 private: |
5463 HUnknownOSRValue(HEnvironment* environment, int index) | 5411 HUnknownOSRValue(HEnvironment* environment, int index) |
5464 : environment_(environment), | 5412 : environment_(environment), |
5465 index_(index), | 5413 index_(index), |
5466 incoming_value_(NULL) { | 5414 incoming_value_(NULL) { |
5467 set_representation(Representation::Tagged()); | 5415 set_representation(Representation::Tagged()); |
5468 } | 5416 } |
5469 | 5417 |
5470 HEnvironment* environment_; | 5418 HEnvironment* environment_; |
5471 int index_; | 5419 int index_; |
5472 HPhi* incoming_value_; | 5420 HPhi* incoming_value_; |
5473 }; | 5421 }; |
5474 | 5422 |
5475 | 5423 |
5476 class HLoadGlobalCell FINAL : public HTemplateInstruction<0> { | 5424 class HLoadGlobalCell FINAL : public HTemplateInstruction<0> { |
5477 public: | 5425 public: |
5478 DECLARE_INSTRUCTION_FACTORY_P2(HLoadGlobalCell, Handle<Cell>, | 5426 DECLARE_INSTRUCTION_FACTORY_P2(HLoadGlobalCell, Handle<Cell>, |
5479 PropertyDetails); | 5427 PropertyDetails); |
5480 | 5428 |
5481 Unique<Cell> cell() const { return cell_; } | 5429 Unique<Cell> cell() const { return cell_; } |
5482 bool RequiresHoleCheck() const; | 5430 bool RequiresHoleCheck() const; |
5483 | 5431 |
5484 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 5432 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
5485 | 5433 |
5486 virtual intptr_t Hashcode() OVERRIDE { | 5434 intptr_t Hashcode() OVERRIDE { return cell_.Hashcode(); } |
5487 return cell_.Hashcode(); | |
5488 } | |
5489 | 5435 |
5490 virtual void FinalizeUniqueness() OVERRIDE { | 5436 void FinalizeUniqueness() OVERRIDE { cell_ = Unique<Cell>(cell_.handle()); } |
5491 cell_ = Unique<Cell>(cell_.handle()); | |
5492 } | |
5493 | 5437 |
5494 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 5438 Representation RequiredInputRepresentation(int index) OVERRIDE { |
5495 return Representation::None(); | 5439 return Representation::None(); |
5496 } | 5440 } |
5497 | 5441 |
5498 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell) | 5442 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell) |
5499 | 5443 |
5500 protected: | 5444 protected: |
5501 virtual bool DataEquals(HValue* other) OVERRIDE { | 5445 bool DataEquals(HValue* other) OVERRIDE { |
5502 return cell_ == HLoadGlobalCell::cast(other)->cell_; | 5446 return cell_ == HLoadGlobalCell::cast(other)->cell_; |
5503 } | 5447 } |
5504 | 5448 |
5505 private: | 5449 private: |
5506 HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details) | 5450 HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details) |
5507 : cell_(Unique<Cell>::CreateUninitialized(cell)), details_(details) { | 5451 : cell_(Unique<Cell>::CreateUninitialized(cell)), details_(details) { |
5508 set_representation(Representation::Tagged()); | 5452 set_representation(Representation::Tagged()); |
5509 SetFlag(kUseGVN); | 5453 SetFlag(kUseGVN); |
5510 SetDependsOnFlag(kGlobalVars); | 5454 SetDependsOnFlag(kGlobalVars); |
5511 } | 5455 } |
5512 | 5456 |
5513 virtual bool IsDeletable() const OVERRIDE { return !RequiresHoleCheck(); } | 5457 bool IsDeletable() const OVERRIDE { return !RequiresHoleCheck(); } |
5514 | 5458 |
5515 Unique<Cell> cell_; | 5459 Unique<Cell> cell_; |
5516 PropertyDetails details_; | 5460 PropertyDetails details_; |
5517 }; | 5461 }; |
5518 | 5462 |
5519 | 5463 |
5520 class HLoadGlobalGeneric FINAL : public HTemplateInstruction<2> { | 5464 class HLoadGlobalGeneric FINAL : public HTemplateInstruction<2> { |
5521 public: | 5465 public: |
5522 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HLoadGlobalGeneric, HValue*, | 5466 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HLoadGlobalGeneric, HValue*, |
5523 Handle<String>, bool); | 5467 Handle<String>, bool); |
5524 | 5468 |
5525 HValue* context() { return OperandAt(0); } | 5469 HValue* context() { return OperandAt(0); } |
5526 HValue* global_object() { return OperandAt(1); } | 5470 HValue* global_object() { return OperandAt(1); } |
5527 Handle<String> name() const { return name_; } | 5471 Handle<String> name() const { return name_; } |
5528 bool for_typeof() const { return for_typeof_; } | 5472 bool for_typeof() const { return for_typeof_; } |
5529 FeedbackVectorICSlot slot() const { | 5473 FeedbackVectorICSlot slot() const { |
5530 DCHECK(FLAG_vector_ics && !slot_.IsInvalid()); | 5474 DCHECK(FLAG_vector_ics && !slot_.IsInvalid()); |
5531 return slot_; | 5475 return slot_; |
5532 } | 5476 } |
5533 Handle<TypeFeedbackVector> feedback_vector() const { | 5477 Handle<TypeFeedbackVector> feedback_vector() const { |
5534 return feedback_vector_; | 5478 return feedback_vector_; |
5535 } | 5479 } |
5536 void SetVectorAndSlot(Handle<TypeFeedbackVector> vector, | 5480 void SetVectorAndSlot(Handle<TypeFeedbackVector> vector, |
5537 FeedbackVectorICSlot slot) { | 5481 FeedbackVectorICSlot slot) { |
5538 DCHECK(FLAG_vector_ics); | 5482 DCHECK(FLAG_vector_ics); |
5539 feedback_vector_ = vector; | 5483 feedback_vector_ = vector; |
5540 slot_ = slot; | 5484 slot_ = slot; |
5541 } | 5485 } |
5542 | 5486 |
5543 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 5487 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
5544 | 5488 |
5545 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 5489 Representation RequiredInputRepresentation(int index) OVERRIDE { |
5546 return Representation::Tagged(); | 5490 return Representation::Tagged(); |
5547 } | 5491 } |
5548 | 5492 |
5549 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric) | 5493 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric) |
5550 | 5494 |
5551 private: | 5495 private: |
5552 HLoadGlobalGeneric(HValue* context, HValue* global_object, | 5496 HLoadGlobalGeneric(HValue* context, HValue* global_object, |
5553 Handle<String> name, bool for_typeof) | 5497 Handle<String> name, bool for_typeof) |
5554 : name_(name), | 5498 : name_(name), |
5555 for_typeof_(for_typeof), | 5499 for_typeof_(for_typeof), |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5593 HValue* context() const { return OperandAt(0); } | 5537 HValue* context() const { return OperandAt(0); } |
5594 HValue* size() const { return OperandAt(1); } | 5538 HValue* size() const { return OperandAt(1); } |
5595 | 5539 |
5596 bool has_size_upper_bound() { return size_upper_bound_ != NULL; } | 5540 bool has_size_upper_bound() { return size_upper_bound_ != NULL; } |
5597 HConstant* size_upper_bound() { return size_upper_bound_; } | 5541 HConstant* size_upper_bound() { return size_upper_bound_; } |
5598 void set_size_upper_bound(HConstant* value) { | 5542 void set_size_upper_bound(HConstant* value) { |
5599 DCHECK(size_upper_bound_ == NULL); | 5543 DCHECK(size_upper_bound_ == NULL); |
5600 size_upper_bound_ = value; | 5544 size_upper_bound_ = value; |
5601 } | 5545 } |
5602 | 5546 |
5603 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 5547 Representation RequiredInputRepresentation(int index) OVERRIDE { |
5604 if (index == 0) { | 5548 if (index == 0) { |
5605 return Representation::Tagged(); | 5549 return Representation::Tagged(); |
5606 } else { | 5550 } else { |
5607 return Representation::Integer32(); | 5551 return Representation::Integer32(); |
5608 } | 5552 } |
5609 } | 5553 } |
5610 | 5554 |
5611 virtual Handle<Map> GetMonomorphicJSObjectMap() OVERRIDE { | 5555 Handle<Map> GetMonomorphicJSObjectMap() OVERRIDE { |
5612 return known_initial_map_; | 5556 return known_initial_map_; |
5613 } | 5557 } |
5614 | 5558 |
5615 void set_known_initial_map(Handle<Map> known_initial_map) { | 5559 void set_known_initial_map(Handle<Map> known_initial_map) { |
5616 known_initial_map_ = known_initial_map; | 5560 known_initial_map_ = known_initial_map; |
5617 } | 5561 } |
5618 | 5562 |
5619 bool IsNewSpaceAllocation() const { | 5563 bool IsNewSpaceAllocation() const { |
5620 return (flags_ & ALLOCATE_IN_NEW_SPACE) != 0; | 5564 return (flags_ & ALLOCATE_IN_NEW_SPACE) != 0; |
5621 } | 5565 } |
(...skipping 22 matching lines...) Expand all Loading... |
5644 return (flags_ & CLEAR_NEXT_MAP_WORD) != 0; | 5588 return (flags_ & CLEAR_NEXT_MAP_WORD) != 0; |
5645 } | 5589 } |
5646 | 5590 |
5647 void MakeDoubleAligned() { | 5591 void MakeDoubleAligned() { |
5648 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); | 5592 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); |
5649 } | 5593 } |
5650 | 5594 |
5651 virtual bool HandleSideEffectDominator(GVNFlag side_effect, | 5595 virtual bool HandleSideEffectDominator(GVNFlag side_effect, |
5652 HValue* dominator) OVERRIDE; | 5596 HValue* dominator) OVERRIDE; |
5653 | 5597 |
5654 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 5598 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
5655 | 5599 |
5656 DECLARE_CONCRETE_INSTRUCTION(Allocate) | 5600 DECLARE_CONCRETE_INSTRUCTION(Allocate) |
5657 | 5601 |
5658 private: | 5602 private: |
5659 enum Flags { | 5603 enum Flags { |
5660 ALLOCATE_IN_NEW_SPACE = 1 << 0, | 5604 ALLOCATE_IN_NEW_SPACE = 1 << 0, |
5661 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, | 5605 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, |
5662 ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, | 5606 ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, |
5663 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, | 5607 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, |
5664 PREFILL_WITH_FILLER = 1 << 4, | 5608 PREFILL_WITH_FILLER = 1 << 4, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5757 | 5701 |
5758 class HStoreCodeEntry FINAL: public HTemplateInstruction<2> { | 5702 class HStoreCodeEntry FINAL: public HTemplateInstruction<2> { |
5759 public: | 5703 public: |
5760 static HStoreCodeEntry* New(Zone* zone, | 5704 static HStoreCodeEntry* New(Zone* zone, |
5761 HValue* context, | 5705 HValue* context, |
5762 HValue* function, | 5706 HValue* function, |
5763 HValue* code) { | 5707 HValue* code) { |
5764 return new(zone) HStoreCodeEntry(function, code); | 5708 return new(zone) HStoreCodeEntry(function, code); |
5765 } | 5709 } |
5766 | 5710 |
5767 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 5711 Representation RequiredInputRepresentation(int index) OVERRIDE { |
5768 return Representation::Tagged(); | 5712 return Representation::Tagged(); |
5769 } | 5713 } |
5770 | 5714 |
5771 HValue* function() { return OperandAt(0); } | 5715 HValue* function() { return OperandAt(0); } |
5772 HValue* code_object() { return OperandAt(1); } | 5716 HValue* code_object() { return OperandAt(1); } |
5773 | 5717 |
5774 DECLARE_CONCRETE_INSTRUCTION(StoreCodeEntry) | 5718 DECLARE_CONCRETE_INSTRUCTION(StoreCodeEntry) |
5775 | 5719 |
5776 private: | 5720 private: |
5777 HStoreCodeEntry(HValue* function, HValue* code) { | 5721 HStoreCodeEntry(HValue* function, HValue* code) { |
5778 SetOperandAt(0, function); | 5722 SetOperandAt(0, function); |
5779 SetOperandAt(1, code); | 5723 SetOperandAt(1, code); |
5780 } | 5724 } |
5781 }; | 5725 }; |
5782 | 5726 |
5783 | 5727 |
5784 class HInnerAllocatedObject FINAL : public HTemplateInstruction<2> { | 5728 class HInnerAllocatedObject FINAL : public HTemplateInstruction<2> { |
5785 public: | 5729 public: |
5786 static HInnerAllocatedObject* New(Zone* zone, | 5730 static HInnerAllocatedObject* New(Zone* zone, |
5787 HValue* context, | 5731 HValue* context, |
5788 HValue* value, | 5732 HValue* value, |
5789 HValue* offset, | 5733 HValue* offset, |
5790 HType type) { | 5734 HType type) { |
5791 return new(zone) HInnerAllocatedObject(value, offset, type); | 5735 return new(zone) HInnerAllocatedObject(value, offset, type); |
5792 } | 5736 } |
5793 | 5737 |
5794 HValue* base_object() const { return OperandAt(0); } | 5738 HValue* base_object() const { return OperandAt(0); } |
5795 HValue* offset() const { return OperandAt(1); } | 5739 HValue* offset() const { return OperandAt(1); } |
5796 | 5740 |
5797 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 5741 Representation RequiredInputRepresentation(int index) OVERRIDE { |
5798 return index == 0 ? Representation::Tagged() : Representation::Integer32(); | 5742 return index == 0 ? Representation::Tagged() : Representation::Integer32(); |
5799 } | 5743 } |
5800 | 5744 |
5801 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 5745 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
5802 | 5746 |
5803 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject) | 5747 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject) |
5804 | 5748 |
5805 private: | 5749 private: |
5806 HInnerAllocatedObject(HValue* value, | 5750 HInnerAllocatedObject(HValue* value, |
5807 HValue* offset, | 5751 HValue* offset, |
5808 HType type) : HTemplateInstruction<2>(type) { | 5752 HType type) : HTemplateInstruction<2>(type) { |
5809 DCHECK(value->IsAllocate()); | 5753 DCHECK(value->IsAllocate()); |
5810 DCHECK(type.IsHeapObject()); | 5754 DCHECK(type.IsHeapObject()); |
5811 SetOperandAt(0, value); | 5755 SetOperandAt(0, value); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5882 public: | 5826 public: |
5883 DECLARE_INSTRUCTION_FACTORY_P3(HStoreGlobalCell, HValue*, | 5827 DECLARE_INSTRUCTION_FACTORY_P3(HStoreGlobalCell, HValue*, |
5884 Handle<PropertyCell>, PropertyDetails); | 5828 Handle<PropertyCell>, PropertyDetails); |
5885 | 5829 |
5886 Unique<PropertyCell> cell() const { return cell_; } | 5830 Unique<PropertyCell> cell() const { return cell_; } |
5887 bool RequiresHoleCheck() { return details_.IsConfigurable(); } | 5831 bool RequiresHoleCheck() { return details_.IsConfigurable(); } |
5888 bool NeedsWriteBarrier() { | 5832 bool NeedsWriteBarrier() { |
5889 return StoringValueNeedsWriteBarrier(value()); | 5833 return StoringValueNeedsWriteBarrier(value()); |
5890 } | 5834 } |
5891 | 5835 |
5892 virtual void FinalizeUniqueness() OVERRIDE { | 5836 void FinalizeUniqueness() OVERRIDE { |
5893 cell_ = Unique<PropertyCell>(cell_.handle()); | 5837 cell_ = Unique<PropertyCell>(cell_.handle()); |
5894 } | 5838 } |
5895 | 5839 |
5896 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 5840 Representation RequiredInputRepresentation(int index) OVERRIDE { |
5897 return Representation::Tagged(); | 5841 return Representation::Tagged(); |
5898 } | 5842 } |
5899 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 5843 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
5900 | 5844 |
5901 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell) | 5845 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell) |
5902 | 5846 |
5903 private: | 5847 private: |
5904 HStoreGlobalCell(HValue* value, | 5848 HStoreGlobalCell(HValue* value, |
5905 Handle<PropertyCell> cell, | 5849 Handle<PropertyCell> cell, |
5906 PropertyDetails details) | 5850 PropertyDetails details) |
5907 : HUnaryOperation(value), | 5851 : HUnaryOperation(value), |
5908 cell_(Unique<PropertyCell>::CreateUninitialized(cell)), | 5852 cell_(Unique<PropertyCell>::CreateUninitialized(cell)), |
5909 details_(details) { | 5853 details_(details) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5941 Mode mode() const { return mode_; } | 5885 Mode mode() const { return mode_; } |
5942 | 5886 |
5943 bool DeoptimizesOnHole() { | 5887 bool DeoptimizesOnHole() { |
5944 return mode_ == kCheckDeoptimize; | 5888 return mode_ == kCheckDeoptimize; |
5945 } | 5889 } |
5946 | 5890 |
5947 bool RequiresHoleCheck() const { | 5891 bool RequiresHoleCheck() const { |
5948 return mode_ != kNoCheck; | 5892 return mode_ != kNoCheck; |
5949 } | 5893 } |
5950 | 5894 |
5951 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 5895 Representation RequiredInputRepresentation(int index) OVERRIDE { |
5952 return Representation::Tagged(); | 5896 return Representation::Tagged(); |
5953 } | 5897 } |
5954 | 5898 |
5955 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 5899 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
5956 | 5900 |
5957 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot) | 5901 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot) |
5958 | 5902 |
5959 protected: | 5903 protected: |
5960 virtual bool DataEquals(HValue* other) OVERRIDE { | 5904 bool DataEquals(HValue* other) OVERRIDE { |
5961 HLoadContextSlot* b = HLoadContextSlot::cast(other); | 5905 HLoadContextSlot* b = HLoadContextSlot::cast(other); |
5962 return (slot_index() == b->slot_index()); | 5906 return (slot_index() == b->slot_index()); |
5963 } | 5907 } |
5964 | 5908 |
5965 private: | 5909 private: |
5966 virtual bool IsDeletable() const OVERRIDE { return !RequiresHoleCheck(); } | 5910 bool IsDeletable() const OVERRIDE { return !RequiresHoleCheck(); } |
5967 | 5911 |
5968 int slot_index_; | 5912 int slot_index_; |
5969 Mode mode_; | 5913 Mode mode_; |
5970 }; | 5914 }; |
5971 | 5915 |
5972 | 5916 |
5973 class HStoreContextSlot FINAL : public HTemplateInstruction<2> { | 5917 class HStoreContextSlot FINAL : public HTemplateInstruction<2> { |
5974 public: | 5918 public: |
5975 enum Mode { | 5919 enum Mode { |
5976 // Perform a normal store to the context slot without checking its previous | 5920 // Perform a normal store to the context slot without checking its previous |
(...skipping 21 matching lines...) Expand all Loading... |
5998 } | 5942 } |
5999 | 5943 |
6000 bool DeoptimizesOnHole() { | 5944 bool DeoptimizesOnHole() { |
6001 return mode_ == kCheckDeoptimize; | 5945 return mode_ == kCheckDeoptimize; |
6002 } | 5946 } |
6003 | 5947 |
6004 bool RequiresHoleCheck() { | 5948 bool RequiresHoleCheck() { |
6005 return mode_ != kNoCheck; | 5949 return mode_ != kNoCheck; |
6006 } | 5950 } |
6007 | 5951 |
6008 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 5952 Representation RequiredInputRepresentation(int index) OVERRIDE { |
6009 return Representation::Tagged(); | 5953 return Representation::Tagged(); |
6010 } | 5954 } |
6011 | 5955 |
6012 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 5956 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
6013 | 5957 |
6014 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) | 5958 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) |
6015 | 5959 |
6016 private: | 5960 private: |
6017 HStoreContextSlot(HValue* context, int slot_index, Mode mode, HValue* value) | 5961 HStoreContextSlot(HValue* context, int slot_index, Mode mode, HValue* value) |
6018 : slot_index_(slot_index), mode_(mode) { | 5962 : slot_index_(slot_index), mode_(mode) { |
6019 SetOperandAt(0, context); | 5963 SetOperandAt(0, context); |
6020 SetOperandAt(1, value); | 5964 SetOperandAt(1, value); |
6021 SetChangesFlag(kContextSlots); | 5965 SetChangesFlag(kContextSlots); |
6022 } | 5966 } |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6468 return OperandAt(1); | 6412 return OperandAt(1); |
6469 } | 6413 } |
6470 bool HasDependency() const { return OperandAt(0) != OperandAt(1); } | 6414 bool HasDependency() const { return OperandAt(0) != OperandAt(1); } |
6471 HObjectAccess access() const { return access_; } | 6415 HObjectAccess access() const { return access_; } |
6472 Representation field_representation() const { | 6416 Representation field_representation() const { |
6473 return access_.representation(); | 6417 return access_.representation(); |
6474 } | 6418 } |
6475 | 6419 |
6476 const UniqueSet<Map>* maps() const { return maps_; } | 6420 const UniqueSet<Map>* maps() const { return maps_; } |
6477 | 6421 |
6478 virtual bool HasEscapingOperandAt(int index) OVERRIDE { return false; } | 6422 bool HasEscapingOperandAt(int index) OVERRIDE { return false; } |
6479 virtual bool HasOutOfBoundsAccess(int size) OVERRIDE { | 6423 bool HasOutOfBoundsAccess(int size) OVERRIDE { |
6480 return !access().IsInobject() || access().offset() >= size; | 6424 return !access().IsInobject() || access().offset() >= size; |
6481 } | 6425 } |
6482 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 6426 Representation RequiredInputRepresentation(int index) OVERRIDE { |
6483 if (index == 0) { | 6427 if (index == 0) { |
6484 // object must be external in case of external memory access | 6428 // object must be external in case of external memory access |
6485 return access().IsExternalMemory() ? Representation::External() | 6429 return access().IsExternalMemory() ? Representation::External() |
6486 : Representation::Tagged(); | 6430 : Representation::Tagged(); |
6487 } | 6431 } |
6488 DCHECK(index == 1); | 6432 DCHECK(index == 1); |
6489 return Representation::None(); | 6433 return Representation::None(); |
6490 } | 6434 } |
6491 virtual Range* InferRange(Zone* zone) OVERRIDE; | 6435 Range* InferRange(Zone* zone) OVERRIDE; |
6492 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 6436 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
6493 | 6437 |
6494 bool CanBeReplacedWith(HValue* other) const { | 6438 bool CanBeReplacedWith(HValue* other) const { |
6495 if (!CheckFlag(HValue::kCantBeReplaced)) return false; | 6439 if (!CheckFlag(HValue::kCantBeReplaced)) return false; |
6496 if (!type().Equals(other->type())) return false; | 6440 if (!type().Equals(other->type())) return false; |
6497 if (!representation().Equals(other->representation())) return false; | 6441 if (!representation().Equals(other->representation())) return false; |
6498 if (!other->IsLoadNamedField()) return true; | 6442 if (!other->IsLoadNamedField()) return true; |
6499 HLoadNamedField* that = HLoadNamedField::cast(other); | 6443 HLoadNamedField* that = HLoadNamedField::cast(other); |
6500 if (this->maps_ == that->maps_) return true; | 6444 if (this->maps_ == that->maps_) return true; |
6501 if (this->maps_ == NULL || that->maps_ == NULL) return false; | 6445 if (this->maps_ == NULL || that->maps_ == NULL) return false; |
6502 return this->maps_->IsSubset(that->maps_); | 6446 return this->maps_->IsSubset(that->maps_); |
6503 } | 6447 } |
6504 | 6448 |
6505 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) | 6449 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) |
6506 | 6450 |
6507 protected: | 6451 protected: |
6508 virtual bool DataEquals(HValue* other) OVERRIDE { | 6452 bool DataEquals(HValue* other) OVERRIDE { |
6509 HLoadNamedField* that = HLoadNamedField::cast(other); | 6453 HLoadNamedField* that = HLoadNamedField::cast(other); |
6510 if (!this->access_.Equals(that->access_)) return false; | 6454 if (!this->access_.Equals(that->access_)) return false; |
6511 if (this->maps_ == that->maps_) return true; | 6455 if (this->maps_ == that->maps_) return true; |
6512 return (this->maps_ != NULL && | 6456 return (this->maps_ != NULL && |
6513 that->maps_ != NULL && | 6457 that->maps_ != NULL && |
6514 this->maps_->Equals(that->maps_)); | 6458 this->maps_->Equals(that->maps_)); |
6515 } | 6459 } |
6516 | 6460 |
6517 private: | 6461 private: |
6518 HLoadNamedField(HValue* object, | 6462 HLoadNamedField(HValue* object, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6562 SetOperandAt(0, object); | 6506 SetOperandAt(0, object); |
6563 SetOperandAt(1, dependency ? dependency : object); | 6507 SetOperandAt(1, dependency ? dependency : object); |
6564 | 6508 |
6565 DCHECK(access.representation().IsHeapObject()); | 6509 DCHECK(access.representation().IsHeapObject()); |
6566 DCHECK(type.IsHeapObject()); | 6510 DCHECK(type.IsHeapObject()); |
6567 set_representation(Representation::Tagged()); | 6511 set_representation(Representation::Tagged()); |
6568 | 6512 |
6569 access.SetGVNFlags(this, LOAD); | 6513 access.SetGVNFlags(this, LOAD); |
6570 } | 6514 } |
6571 | 6515 |
6572 virtual bool IsDeletable() const OVERRIDE { return true; } | 6516 bool IsDeletable() const OVERRIDE { return true; } |
6573 | 6517 |
6574 HObjectAccess access_; | 6518 HObjectAccess access_; |
6575 const UniqueSet<Map>* maps_; | 6519 const UniqueSet<Map>* maps_; |
6576 }; | 6520 }; |
6577 | 6521 |
6578 | 6522 |
6579 class HLoadNamedGeneric FINAL : public HTemplateInstruction<2> { | 6523 class HLoadNamedGeneric FINAL : public HTemplateInstruction<2> { |
6580 public: | 6524 public: |
6581 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadNamedGeneric, HValue*, | 6525 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadNamedGeneric, HValue*, |
6582 Handle<Object>); | 6526 Handle<Object>); |
6583 | 6527 |
6584 HValue* context() const { return OperandAt(0); } | 6528 HValue* context() const { return OperandAt(0); } |
6585 HValue* object() const { return OperandAt(1); } | 6529 HValue* object() const { return OperandAt(1); } |
6586 Handle<Object> name() const { return name_; } | 6530 Handle<Object> name() const { return name_; } |
6587 | 6531 |
6588 FeedbackVectorICSlot slot() const { | 6532 FeedbackVectorICSlot slot() const { |
6589 DCHECK(FLAG_vector_ics && !slot_.IsInvalid()); | 6533 DCHECK(FLAG_vector_ics && !slot_.IsInvalid()); |
6590 return slot_; | 6534 return slot_; |
6591 } | 6535 } |
6592 Handle<TypeFeedbackVector> feedback_vector() const { | 6536 Handle<TypeFeedbackVector> feedback_vector() const { |
6593 return feedback_vector_; | 6537 return feedback_vector_; |
6594 } | 6538 } |
6595 void SetVectorAndSlot(Handle<TypeFeedbackVector> vector, | 6539 void SetVectorAndSlot(Handle<TypeFeedbackVector> vector, |
6596 FeedbackVectorICSlot slot) { | 6540 FeedbackVectorICSlot slot) { |
6597 DCHECK(FLAG_vector_ics); | 6541 DCHECK(FLAG_vector_ics); |
6598 feedback_vector_ = vector; | 6542 feedback_vector_ = vector; |
6599 slot_ = slot; | 6543 slot_ = slot; |
6600 } | 6544 } |
6601 | 6545 |
6602 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 6546 Representation RequiredInputRepresentation(int index) OVERRIDE { |
6603 return Representation::Tagged(); | 6547 return Representation::Tagged(); |
6604 } | 6548 } |
6605 | 6549 |
6606 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 6550 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
6607 | 6551 |
6608 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric) | 6552 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric) |
6609 | 6553 |
6610 private: | 6554 private: |
6611 HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name) | 6555 HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name) |
6612 : name_(name), slot_(FeedbackVectorICSlot::Invalid()) { | 6556 : name_(name), slot_(FeedbackVectorICSlot::Invalid()) { |
6613 SetOperandAt(0, context); | 6557 SetOperandAt(0, context); |
6614 SetOperandAt(1, object); | 6558 SetOperandAt(1, object); |
6615 set_representation(Representation::Tagged()); | 6559 set_representation(Representation::Tagged()); |
6616 SetAllSideEffects(); | 6560 SetAllSideEffects(); |
6617 } | 6561 } |
6618 | 6562 |
6619 Handle<Object> name_; | 6563 Handle<Object> name_; |
6620 Handle<TypeFeedbackVector> feedback_vector_; | 6564 Handle<TypeFeedbackVector> feedback_vector_; |
6621 FeedbackVectorICSlot slot_; | 6565 FeedbackVectorICSlot slot_; |
6622 }; | 6566 }; |
6623 | 6567 |
6624 | 6568 |
6625 class HLoadFunctionPrototype FINAL : public HUnaryOperation { | 6569 class HLoadFunctionPrototype FINAL : public HUnaryOperation { |
6626 public: | 6570 public: |
6627 DECLARE_INSTRUCTION_FACTORY_P1(HLoadFunctionPrototype, HValue*); | 6571 DECLARE_INSTRUCTION_FACTORY_P1(HLoadFunctionPrototype, HValue*); |
6628 | 6572 |
6629 HValue* function() { return OperandAt(0); } | 6573 HValue* function() { return OperandAt(0); } |
6630 | 6574 |
6631 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 6575 Representation RequiredInputRepresentation(int index) OVERRIDE { |
6632 return Representation::Tagged(); | 6576 return Representation::Tagged(); |
6633 } | 6577 } |
6634 | 6578 |
6635 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype) | 6579 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype) |
6636 | 6580 |
6637 protected: | 6581 protected: |
6638 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 6582 bool DataEquals(HValue* other) OVERRIDE { return true; } |
6639 | 6583 |
6640 private: | 6584 private: |
6641 explicit HLoadFunctionPrototype(HValue* function) | 6585 explicit HLoadFunctionPrototype(HValue* function) |
6642 : HUnaryOperation(function) { | 6586 : HUnaryOperation(function) { |
6643 set_representation(Representation::Tagged()); | 6587 set_representation(Representation::Tagged()); |
6644 SetFlag(kUseGVN); | 6588 SetFlag(kUseGVN); |
6645 SetDependsOnFlag(kCalls); | 6589 SetDependsOnFlag(kCalls); |
6646 } | 6590 } |
6647 }; | 6591 }; |
6648 | 6592 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6701 uint32_t base_offset() const { return BaseOffsetField::decode(bit_field_); } | 6645 uint32_t base_offset() const { return BaseOffsetField::decode(bit_field_); } |
6702 bool TryIncreaseBaseOffset(uint32_t increase_by_value) OVERRIDE; | 6646 bool TryIncreaseBaseOffset(uint32_t increase_by_value) OVERRIDE; |
6703 HValue* GetKey() OVERRIDE { return key(); } | 6647 HValue* GetKey() OVERRIDE { return key(); } |
6704 void SetKey(HValue* key) OVERRIDE { SetOperandAt(1, key); } | 6648 void SetKey(HValue* key) OVERRIDE { SetOperandAt(1, key); } |
6705 bool IsDehoisted() const OVERRIDE { | 6649 bool IsDehoisted() const OVERRIDE { |
6706 return IsDehoistedField::decode(bit_field_); | 6650 return IsDehoistedField::decode(bit_field_); |
6707 } | 6651 } |
6708 void SetDehoisted(bool is_dehoisted) OVERRIDE { | 6652 void SetDehoisted(bool is_dehoisted) OVERRIDE { |
6709 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); | 6653 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); |
6710 } | 6654 } |
6711 virtual ElementsKind elements_kind() const OVERRIDE { | 6655 ElementsKind elements_kind() const OVERRIDE { |
6712 return ElementsKindField::decode(bit_field_); | 6656 return ElementsKindField::decode(bit_field_); |
6713 } | 6657 } |
6714 LoadKeyedHoleMode hole_mode() const { | 6658 LoadKeyedHoleMode hole_mode() const { |
6715 return HoleModeField::decode(bit_field_); | 6659 return HoleModeField::decode(bit_field_); |
6716 } | 6660 } |
6717 | 6661 |
6718 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 6662 Representation RequiredInputRepresentation(int index) OVERRIDE { |
6719 // kind_fast: tagged[int32] (none) | 6663 // kind_fast: tagged[int32] (none) |
6720 // kind_double: tagged[int32] (none) | 6664 // kind_double: tagged[int32] (none) |
6721 // kind_fixed_typed_array: tagged[int32] (none) | 6665 // kind_fixed_typed_array: tagged[int32] (none) |
6722 // kind_external: external[int32] (none) | 6666 // kind_external: external[int32] (none) |
6723 if (index == 0) { | 6667 if (index == 0) { |
6724 return is_external() ? Representation::External() | 6668 return is_external() ? Representation::External() |
6725 : Representation::Tagged(); | 6669 : Representation::Tagged(); |
6726 } | 6670 } |
6727 if (index == 1) { | 6671 if (index == 1) { |
6728 return ArrayInstructionInterface::KeyedAccessIndexRequirement( | 6672 return ArrayInstructionInterface::KeyedAccessIndexRequirement( |
6729 OperandAt(1)->representation()); | 6673 OperandAt(1)->representation()); |
6730 } | 6674 } |
6731 return Representation::None(); | 6675 return Representation::None(); |
6732 } | 6676 } |
6733 | 6677 |
6734 virtual Representation observed_input_representation(int index) OVERRIDE { | 6678 Representation observed_input_representation(int index) OVERRIDE { |
6735 return RequiredInputRepresentation(index); | 6679 return RequiredInputRepresentation(index); |
6736 } | 6680 } |
6737 | 6681 |
6738 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 6682 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
6739 | 6683 |
6740 bool UsesMustHandleHole() const; | 6684 bool UsesMustHandleHole() const; |
6741 bool AllUsesCanTreatHoleAsNaN() const; | 6685 bool AllUsesCanTreatHoleAsNaN() const; |
6742 bool RequiresHoleCheck() const; | 6686 bool RequiresHoleCheck() const; |
6743 | 6687 |
6744 virtual Range* InferRange(Zone* zone) OVERRIDE; | 6688 Range* InferRange(Zone* zone) OVERRIDE; |
6745 | 6689 |
6746 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed) | 6690 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed) |
6747 | 6691 |
6748 protected: | 6692 protected: |
6749 virtual bool DataEquals(HValue* other) OVERRIDE { | 6693 bool DataEquals(HValue* other) OVERRIDE { |
6750 if (!other->IsLoadKeyed()) return false; | 6694 if (!other->IsLoadKeyed()) return false; |
6751 HLoadKeyed* other_load = HLoadKeyed::cast(other); | 6695 HLoadKeyed* other_load = HLoadKeyed::cast(other); |
6752 | 6696 |
6753 if (IsDehoisted() && base_offset() != other_load->base_offset()) | 6697 if (IsDehoisted() && base_offset() != other_load->base_offset()) |
6754 return false; | 6698 return false; |
6755 return elements_kind() == other_load->elements_kind(); | 6699 return elements_kind() == other_load->elements_kind(); |
6756 } | 6700 } |
6757 | 6701 |
6758 private: | 6702 private: |
6759 HLoadKeyed(HValue* obj, | 6703 HLoadKeyed(HValue* obj, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6816 } else { | 6760 } else { |
6817 UNREACHABLE(); | 6761 UNREACHABLE(); |
6818 } | 6762 } |
6819 // Native code could change the specialized array. | 6763 // Native code could change the specialized array. |
6820 SetDependsOnFlag(kCalls); | 6764 SetDependsOnFlag(kCalls); |
6821 } | 6765 } |
6822 | 6766 |
6823 SetFlag(kUseGVN); | 6767 SetFlag(kUseGVN); |
6824 } | 6768 } |
6825 | 6769 |
6826 virtual bool IsDeletable() const OVERRIDE { | 6770 bool IsDeletable() const OVERRIDE { return !RequiresHoleCheck(); } |
6827 return !RequiresHoleCheck(); | |
6828 } | |
6829 | 6771 |
6830 // Establish some checks around our packed fields | 6772 // Establish some checks around our packed fields |
6831 enum LoadKeyedBits { | 6773 enum LoadKeyedBits { |
6832 kBitsForElementsKind = 5, | 6774 kBitsForElementsKind = 5, |
6833 kBitsForHoleMode = 1, | 6775 kBitsForHoleMode = 1, |
6834 kBitsForBaseOffset = 25, | 6776 kBitsForBaseOffset = 25, |
6835 kBitsForIsDehoisted = 1, | 6777 kBitsForIsDehoisted = 1, |
6836 | 6778 |
6837 kStartElementsKind = 0, | 6779 kStartElementsKind = 0, |
6838 kStartHoleMode = kStartElementsKind + kBitsForElementsKind, | 6780 kStartHoleMode = kStartElementsKind + kBitsForElementsKind, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6873 Handle<TypeFeedbackVector> feedback_vector() const { | 6815 Handle<TypeFeedbackVector> feedback_vector() const { |
6874 return feedback_vector_; | 6816 return feedback_vector_; |
6875 } | 6817 } |
6876 void SetVectorAndSlot(Handle<TypeFeedbackVector> vector, | 6818 void SetVectorAndSlot(Handle<TypeFeedbackVector> vector, |
6877 FeedbackVectorICSlot slot) { | 6819 FeedbackVectorICSlot slot) { |
6878 DCHECK(FLAG_vector_ics); | 6820 DCHECK(FLAG_vector_ics); |
6879 feedback_vector_ = vector; | 6821 feedback_vector_ = vector; |
6880 slot_ = slot; | 6822 slot_ = slot; |
6881 } | 6823 } |
6882 | 6824 |
6883 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 6825 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
6884 | 6826 |
6885 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 6827 Representation RequiredInputRepresentation(int index) OVERRIDE { |
6886 // tagged[tagged] | 6828 // tagged[tagged] |
6887 return Representation::Tagged(); | 6829 return Representation::Tagged(); |
6888 } | 6830 } |
6889 | 6831 |
6890 virtual HValue* Canonicalize() OVERRIDE; | 6832 HValue* Canonicalize() OVERRIDE; |
6891 | 6833 |
6892 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) | 6834 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) |
6893 | 6835 |
6894 private: | 6836 private: |
6895 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) | 6837 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) |
6896 : slot_(FeedbackVectorICSlot::Invalid()) { | 6838 : slot_(FeedbackVectorICSlot::Invalid()) { |
6897 set_representation(Representation::Tagged()); | 6839 set_representation(Representation::Tagged()); |
6898 SetOperandAt(0, obj); | 6840 SetOperandAt(0, obj); |
6899 SetOperandAt(1, key); | 6841 SetOperandAt(1, key); |
6900 SetOperandAt(2, context); | 6842 SetOperandAt(2, context); |
(...skipping 18 matching lines...) Expand all Loading... |
6919 | 6861 |
6920 class HStoreNamedField FINAL : public HTemplateInstruction<3> { | 6862 class HStoreNamedField FINAL : public HTemplateInstruction<3> { |
6921 public: | 6863 public: |
6922 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*, | 6864 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*, |
6923 HObjectAccess, HValue*); | 6865 HObjectAccess, HValue*); |
6924 DECLARE_INSTRUCTION_FACTORY_P4(HStoreNamedField, HValue*, | 6866 DECLARE_INSTRUCTION_FACTORY_P4(HStoreNamedField, HValue*, |
6925 HObjectAccess, HValue*, StoreFieldOrKeyedMode); | 6867 HObjectAccess, HValue*, StoreFieldOrKeyedMode); |
6926 | 6868 |
6927 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) | 6869 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) |
6928 | 6870 |
6929 virtual bool HasEscapingOperandAt(int index) OVERRIDE { | 6871 bool HasEscapingOperandAt(int index) OVERRIDE { return index == 1; } |
6930 return index == 1; | 6872 bool HasOutOfBoundsAccess(int size) OVERRIDE { |
6931 } | |
6932 virtual bool HasOutOfBoundsAccess(int size) OVERRIDE { | |
6933 return !access().IsInobject() || access().offset() >= size; | 6873 return !access().IsInobject() || access().offset() >= size; |
6934 } | 6874 } |
6935 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 6875 Representation RequiredInputRepresentation(int index) OVERRIDE { |
6936 if (index == 0 && access().IsExternalMemory()) { | 6876 if (index == 0 && access().IsExternalMemory()) { |
6937 // object must be external in case of external memory access | 6877 // object must be external in case of external memory access |
6938 return Representation::External(); | 6878 return Representation::External(); |
6939 } else if (index == 1) { | 6879 } else if (index == 1) { |
6940 if (field_representation().IsInteger8() || | 6880 if (field_representation().IsInteger8() || |
6941 field_representation().IsUInteger8() || | 6881 field_representation().IsUInteger8() || |
6942 field_representation().IsInteger16() || | 6882 field_representation().IsInteger16() || |
6943 field_representation().IsUInteger16() || | 6883 field_representation().IsUInteger16() || |
6944 field_representation().IsInteger32()) { | 6884 field_representation().IsInteger32()) { |
6945 return Representation::Integer32(); | 6885 return Representation::Integer32(); |
(...skipping 11 matching lines...) Expand all Loading... |
6957 } | 6897 } |
6958 return Representation::Tagged(); | 6898 return Representation::Tagged(); |
6959 } | 6899 } |
6960 virtual bool HandleSideEffectDominator(GVNFlag side_effect, | 6900 virtual bool HandleSideEffectDominator(GVNFlag side_effect, |
6961 HValue* dominator) OVERRIDE { | 6901 HValue* dominator) OVERRIDE { |
6962 DCHECK(side_effect == kNewSpacePromotion); | 6902 DCHECK(side_effect == kNewSpacePromotion); |
6963 if (!FLAG_use_write_barrier_elimination) return false; | 6903 if (!FLAG_use_write_barrier_elimination) return false; |
6964 dominator_ = dominator; | 6904 dominator_ = dominator; |
6965 return false; | 6905 return false; |
6966 } | 6906 } |
6967 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 6907 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
6968 | 6908 |
6969 HValue* object() const { return OperandAt(0); } | 6909 HValue* object() const { return OperandAt(0); } |
6970 HValue* value() const { return OperandAt(1); } | 6910 HValue* value() const { return OperandAt(1); } |
6971 HValue* transition() const { return OperandAt(2); } | 6911 HValue* transition() const { return OperandAt(2); } |
6972 | 6912 |
6973 HObjectAccess access() const { return access_; } | 6913 HObjectAccess access() const { return access_; } |
6974 HValue* dominator() const { return dominator_; } | 6914 HValue* dominator() const { return dominator_; } |
6975 bool has_transition() const { return HasTransitionField::decode(bit_field_); } | 6915 bool has_transition() const { return HasTransitionField::decode(bit_field_); } |
6976 StoreFieldOrKeyedMode store_mode() const { | 6916 StoreFieldOrKeyedMode store_mode() const { |
6977 return StoreModeField::decode(bit_field_); | 6917 return StoreModeField::decode(bit_field_); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7071 public: | 7011 public: |
7072 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*, | 7012 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*, |
7073 Handle<String>, HValue*, | 7013 Handle<String>, HValue*, |
7074 StrictMode); | 7014 StrictMode); |
7075 HValue* object() const { return OperandAt(0); } | 7015 HValue* object() const { return OperandAt(0); } |
7076 HValue* value() const { return OperandAt(1); } | 7016 HValue* value() const { return OperandAt(1); } |
7077 HValue* context() const { return OperandAt(2); } | 7017 HValue* context() const { return OperandAt(2); } |
7078 Handle<String> name() const { return name_; } | 7018 Handle<String> name() const { return name_; } |
7079 StrictMode strict_mode() const { return strict_mode_; } | 7019 StrictMode strict_mode() const { return strict_mode_; } |
7080 | 7020 |
7081 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 7021 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
7082 | 7022 |
7083 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 7023 Representation RequiredInputRepresentation(int index) OVERRIDE { |
7084 return Representation::Tagged(); | 7024 return Representation::Tagged(); |
7085 } | 7025 } |
7086 | 7026 |
7087 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric) | 7027 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric) |
7088 | 7028 |
7089 private: | 7029 private: |
7090 HStoreNamedGeneric(HValue* context, | 7030 HStoreNamedGeneric(HValue* context, |
7091 HValue* object, | 7031 HValue* object, |
7092 Handle<String> name, | 7032 Handle<String> name, |
7093 HValue* value, | 7033 HValue* value, |
(...skipping 14 matching lines...) Expand all Loading... |
7108 class HStoreKeyed FINAL | 7048 class HStoreKeyed FINAL |
7109 : public HTemplateInstruction<3>, public ArrayInstructionInterface { | 7049 : public HTemplateInstruction<3>, public ArrayInstructionInterface { |
7110 public: | 7050 public: |
7111 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*, | 7051 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*, |
7112 ElementsKind); | 7052 ElementsKind); |
7113 DECLARE_INSTRUCTION_FACTORY_P5(HStoreKeyed, HValue*, HValue*, HValue*, | 7053 DECLARE_INSTRUCTION_FACTORY_P5(HStoreKeyed, HValue*, HValue*, HValue*, |
7114 ElementsKind, StoreFieldOrKeyedMode); | 7054 ElementsKind, StoreFieldOrKeyedMode); |
7115 DECLARE_INSTRUCTION_FACTORY_P6(HStoreKeyed, HValue*, HValue*, HValue*, | 7055 DECLARE_INSTRUCTION_FACTORY_P6(HStoreKeyed, HValue*, HValue*, HValue*, |
7116 ElementsKind, StoreFieldOrKeyedMode, int); | 7056 ElementsKind, StoreFieldOrKeyedMode, int); |
7117 | 7057 |
7118 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 7058 Representation RequiredInputRepresentation(int index) OVERRIDE { |
7119 // kind_fast: tagged[int32] = tagged | 7059 // kind_fast: tagged[int32] = tagged |
7120 // kind_double: tagged[int32] = double | 7060 // kind_double: tagged[int32] = double |
7121 // kind_smi : tagged[int32] = smi | 7061 // kind_smi : tagged[int32] = smi |
7122 // kind_fixed_typed_array: tagged[int32] = (double | int32) | 7062 // kind_fixed_typed_array: tagged[int32] = (double | int32) |
7123 // kind_external: external[int32] = (double | int32) | 7063 // kind_external: external[int32] = (double | int32) |
7124 if (index == 0) { | 7064 if (index == 0) { |
7125 return is_external() ? Representation::External() | 7065 return is_external() ? Representation::External() |
7126 : Representation::Tagged(); | 7066 : Representation::Tagged(); |
7127 } else if (index == 1) { | 7067 } else if (index == 1) { |
7128 return ArrayInstructionInterface::KeyedAccessIndexRequirement( | 7068 return ArrayInstructionInterface::KeyedAccessIndexRequirement( |
(...skipping 30 matching lines...) Expand all Loading... |
7159 } | 7099 } |
7160 | 7100 |
7161 bool is_fixed_typed_array() const { | 7101 bool is_fixed_typed_array() const { |
7162 return IsFixedTypedArrayElementsKind(elements_kind()); | 7102 return IsFixedTypedArrayElementsKind(elements_kind()); |
7163 } | 7103 } |
7164 | 7104 |
7165 bool is_typed_elements() const { | 7105 bool is_typed_elements() const { |
7166 return is_external() || is_fixed_typed_array(); | 7106 return is_external() || is_fixed_typed_array(); |
7167 } | 7107 } |
7168 | 7108 |
7169 virtual Representation observed_input_representation(int index) OVERRIDE { | 7109 Representation observed_input_representation(int index) OVERRIDE { |
7170 if (index < 2) return RequiredInputRepresentation(index); | 7110 if (index < 2) return RequiredInputRepresentation(index); |
7171 if (IsUninitialized()) { | 7111 if (IsUninitialized()) { |
7172 return Representation::None(); | 7112 return Representation::None(); |
7173 } | 7113 } |
7174 Representation r = | 7114 Representation r = |
7175 RequiredValueRepresentation(elements_kind(), store_mode()); | 7115 RequiredValueRepresentation(elements_kind(), store_mode()); |
7176 // For fast object elements kinds, don't assume anything. | 7116 // For fast object elements kinds, don't assume anything. |
7177 if (r.IsTagged()) return Representation::None(); | 7117 if (r.IsTagged()) return Representation::None(); |
7178 return r; | 7118 return r; |
7179 } | 7119 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7224 ReceiverObjectNeedsWriteBarrier(elements(), value(), dominator()); | 7164 ReceiverObjectNeedsWriteBarrier(elements(), value(), dominator()); |
7225 } | 7165 } |
7226 } | 7166 } |
7227 | 7167 |
7228 PointersToHereCheck PointersToHereCheckForValue() const { | 7168 PointersToHereCheck PointersToHereCheckForValue() const { |
7229 return PointersToHereCheckForObject(value(), dominator()); | 7169 return PointersToHereCheckForObject(value(), dominator()); |
7230 } | 7170 } |
7231 | 7171 |
7232 bool NeedsCanonicalization(); | 7172 bool NeedsCanonicalization(); |
7233 | 7173 |
7234 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 7174 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
7235 | 7175 |
7236 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) | 7176 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) |
7237 | 7177 |
7238 private: | 7178 private: |
7239 HStoreKeyed(HValue* obj, HValue* key, HValue* val, ElementsKind elements_kind, | 7179 HStoreKeyed(HValue* obj, HValue* key, HValue* val, ElementsKind elements_kind, |
7240 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE, | 7180 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE, |
7241 int offset = kDefaultKeyedHeaderOffsetSentinel) | 7181 int offset = kDefaultKeyedHeaderOffsetSentinel) |
7242 : base_offset_(offset == kDefaultKeyedHeaderOffsetSentinel | 7182 : base_offset_(offset == kDefaultKeyedHeaderOffsetSentinel |
7243 ? GetDefaultHeaderSizeForElementsKind(elements_kind) | 7183 ? GetDefaultHeaderSizeForElementsKind(elements_kind) |
7244 : offset), | 7184 : offset), |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7293 public: | 7233 public: |
7294 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*, | 7234 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*, |
7295 HValue*, HValue*, StrictMode); | 7235 HValue*, HValue*, StrictMode); |
7296 | 7236 |
7297 HValue* object() const { return OperandAt(0); } | 7237 HValue* object() const { return OperandAt(0); } |
7298 HValue* key() const { return OperandAt(1); } | 7238 HValue* key() const { return OperandAt(1); } |
7299 HValue* value() const { return OperandAt(2); } | 7239 HValue* value() const { return OperandAt(2); } |
7300 HValue* context() const { return OperandAt(3); } | 7240 HValue* context() const { return OperandAt(3); } |
7301 StrictMode strict_mode() const { return strict_mode_; } | 7241 StrictMode strict_mode() const { return strict_mode_; } |
7302 | 7242 |
7303 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 7243 Representation RequiredInputRepresentation(int index) OVERRIDE { |
7304 // tagged[tagged] = tagged | 7244 // tagged[tagged] = tagged |
7305 return Representation::Tagged(); | 7245 return Representation::Tagged(); |
7306 } | 7246 } |
7307 | 7247 |
7308 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 7248 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
7309 | 7249 |
7310 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric) | 7250 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric) |
7311 | 7251 |
7312 private: | 7252 private: |
7313 HStoreKeyedGeneric(HValue* context, | 7253 HStoreKeyedGeneric(HValue* context, |
7314 HValue* object, | 7254 HValue* object, |
7315 HValue* key, | 7255 HValue* key, |
7316 HValue* value, | 7256 HValue* value, |
7317 StrictMode strict_mode) | 7257 StrictMode strict_mode) |
7318 : strict_mode_(strict_mode) { | 7258 : strict_mode_(strict_mode) { |
(...skipping 12 matching lines...) Expand all Loading... |
7331 public: | 7271 public: |
7332 inline static HTransitionElementsKind* New(Zone* zone, | 7272 inline static HTransitionElementsKind* New(Zone* zone, |
7333 HValue* context, | 7273 HValue* context, |
7334 HValue* object, | 7274 HValue* object, |
7335 Handle<Map> original_map, | 7275 Handle<Map> original_map, |
7336 Handle<Map> transitioned_map) { | 7276 Handle<Map> transitioned_map) { |
7337 return new(zone) HTransitionElementsKind(context, object, | 7277 return new(zone) HTransitionElementsKind(context, object, |
7338 original_map, transitioned_map); | 7278 original_map, transitioned_map); |
7339 } | 7279 } |
7340 | 7280 |
7341 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 7281 Representation RequiredInputRepresentation(int index) OVERRIDE { |
7342 return Representation::Tagged(); | 7282 return Representation::Tagged(); |
7343 } | 7283 } |
7344 | 7284 |
7345 HValue* object() const { return OperandAt(0); } | 7285 HValue* object() const { return OperandAt(0); } |
7346 HValue* context() const { return OperandAt(1); } | 7286 HValue* context() const { return OperandAt(1); } |
7347 Unique<Map> original_map() const { return original_map_; } | 7287 Unique<Map> original_map() const { return original_map_; } |
7348 Unique<Map> transitioned_map() const { return transitioned_map_; } | 7288 Unique<Map> transitioned_map() const { return transitioned_map_; } |
7349 ElementsKind from_kind() const { return from_kind_; } | 7289 ElementsKind from_kind() const { return from_kind_; } |
7350 ElementsKind to_kind() const { return to_kind_; } | 7290 ElementsKind to_kind() const { return to_kind_; } |
7351 | 7291 |
7352 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 7292 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
7353 | 7293 |
7354 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind) | 7294 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind) |
7355 | 7295 |
7356 protected: | 7296 protected: |
7357 virtual bool DataEquals(HValue* other) OVERRIDE { | 7297 bool DataEquals(HValue* other) OVERRIDE { |
7358 HTransitionElementsKind* instr = HTransitionElementsKind::cast(other); | 7298 HTransitionElementsKind* instr = HTransitionElementsKind::cast(other); |
7359 return original_map_ == instr->original_map_ && | 7299 return original_map_ == instr->original_map_ && |
7360 transitioned_map_ == instr->transitioned_map_; | 7300 transitioned_map_ == instr->transitioned_map_; |
7361 } | 7301 } |
7362 | 7302 |
7363 virtual int RedefinedOperandIndex() OVERRIDE { return 0; } | 7303 int RedefinedOperandIndex() OVERRIDE { return 0; } |
7364 | 7304 |
7365 private: | 7305 private: |
7366 HTransitionElementsKind(HValue* context, | 7306 HTransitionElementsKind(HValue* context, |
7367 HValue* object, | 7307 HValue* object, |
7368 Handle<Map> original_map, | 7308 Handle<Map> original_map, |
7369 Handle<Map> transitioned_map) | 7309 Handle<Map> transitioned_map) |
7370 : original_map_(Unique<Map>(original_map)), | 7310 : original_map_(Unique<Map>(original_map)), |
7371 transitioned_map_(Unique<Map>(transitioned_map)), | 7311 transitioned_map_(Unique<Map>(transitioned_map)), |
7372 from_kind_(original_map->elements_kind()), | 7312 from_kind_(original_map->elements_kind()), |
7373 to_kind_(transitioned_map->elements_kind()) { | 7313 to_kind_(transitioned_map->elements_kind()) { |
(...skipping 22 matching lines...) Expand all Loading... |
7396 HValue* left, | 7336 HValue* left, |
7397 HValue* right, | 7337 HValue* right, |
7398 PretenureFlag pretenure_flag = NOT_TENURED, | 7338 PretenureFlag pretenure_flag = NOT_TENURED, |
7399 StringAddFlags flags = STRING_ADD_CHECK_BOTH, | 7339 StringAddFlags flags = STRING_ADD_CHECK_BOTH, |
7400 Handle<AllocationSite> allocation_site = | 7340 Handle<AllocationSite> allocation_site = |
7401 Handle<AllocationSite>::null()); | 7341 Handle<AllocationSite>::null()); |
7402 | 7342 |
7403 StringAddFlags flags() const { return flags_; } | 7343 StringAddFlags flags() const { return flags_; } |
7404 PretenureFlag pretenure_flag() const { return pretenure_flag_; } | 7344 PretenureFlag pretenure_flag() const { return pretenure_flag_; } |
7405 | 7345 |
7406 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 7346 Representation RequiredInputRepresentation(int index) OVERRIDE { |
7407 return Representation::Tagged(); | 7347 return Representation::Tagged(); |
7408 } | 7348 } |
7409 | 7349 |
7410 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 7350 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
7411 | 7351 |
7412 DECLARE_CONCRETE_INSTRUCTION(StringAdd) | 7352 DECLARE_CONCRETE_INSTRUCTION(StringAdd) |
7413 | 7353 |
7414 protected: | 7354 protected: |
7415 virtual bool DataEquals(HValue* other) OVERRIDE { | 7355 bool DataEquals(HValue* other) OVERRIDE { |
7416 return flags_ == HStringAdd::cast(other)->flags_ && | 7356 return flags_ == HStringAdd::cast(other)->flags_ && |
7417 pretenure_flag_ == HStringAdd::cast(other)->pretenure_flag_; | 7357 pretenure_flag_ == HStringAdd::cast(other)->pretenure_flag_; |
7418 } | 7358 } |
7419 | 7359 |
7420 private: | 7360 private: |
7421 HStringAdd(HValue* context, | 7361 HStringAdd(HValue* context, |
7422 HValue* left, | 7362 HValue* left, |
7423 HValue* right, | 7363 HValue* right, |
7424 PretenureFlag pretenure_flag, | 7364 PretenureFlag pretenure_flag, |
7425 StringAddFlags flags, | 7365 StringAddFlags flags, |
7426 Handle<AllocationSite> allocation_site) | 7366 Handle<AllocationSite> allocation_site) |
7427 : HBinaryOperation(context, left, right, HType::String()), | 7367 : HBinaryOperation(context, left, right, HType::String()), |
7428 flags_(flags), pretenure_flag_(pretenure_flag) { | 7368 flags_(flags), pretenure_flag_(pretenure_flag) { |
7429 set_representation(Representation::Tagged()); | 7369 set_representation(Representation::Tagged()); |
7430 SetFlag(kUseGVN); | 7370 SetFlag(kUseGVN); |
7431 SetDependsOnFlag(kMaps); | 7371 SetDependsOnFlag(kMaps); |
7432 SetChangesFlag(kNewSpacePromotion); | 7372 SetChangesFlag(kNewSpacePromotion); |
7433 if (FLAG_trace_pretenuring) { | 7373 if (FLAG_trace_pretenuring) { |
7434 PrintF("HStringAdd with AllocationSite %p %s\n", | 7374 PrintF("HStringAdd with AllocationSite %p %s\n", |
7435 allocation_site.is_null() | 7375 allocation_site.is_null() |
7436 ? static_cast<void*>(NULL) | 7376 ? static_cast<void*>(NULL) |
7437 : static_cast<void*>(*allocation_site), | 7377 : static_cast<void*>(*allocation_site), |
7438 pretenure_flag == TENURED ? "tenured" : "not tenured"); | 7378 pretenure_flag == TENURED ? "tenured" : "not tenured"); |
7439 } | 7379 } |
7440 } | 7380 } |
7441 | 7381 |
7442 // No side-effects except possible allocation: | 7382 // No side-effects except possible allocation: |
7443 virtual bool IsDeletable() const OVERRIDE { return true; } | 7383 bool IsDeletable() const OVERRIDE { return true; } |
7444 | 7384 |
7445 const StringAddFlags flags_; | 7385 const StringAddFlags flags_; |
7446 const PretenureFlag pretenure_flag_; | 7386 const PretenureFlag pretenure_flag_; |
7447 }; | 7387 }; |
7448 | 7388 |
7449 | 7389 |
7450 class HStringCharCodeAt FINAL : public HTemplateInstruction<3> { | 7390 class HStringCharCodeAt FINAL : public HTemplateInstruction<3> { |
7451 public: | 7391 public: |
7452 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HStringCharCodeAt, | 7392 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HStringCharCodeAt, |
7453 HValue*, | 7393 HValue*, |
7454 HValue*); | 7394 HValue*); |
7455 | 7395 |
7456 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 7396 Representation RequiredInputRepresentation(int index) OVERRIDE { |
7457 // The index is supposed to be Integer32. | 7397 // The index is supposed to be Integer32. |
7458 return index == 2 | 7398 return index == 2 |
7459 ? Representation::Integer32() | 7399 ? Representation::Integer32() |
7460 : Representation::Tagged(); | 7400 : Representation::Tagged(); |
7461 } | 7401 } |
7462 | 7402 |
7463 HValue* context() const { return OperandAt(0); } | 7403 HValue* context() const { return OperandAt(0); } |
7464 HValue* string() const { return OperandAt(1); } | 7404 HValue* string() const { return OperandAt(1); } |
7465 HValue* index() const { return OperandAt(2); } | 7405 HValue* index() const { return OperandAt(2); } |
7466 | 7406 |
7467 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt) | 7407 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt) |
7468 | 7408 |
7469 protected: | 7409 protected: |
7470 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 7410 bool DataEquals(HValue* other) OVERRIDE { return true; } |
7471 | 7411 |
7472 virtual Range* InferRange(Zone* zone) OVERRIDE { | 7412 Range* InferRange(Zone* zone) OVERRIDE { |
7473 return new(zone) Range(0, String::kMaxUtf16CodeUnit); | 7413 return new(zone) Range(0, String::kMaxUtf16CodeUnit); |
7474 } | 7414 } |
7475 | 7415 |
7476 private: | 7416 private: |
7477 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { | 7417 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { |
7478 SetOperandAt(0, context); | 7418 SetOperandAt(0, context); |
7479 SetOperandAt(1, string); | 7419 SetOperandAt(1, string); |
7480 SetOperandAt(2, index); | 7420 SetOperandAt(2, index); |
7481 set_representation(Representation::Integer32()); | 7421 set_representation(Representation::Integer32()); |
7482 SetFlag(kUseGVN); | 7422 SetFlag(kUseGVN); |
7483 SetDependsOnFlag(kMaps); | 7423 SetDependsOnFlag(kMaps); |
7484 SetDependsOnFlag(kStringChars); | 7424 SetDependsOnFlag(kStringChars); |
7485 SetChangesFlag(kNewSpacePromotion); | 7425 SetChangesFlag(kNewSpacePromotion); |
7486 } | 7426 } |
7487 | 7427 |
7488 // No side effects: runtime function assumes string + number inputs. | 7428 // No side effects: runtime function assumes string + number inputs. |
7489 virtual bool IsDeletable() const OVERRIDE { return true; } | 7429 bool IsDeletable() const OVERRIDE { return true; } |
7490 }; | 7430 }; |
7491 | 7431 |
7492 | 7432 |
7493 class HStringCharFromCode FINAL : public HTemplateInstruction<2> { | 7433 class HStringCharFromCode FINAL : public HTemplateInstruction<2> { |
7494 public: | 7434 public: |
7495 static HInstruction* New(Zone* zone, | 7435 static HInstruction* New(Zone* zone, |
7496 HValue* context, | 7436 HValue* context, |
7497 HValue* char_code); | 7437 HValue* char_code); |
7498 | 7438 |
7499 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 7439 Representation RequiredInputRepresentation(int index) OVERRIDE { |
7500 return index == 0 | 7440 return index == 0 |
7501 ? Representation::Tagged() | 7441 ? Representation::Tagged() |
7502 : Representation::Integer32(); | 7442 : Representation::Integer32(); |
7503 } | 7443 } |
7504 | 7444 |
7505 HValue* context() const { return OperandAt(0); } | 7445 HValue* context() const { return OperandAt(0); } |
7506 HValue* value() const { return OperandAt(1); } | 7446 HValue* value() const { return OperandAt(1); } |
7507 | 7447 |
7508 virtual bool DataEquals(HValue* other) OVERRIDE { return true; } | 7448 bool DataEquals(HValue* other) OVERRIDE { return true; } |
7509 | 7449 |
7510 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode) | 7450 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode) |
7511 | 7451 |
7512 private: | 7452 private: |
7513 HStringCharFromCode(HValue* context, HValue* char_code) | 7453 HStringCharFromCode(HValue* context, HValue* char_code) |
7514 : HTemplateInstruction<2>(HType::String()) { | 7454 : HTemplateInstruction<2>(HType::String()) { |
7515 SetOperandAt(0, context); | 7455 SetOperandAt(0, context); |
7516 SetOperandAt(1, char_code); | 7456 SetOperandAt(1, char_code); |
7517 set_representation(Representation::Tagged()); | 7457 set_representation(Representation::Tagged()); |
7518 SetFlag(kUseGVN); | 7458 SetFlag(kUseGVN); |
7519 SetChangesFlag(kNewSpacePromotion); | 7459 SetChangesFlag(kNewSpacePromotion); |
7520 } | 7460 } |
7521 | 7461 |
7522 virtual bool IsDeletable() const OVERRIDE { | 7462 bool IsDeletable() const OVERRIDE { |
7523 return !value()->ToNumberCanBeObserved(); | 7463 return !value()->ToNumberCanBeObserved(); |
7524 } | 7464 } |
7525 }; | 7465 }; |
7526 | 7466 |
7527 | 7467 |
7528 template <int V> | 7468 template <int V> |
7529 class HMaterializedLiteral : public HTemplateInstruction<V> { | 7469 class HMaterializedLiteral : public HTemplateInstruction<V> { |
7530 public: | 7470 public: |
7531 HMaterializedLiteral<V>(int index, int depth, AllocationSiteMode mode) | 7471 HMaterializedLiteral<V>(int index, int depth, AllocationSiteMode mode) |
7532 : literal_index_(index), depth_(depth), allocation_site_mode_(mode) { | 7472 : literal_index_(index), depth_(depth), allocation_site_mode_(mode) { |
7533 this->set_representation(Representation::Tagged()); | 7473 this->set_representation(Representation::Tagged()); |
7534 } | 7474 } |
7535 | 7475 |
7536 HMaterializedLiteral<V>(int index, int depth) | 7476 HMaterializedLiteral<V>(int index, int depth) |
7537 : literal_index_(index), depth_(depth), | 7477 : literal_index_(index), depth_(depth), |
7538 allocation_site_mode_(DONT_TRACK_ALLOCATION_SITE) { | 7478 allocation_site_mode_(DONT_TRACK_ALLOCATION_SITE) { |
7539 this->set_representation(Representation::Tagged()); | 7479 this->set_representation(Representation::Tagged()); |
7540 } | 7480 } |
7541 | 7481 |
7542 int literal_index() const { return literal_index_; } | 7482 int literal_index() const { return literal_index_; } |
7543 int depth() const { return depth_; } | 7483 int depth() const { return depth_; } |
7544 AllocationSiteMode allocation_site_mode() const { | 7484 AllocationSiteMode allocation_site_mode() const { |
7545 return allocation_site_mode_; | 7485 return allocation_site_mode_; |
7546 } | 7486 } |
7547 | 7487 |
7548 private: | 7488 private: |
7549 virtual bool IsDeletable() const FINAL OVERRIDE { return true; } | 7489 bool IsDeletable() const FINAL { return true; } |
7550 | 7490 |
7551 int literal_index_; | 7491 int literal_index_; |
7552 int depth_; | 7492 int depth_; |
7553 AllocationSiteMode allocation_site_mode_; | 7493 AllocationSiteMode allocation_site_mode_; |
7554 }; | 7494 }; |
7555 | 7495 |
7556 | 7496 |
7557 class HRegExpLiteral FINAL : public HMaterializedLiteral<1> { | 7497 class HRegExpLiteral FINAL : public HMaterializedLiteral<1> { |
7558 public: | 7498 public: |
7559 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HRegExpLiteral, | 7499 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HRegExpLiteral, |
7560 Handle<FixedArray>, | 7500 Handle<FixedArray>, |
7561 Handle<String>, | 7501 Handle<String>, |
7562 Handle<String>, | 7502 Handle<String>, |
7563 int); | 7503 int); |
7564 | 7504 |
7565 HValue* context() { return OperandAt(0); } | 7505 HValue* context() { return OperandAt(0); } |
7566 Handle<FixedArray> literals() { return literals_; } | 7506 Handle<FixedArray> literals() { return literals_; } |
7567 Handle<String> pattern() { return pattern_; } | 7507 Handle<String> pattern() { return pattern_; } |
7568 Handle<String> flags() { return flags_; } | 7508 Handle<String> flags() { return flags_; } |
7569 | 7509 |
7570 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 7510 Representation RequiredInputRepresentation(int index) OVERRIDE { |
7571 return Representation::Tagged(); | 7511 return Representation::Tagged(); |
7572 } | 7512 } |
7573 | 7513 |
7574 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral) | 7514 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral) |
7575 | 7515 |
7576 private: | 7516 private: |
7577 HRegExpLiteral(HValue* context, | 7517 HRegExpLiteral(HValue* context, |
7578 Handle<FixedArray> literals, | 7518 Handle<FixedArray> literals, |
7579 Handle<String> pattern, | 7519 Handle<String> pattern, |
7580 Handle<String> flags, | 7520 Handle<String> flags, |
(...skipping 13 matching lines...) Expand all Loading... |
7594 }; | 7534 }; |
7595 | 7535 |
7596 | 7536 |
7597 class HFunctionLiteral FINAL : public HTemplateInstruction<1> { | 7537 class HFunctionLiteral FINAL : public HTemplateInstruction<1> { |
7598 public: | 7538 public: |
7599 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HFunctionLiteral, | 7539 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HFunctionLiteral, |
7600 Handle<SharedFunctionInfo>, | 7540 Handle<SharedFunctionInfo>, |
7601 bool); | 7541 bool); |
7602 HValue* context() { return OperandAt(0); } | 7542 HValue* context() { return OperandAt(0); } |
7603 | 7543 |
7604 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 7544 Representation RequiredInputRepresentation(int index) OVERRIDE { |
7605 return Representation::Tagged(); | 7545 return Representation::Tagged(); |
7606 } | 7546 } |
7607 | 7547 |
7608 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) | 7548 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) |
7609 | 7549 |
7610 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } | 7550 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } |
7611 bool pretenure() const { return PretenureField::decode(bit_field_); } | 7551 bool pretenure() const { return PretenureField::decode(bit_field_); } |
7612 bool has_no_literals() const { | 7552 bool has_no_literals() const { |
7613 return HasNoLiteralsField::decode(bit_field_); | 7553 return HasNoLiteralsField::decode(bit_field_); |
7614 } | 7554 } |
(...skipping 11 matching lines...) Expand all Loading... |
7626 shared_info_(shared), | 7566 shared_info_(shared), |
7627 bit_field_(FunctionKindField::encode(shared->kind()) | | 7567 bit_field_(FunctionKindField::encode(shared->kind()) | |
7628 PretenureField::encode(pretenure) | | 7568 PretenureField::encode(pretenure) | |
7629 HasNoLiteralsField::encode(shared->num_literals() == 0) | | 7569 HasNoLiteralsField::encode(shared->num_literals() == 0) | |
7630 StrictModeField::encode(shared->strict_mode())) { | 7570 StrictModeField::encode(shared->strict_mode())) { |
7631 SetOperandAt(0, context); | 7571 SetOperandAt(0, context); |
7632 set_representation(Representation::Tagged()); | 7572 set_representation(Representation::Tagged()); |
7633 SetChangesFlag(kNewSpacePromotion); | 7573 SetChangesFlag(kNewSpacePromotion); |
7634 } | 7574 } |
7635 | 7575 |
7636 virtual bool IsDeletable() const OVERRIDE { return true; } | 7576 bool IsDeletable() const OVERRIDE { return true; } |
7637 | 7577 |
7638 class FunctionKindField : public BitField<FunctionKind, 0, 4> {}; | 7578 class FunctionKindField : public BitField<FunctionKind, 0, 4> {}; |
7639 class PretenureField : public BitField<bool, 5, 1> {}; | 7579 class PretenureField : public BitField<bool, 5, 1> {}; |
7640 class HasNoLiteralsField : public BitField<bool, 6, 1> {}; | 7580 class HasNoLiteralsField : public BitField<bool, 6, 1> {}; |
7641 class StrictModeField : public BitField<StrictMode, 7, 1> {}; | 7581 class StrictModeField : public BitField<StrictMode, 7, 1> {}; |
7642 | 7582 |
7643 Handle<SharedFunctionInfo> shared_info_; | 7583 Handle<SharedFunctionInfo> shared_info_; |
7644 uint32_t bit_field_; | 7584 uint32_t bit_field_; |
7645 }; | 7585 }; |
7646 | 7586 |
7647 | 7587 |
7648 class HTypeof FINAL : public HTemplateInstruction<2> { | 7588 class HTypeof FINAL : public HTemplateInstruction<2> { |
7649 public: | 7589 public: |
7650 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HTypeof, HValue*); | 7590 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HTypeof, HValue*); |
7651 | 7591 |
7652 HValue* context() const { return OperandAt(0); } | 7592 HValue* context() const { return OperandAt(0); } |
7653 HValue* value() const { return OperandAt(1); } | 7593 HValue* value() const { return OperandAt(1); } |
7654 | 7594 |
7655 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 7595 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
7656 | 7596 |
7657 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 7597 Representation RequiredInputRepresentation(int index) OVERRIDE { |
7658 return Representation::Tagged(); | 7598 return Representation::Tagged(); |
7659 } | 7599 } |
7660 | 7600 |
7661 DECLARE_CONCRETE_INSTRUCTION(Typeof) | 7601 DECLARE_CONCRETE_INSTRUCTION(Typeof) |
7662 | 7602 |
7663 private: | 7603 private: |
7664 explicit HTypeof(HValue* context, HValue* value) { | 7604 explicit HTypeof(HValue* context, HValue* value) { |
7665 SetOperandAt(0, context); | 7605 SetOperandAt(0, context); |
7666 SetOperandAt(1, value); | 7606 SetOperandAt(1, value); |
7667 set_representation(Representation::Tagged()); | 7607 set_representation(Representation::Tagged()); |
7668 } | 7608 } |
7669 | 7609 |
7670 virtual bool IsDeletable() const OVERRIDE { return true; } | 7610 bool IsDeletable() const OVERRIDE { return true; } |
7671 }; | 7611 }; |
7672 | 7612 |
7673 | 7613 |
7674 class HTrapAllocationMemento FINAL : public HTemplateInstruction<1> { | 7614 class HTrapAllocationMemento FINAL : public HTemplateInstruction<1> { |
7675 public: | 7615 public: |
7676 DECLARE_INSTRUCTION_FACTORY_P1(HTrapAllocationMemento, HValue*); | 7616 DECLARE_INSTRUCTION_FACTORY_P1(HTrapAllocationMemento, HValue*); |
7677 | 7617 |
7678 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 7618 Representation RequiredInputRepresentation(int index) OVERRIDE { |
7679 return Representation::Tagged(); | 7619 return Representation::Tagged(); |
7680 } | 7620 } |
7681 | 7621 |
7682 HValue* object() { return OperandAt(0); } | 7622 HValue* object() { return OperandAt(0); } |
7683 | 7623 |
7684 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento) | 7624 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento) |
7685 | 7625 |
7686 private: | 7626 private: |
7687 explicit HTrapAllocationMemento(HValue* obj) { | 7627 explicit HTrapAllocationMemento(HValue* obj) { |
7688 SetOperandAt(0, obj); | 7628 SetOperandAt(0, obj); |
7689 } | 7629 } |
7690 }; | 7630 }; |
7691 | 7631 |
7692 | 7632 |
7693 class HToFastProperties FINAL : public HUnaryOperation { | 7633 class HToFastProperties FINAL : public HUnaryOperation { |
7694 public: | 7634 public: |
7695 DECLARE_INSTRUCTION_FACTORY_P1(HToFastProperties, HValue*); | 7635 DECLARE_INSTRUCTION_FACTORY_P1(HToFastProperties, HValue*); |
7696 | 7636 |
7697 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 7637 Representation RequiredInputRepresentation(int index) OVERRIDE { |
7698 return Representation::Tagged(); | 7638 return Representation::Tagged(); |
7699 } | 7639 } |
7700 | 7640 |
7701 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) | 7641 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) |
7702 | 7642 |
7703 private: | 7643 private: |
7704 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { | 7644 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { |
7705 set_representation(Representation::Tagged()); | 7645 set_representation(Representation::Tagged()); |
7706 SetChangesFlag(kNewSpacePromotion); | 7646 SetChangesFlag(kNewSpacePromotion); |
7707 | 7647 |
7708 // This instruction is not marked as kChangesMaps, but does | 7648 // This instruction is not marked as kChangesMaps, but does |
7709 // change the map of the input operand. Use it only when creating | 7649 // change the map of the input operand. Use it only when creating |
7710 // object literals via a runtime call. | 7650 // object literals via a runtime call. |
7711 DCHECK(value->IsCallRuntime()); | 7651 DCHECK(value->IsCallRuntime()); |
7712 #ifdef DEBUG | 7652 #ifdef DEBUG |
7713 const Runtime::Function* function = HCallRuntime::cast(value)->function(); | 7653 const Runtime::Function* function = HCallRuntime::cast(value)->function(); |
7714 DCHECK(function->function_id == Runtime::kCreateObjectLiteral); | 7654 DCHECK(function->function_id == Runtime::kCreateObjectLiteral); |
7715 #endif | 7655 #endif |
7716 } | 7656 } |
7717 | 7657 |
7718 virtual bool IsDeletable() const OVERRIDE { return true; } | 7658 bool IsDeletable() const OVERRIDE { return true; } |
7719 }; | 7659 }; |
7720 | 7660 |
7721 | 7661 |
7722 class HDateField FINAL : public HUnaryOperation { | 7662 class HDateField FINAL : public HUnaryOperation { |
7723 public: | 7663 public: |
7724 DECLARE_INSTRUCTION_FACTORY_P2(HDateField, HValue*, Smi*); | 7664 DECLARE_INSTRUCTION_FACTORY_P2(HDateField, HValue*, Smi*); |
7725 | 7665 |
7726 Smi* index() const { return index_; } | 7666 Smi* index() const { return index_; } |
7727 | 7667 |
7728 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 7668 Representation RequiredInputRepresentation(int index) OVERRIDE { |
7729 return Representation::Tagged(); | 7669 return Representation::Tagged(); |
7730 } | 7670 } |
7731 | 7671 |
7732 DECLARE_CONCRETE_INSTRUCTION(DateField) | 7672 DECLARE_CONCRETE_INSTRUCTION(DateField) |
7733 | 7673 |
7734 private: | 7674 private: |
7735 HDateField(HValue* date, Smi* index) | 7675 HDateField(HValue* date, Smi* index) |
7736 : HUnaryOperation(date), index_(index) { | 7676 : HUnaryOperation(date), index_(index) { |
7737 set_representation(Representation::Tagged()); | 7677 set_representation(Representation::Tagged()); |
7738 } | 7678 } |
7739 | 7679 |
7740 Smi* index_; | 7680 Smi* index_; |
7741 }; | 7681 }; |
7742 | 7682 |
7743 | 7683 |
7744 class HSeqStringGetChar FINAL : public HTemplateInstruction<2> { | 7684 class HSeqStringGetChar FINAL : public HTemplateInstruction<2> { |
7745 public: | 7685 public: |
7746 static HInstruction* New(Zone* zone, | 7686 static HInstruction* New(Zone* zone, |
7747 HValue* context, | 7687 HValue* context, |
7748 String::Encoding encoding, | 7688 String::Encoding encoding, |
7749 HValue* string, | 7689 HValue* string, |
7750 HValue* index); | 7690 HValue* index); |
7751 | 7691 |
7752 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 7692 Representation RequiredInputRepresentation(int index) OVERRIDE { |
7753 return (index == 0) ? Representation::Tagged() | 7693 return (index == 0) ? Representation::Tagged() |
7754 : Representation::Integer32(); | 7694 : Representation::Integer32(); |
7755 } | 7695 } |
7756 | 7696 |
7757 String::Encoding encoding() const { return encoding_; } | 7697 String::Encoding encoding() const { return encoding_; } |
7758 HValue* string() const { return OperandAt(0); } | 7698 HValue* string() const { return OperandAt(0); } |
7759 HValue* index() const { return OperandAt(1); } | 7699 HValue* index() const { return OperandAt(1); } |
7760 | 7700 |
7761 DECLARE_CONCRETE_INSTRUCTION(SeqStringGetChar) | 7701 DECLARE_CONCRETE_INSTRUCTION(SeqStringGetChar) |
7762 | 7702 |
7763 protected: | 7703 protected: |
7764 virtual bool DataEquals(HValue* other) OVERRIDE { | 7704 bool DataEquals(HValue* other) OVERRIDE { |
7765 return encoding() == HSeqStringGetChar::cast(other)->encoding(); | 7705 return encoding() == HSeqStringGetChar::cast(other)->encoding(); |
7766 } | 7706 } |
7767 | 7707 |
7768 virtual Range* InferRange(Zone* zone) OVERRIDE { | 7708 Range* InferRange(Zone* zone) OVERRIDE { |
7769 if (encoding() == String::ONE_BYTE_ENCODING) { | 7709 if (encoding() == String::ONE_BYTE_ENCODING) { |
7770 return new(zone) Range(0, String::kMaxOneByteCharCode); | 7710 return new(zone) Range(0, String::kMaxOneByteCharCode); |
7771 } else { | 7711 } else { |
7772 DCHECK_EQ(String::TWO_BYTE_ENCODING, encoding()); | 7712 DCHECK_EQ(String::TWO_BYTE_ENCODING, encoding()); |
7773 return new(zone) Range(0, String::kMaxUtf16CodeUnit); | 7713 return new(zone) Range(0, String::kMaxUtf16CodeUnit); |
7774 } | 7714 } |
7775 } | 7715 } |
7776 | 7716 |
7777 private: | 7717 private: |
7778 HSeqStringGetChar(String::Encoding encoding, | 7718 HSeqStringGetChar(String::Encoding encoding, |
7779 HValue* string, | 7719 HValue* string, |
7780 HValue* index) : encoding_(encoding) { | 7720 HValue* index) : encoding_(encoding) { |
7781 SetOperandAt(0, string); | 7721 SetOperandAt(0, string); |
7782 SetOperandAt(1, index); | 7722 SetOperandAt(1, index); |
7783 set_representation(Representation::Integer32()); | 7723 set_representation(Representation::Integer32()); |
7784 SetFlag(kUseGVN); | 7724 SetFlag(kUseGVN); |
7785 SetDependsOnFlag(kStringChars); | 7725 SetDependsOnFlag(kStringChars); |
7786 } | 7726 } |
7787 | 7727 |
7788 virtual bool IsDeletable() const OVERRIDE { return true; } | 7728 bool IsDeletable() const OVERRIDE { return true; } |
7789 | 7729 |
7790 String::Encoding encoding_; | 7730 String::Encoding encoding_; |
7791 }; | 7731 }; |
7792 | 7732 |
7793 | 7733 |
7794 class HSeqStringSetChar FINAL : public HTemplateInstruction<4> { | 7734 class HSeqStringSetChar FINAL : public HTemplateInstruction<4> { |
7795 public: | 7735 public: |
7796 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4( | 7736 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4( |
7797 HSeqStringSetChar, String::Encoding, | 7737 HSeqStringSetChar, String::Encoding, |
7798 HValue*, HValue*, HValue*); | 7738 HValue*, HValue*, HValue*); |
7799 | 7739 |
7800 String::Encoding encoding() { return encoding_; } | 7740 String::Encoding encoding() { return encoding_; } |
7801 HValue* context() { return OperandAt(0); } | 7741 HValue* context() { return OperandAt(0); } |
7802 HValue* string() { return OperandAt(1); } | 7742 HValue* string() { return OperandAt(1); } |
7803 HValue* index() { return OperandAt(2); } | 7743 HValue* index() { return OperandAt(2); } |
7804 HValue* value() { return OperandAt(3); } | 7744 HValue* value() { return OperandAt(3); } |
7805 | 7745 |
7806 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 7746 Representation RequiredInputRepresentation(int index) OVERRIDE { |
7807 return (index <= 1) ? Representation::Tagged() | 7747 return (index <= 1) ? Representation::Tagged() |
7808 : Representation::Integer32(); | 7748 : Representation::Integer32(); |
7809 } | 7749 } |
7810 | 7750 |
7811 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar) | 7751 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar) |
7812 | 7752 |
7813 private: | 7753 private: |
7814 HSeqStringSetChar(HValue* context, | 7754 HSeqStringSetChar(HValue* context, |
7815 String::Encoding encoding, | 7755 String::Encoding encoding, |
7816 HValue* string, | 7756 HValue* string, |
7817 HValue* index, | 7757 HValue* index, |
7818 HValue* value) : encoding_(encoding) { | 7758 HValue* value) : encoding_(encoding) { |
7819 SetOperandAt(0, context); | 7759 SetOperandAt(0, context); |
7820 SetOperandAt(1, string); | 7760 SetOperandAt(1, string); |
7821 SetOperandAt(2, index); | 7761 SetOperandAt(2, index); |
7822 SetOperandAt(3, value); | 7762 SetOperandAt(3, value); |
7823 set_representation(Representation::Tagged()); | 7763 set_representation(Representation::Tagged()); |
7824 SetChangesFlag(kStringChars); | 7764 SetChangesFlag(kStringChars); |
7825 } | 7765 } |
7826 | 7766 |
7827 String::Encoding encoding_; | 7767 String::Encoding encoding_; |
7828 }; | 7768 }; |
7829 | 7769 |
7830 | 7770 |
7831 class HCheckMapValue FINAL : public HTemplateInstruction<2> { | 7771 class HCheckMapValue FINAL : public HTemplateInstruction<2> { |
7832 public: | 7772 public: |
7833 DECLARE_INSTRUCTION_FACTORY_P2(HCheckMapValue, HValue*, HValue*); | 7773 DECLARE_INSTRUCTION_FACTORY_P2(HCheckMapValue, HValue*, HValue*); |
7834 | 7774 |
7835 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 7775 Representation RequiredInputRepresentation(int index) OVERRIDE { |
7836 return Representation::Tagged(); | 7776 return Representation::Tagged(); |
7837 } | 7777 } |
7838 | 7778 |
7839 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 7779 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
7840 | 7780 |
7841 virtual HType CalculateInferredType() OVERRIDE { | 7781 HType CalculateInferredType() OVERRIDE { |
7842 if (value()->type().IsHeapObject()) return value()->type(); | 7782 if (value()->type().IsHeapObject()) return value()->type(); |
7843 return HType::HeapObject(); | 7783 return HType::HeapObject(); |
7844 } | 7784 } |
7845 | 7785 |
7846 HValue* value() const { return OperandAt(0); } | 7786 HValue* value() const { return OperandAt(0); } |
7847 HValue* map() const { return OperandAt(1); } | 7787 HValue* map() const { return OperandAt(1); } |
7848 | 7788 |
7849 virtual HValue* Canonicalize() OVERRIDE; | 7789 HValue* Canonicalize() OVERRIDE; |
7850 | 7790 |
7851 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue) | 7791 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue) |
7852 | 7792 |
7853 protected: | 7793 protected: |
7854 virtual int RedefinedOperandIndex() OVERRIDE { return 0; } | 7794 int RedefinedOperandIndex() OVERRIDE { return 0; } |
7855 | 7795 |
7856 virtual bool DataEquals(HValue* other) OVERRIDE { | 7796 bool DataEquals(HValue* other) OVERRIDE { return true; } |
7857 return true; | |
7858 } | |
7859 | 7797 |
7860 private: | 7798 private: |
7861 HCheckMapValue(HValue* value, HValue* map) | 7799 HCheckMapValue(HValue* value, HValue* map) |
7862 : HTemplateInstruction<2>(HType::HeapObject()) { | 7800 : HTemplateInstruction<2>(HType::HeapObject()) { |
7863 SetOperandAt(0, value); | 7801 SetOperandAt(0, value); |
7864 SetOperandAt(1, map); | 7802 SetOperandAt(1, map); |
7865 set_representation(Representation::Tagged()); | 7803 set_representation(Representation::Tagged()); |
7866 SetFlag(kUseGVN); | 7804 SetFlag(kUseGVN); |
7867 SetDependsOnFlag(kMaps); | 7805 SetDependsOnFlag(kMaps); |
7868 SetDependsOnFlag(kElementsKind); | 7806 SetDependsOnFlag(kElementsKind); |
7869 } | 7807 } |
7870 }; | 7808 }; |
7871 | 7809 |
7872 | 7810 |
7873 class HForInPrepareMap FINAL : public HTemplateInstruction<2> { | 7811 class HForInPrepareMap FINAL : public HTemplateInstruction<2> { |
7874 public: | 7812 public: |
7875 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HForInPrepareMap, HValue*); | 7813 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HForInPrepareMap, HValue*); |
7876 | 7814 |
7877 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 7815 Representation RequiredInputRepresentation(int index) OVERRIDE { |
7878 return Representation::Tagged(); | 7816 return Representation::Tagged(); |
7879 } | 7817 } |
7880 | 7818 |
7881 HValue* context() const { return OperandAt(0); } | 7819 HValue* context() const { return OperandAt(0); } |
7882 HValue* enumerable() const { return OperandAt(1); } | 7820 HValue* enumerable() const { return OperandAt(1); } |
7883 | 7821 |
7884 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 7822 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
7885 | 7823 |
7886 virtual HType CalculateInferredType() OVERRIDE { | 7824 HType CalculateInferredType() OVERRIDE { return HType::Tagged(); } |
7887 return HType::Tagged(); | |
7888 } | |
7889 | 7825 |
7890 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap); | 7826 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap); |
7891 | 7827 |
7892 private: | 7828 private: |
7893 HForInPrepareMap(HValue* context, | 7829 HForInPrepareMap(HValue* context, |
7894 HValue* object) { | 7830 HValue* object) { |
7895 SetOperandAt(0, context); | 7831 SetOperandAt(0, context); |
7896 SetOperandAt(1, object); | 7832 SetOperandAt(1, object); |
7897 set_representation(Representation::Tagged()); | 7833 set_representation(Representation::Tagged()); |
7898 SetAllSideEffects(); | 7834 SetAllSideEffects(); |
7899 } | 7835 } |
7900 }; | 7836 }; |
7901 | 7837 |
7902 | 7838 |
7903 class HForInCacheArray FINAL : public HTemplateInstruction<2> { | 7839 class HForInCacheArray FINAL : public HTemplateInstruction<2> { |
7904 public: | 7840 public: |
7905 DECLARE_INSTRUCTION_FACTORY_P3(HForInCacheArray, HValue*, HValue*, int); | 7841 DECLARE_INSTRUCTION_FACTORY_P3(HForInCacheArray, HValue*, HValue*, int); |
7906 | 7842 |
7907 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 7843 Representation RequiredInputRepresentation(int index) OVERRIDE { |
7908 return Representation::Tagged(); | 7844 return Representation::Tagged(); |
7909 } | 7845 } |
7910 | 7846 |
7911 HValue* enumerable() const { return OperandAt(0); } | 7847 HValue* enumerable() const { return OperandAt(0); } |
7912 HValue* map() const { return OperandAt(1); } | 7848 HValue* map() const { return OperandAt(1); } |
7913 int idx() const { return idx_; } | 7849 int idx() const { return idx_; } |
7914 | 7850 |
7915 HForInCacheArray* index_cache() { | 7851 HForInCacheArray* index_cache() { |
7916 return index_cache_; | 7852 return index_cache_; |
7917 } | 7853 } |
7918 | 7854 |
7919 void set_index_cache(HForInCacheArray* index_cache) { | 7855 void set_index_cache(HForInCacheArray* index_cache) { |
7920 index_cache_ = index_cache; | 7856 index_cache_ = index_cache; |
7921 } | 7857 } |
7922 | 7858 |
7923 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 7859 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
7924 | 7860 |
7925 virtual HType CalculateInferredType() OVERRIDE { | 7861 HType CalculateInferredType() OVERRIDE { return HType::Tagged(); } |
7926 return HType::Tagged(); | |
7927 } | |
7928 | 7862 |
7929 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray); | 7863 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray); |
7930 | 7864 |
7931 private: | 7865 private: |
7932 HForInCacheArray(HValue* enumerable, | 7866 HForInCacheArray(HValue* enumerable, |
7933 HValue* keys, | 7867 HValue* keys, |
7934 int idx) : idx_(idx) { | 7868 int idx) : idx_(idx) { |
7935 SetOperandAt(0, enumerable); | 7869 SetOperandAt(0, enumerable); |
7936 SetOperandAt(1, keys); | 7870 SetOperandAt(1, keys); |
7937 set_representation(Representation::Tagged()); | 7871 set_representation(Representation::Tagged()); |
7938 } | 7872 } |
7939 | 7873 |
7940 int idx_; | 7874 int idx_; |
7941 HForInCacheArray* index_cache_; | 7875 HForInCacheArray* index_cache_; |
7942 }; | 7876 }; |
7943 | 7877 |
7944 | 7878 |
7945 class HLoadFieldByIndex FINAL : public HTemplateInstruction<2> { | 7879 class HLoadFieldByIndex FINAL : public HTemplateInstruction<2> { |
7946 public: | 7880 public: |
7947 DECLARE_INSTRUCTION_FACTORY_P2(HLoadFieldByIndex, HValue*, HValue*); | 7881 DECLARE_INSTRUCTION_FACTORY_P2(HLoadFieldByIndex, HValue*, HValue*); |
7948 | 7882 |
7949 HLoadFieldByIndex(HValue* object, | 7883 HLoadFieldByIndex(HValue* object, |
7950 HValue* index) { | 7884 HValue* index) { |
7951 SetOperandAt(0, object); | 7885 SetOperandAt(0, object); |
7952 SetOperandAt(1, index); | 7886 SetOperandAt(1, index); |
7953 SetChangesFlag(kNewSpacePromotion); | 7887 SetChangesFlag(kNewSpacePromotion); |
7954 set_representation(Representation::Tagged()); | 7888 set_representation(Representation::Tagged()); |
7955 } | 7889 } |
7956 | 7890 |
7957 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 7891 Representation RequiredInputRepresentation(int index) OVERRIDE { |
7958 if (index == 1) { | 7892 if (index == 1) { |
7959 return Representation::Smi(); | 7893 return Representation::Smi(); |
7960 } else { | 7894 } else { |
7961 return Representation::Tagged(); | 7895 return Representation::Tagged(); |
7962 } | 7896 } |
7963 } | 7897 } |
7964 | 7898 |
7965 HValue* object() const { return OperandAt(0); } | 7899 HValue* object() const { return OperandAt(0); } |
7966 HValue* index() const { return OperandAt(1); } | 7900 HValue* index() const { return OperandAt(1); } |
7967 | 7901 |
7968 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 7902 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
7969 | 7903 |
7970 virtual HType CalculateInferredType() OVERRIDE { | 7904 HType CalculateInferredType() OVERRIDE { return HType::Tagged(); } |
7971 return HType::Tagged(); | |
7972 } | |
7973 | 7905 |
7974 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); | 7906 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); |
7975 | 7907 |
7976 private: | 7908 private: |
7977 virtual bool IsDeletable() const OVERRIDE { return true; } | 7909 bool IsDeletable() const OVERRIDE { return true; } |
7978 }; | 7910 }; |
7979 | 7911 |
7980 | 7912 |
7981 class HStoreFrameContext: public HUnaryOperation { | 7913 class HStoreFrameContext: public HUnaryOperation { |
7982 public: | 7914 public: |
7983 DECLARE_INSTRUCTION_FACTORY_P1(HStoreFrameContext, HValue*); | 7915 DECLARE_INSTRUCTION_FACTORY_P1(HStoreFrameContext, HValue*); |
7984 | 7916 |
7985 HValue* context() { return OperandAt(0); } | 7917 HValue* context() { return OperandAt(0); } |
7986 | 7918 |
7987 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 7919 Representation RequiredInputRepresentation(int index) OVERRIDE { |
7988 return Representation::Tagged(); | 7920 return Representation::Tagged(); |
7989 } | 7921 } |
7990 | 7922 |
7991 DECLARE_CONCRETE_INSTRUCTION(StoreFrameContext) | 7923 DECLARE_CONCRETE_INSTRUCTION(StoreFrameContext) |
7992 private: | 7924 private: |
7993 explicit HStoreFrameContext(HValue* context) | 7925 explicit HStoreFrameContext(HValue* context) |
7994 : HUnaryOperation(context) { | 7926 : HUnaryOperation(context) { |
7995 set_representation(Representation::Tagged()); | 7927 set_representation(Representation::Tagged()); |
7996 SetChangesFlag(kContextSlots); | 7928 SetChangesFlag(kContextSlots); |
7997 } | 7929 } |
7998 }; | 7930 }; |
7999 | 7931 |
8000 | 7932 |
8001 class HAllocateBlockContext: public HTemplateInstruction<2> { | 7933 class HAllocateBlockContext: public HTemplateInstruction<2> { |
8002 public: | 7934 public: |
8003 DECLARE_INSTRUCTION_FACTORY_P3(HAllocateBlockContext, HValue*, | 7935 DECLARE_INSTRUCTION_FACTORY_P3(HAllocateBlockContext, HValue*, |
8004 HValue*, Handle<ScopeInfo>); | 7936 HValue*, Handle<ScopeInfo>); |
8005 HValue* context() const { return OperandAt(0); } | 7937 HValue* context() const { return OperandAt(0); } |
8006 HValue* function() const { return OperandAt(1); } | 7938 HValue* function() const { return OperandAt(1); } |
8007 Handle<ScopeInfo> scope_info() const { return scope_info_; } | 7939 Handle<ScopeInfo> scope_info() const { return scope_info_; } |
8008 | 7940 |
8009 virtual Representation RequiredInputRepresentation(int index) OVERRIDE { | 7941 Representation RequiredInputRepresentation(int index) OVERRIDE { |
8010 return Representation::Tagged(); | 7942 return Representation::Tagged(); |
8011 } | 7943 } |
8012 | 7944 |
8013 virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 7945 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
8014 | 7946 |
8015 DECLARE_CONCRETE_INSTRUCTION(AllocateBlockContext) | 7947 DECLARE_CONCRETE_INSTRUCTION(AllocateBlockContext) |
8016 | 7948 |
8017 private: | 7949 private: |
8018 HAllocateBlockContext(HValue* context, | 7950 HAllocateBlockContext(HValue* context, |
8019 HValue* function, | 7951 HValue* function, |
8020 Handle<ScopeInfo> scope_info) | 7952 Handle<ScopeInfo> scope_info) |
8021 : scope_info_(scope_info) { | 7953 : scope_info_(scope_info) { |
8022 SetOperandAt(0, context); | 7954 SetOperandAt(0, context); |
8023 SetOperandAt(1, function); | 7955 SetOperandAt(1, function); |
8024 set_representation(Representation::Tagged()); | 7956 set_representation(Representation::Tagged()); |
8025 } | 7957 } |
8026 | 7958 |
8027 Handle<ScopeInfo> scope_info_; | 7959 Handle<ScopeInfo> scope_info_; |
8028 }; | 7960 }; |
8029 | 7961 |
8030 | 7962 |
8031 | 7963 |
8032 #undef DECLARE_INSTRUCTION | 7964 #undef DECLARE_INSTRUCTION |
8033 #undef DECLARE_CONCRETE_INSTRUCTION | 7965 #undef DECLARE_CONCRETE_INSTRUCTION |
8034 | 7966 |
8035 } } // namespace v8::internal | 7967 } } // namespace v8::internal |
8036 | 7968 |
8037 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7969 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |