OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE) | 866 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE) |
867 #undef DECLARE_PREDICATE | 867 #undef DECLARE_PREDICATE |
868 bool IsPhi() const { return opcode() == kPhi; } | 868 bool IsPhi() const { return opcode() == kPhi; } |
869 | 869 |
870 // Declare virtual predicates for abstract HInstruction or HValue | 870 // Declare virtual predicates for abstract HInstruction or HValue |
871 #define DECLARE_PREDICATE(type) \ | 871 #define DECLARE_PREDICATE(type) \ |
872 virtual bool Is##type() const { return false; } | 872 virtual bool Is##type() const { return false; } |
873 HYDROGEN_ABSTRACT_INSTRUCTION_LIST(DECLARE_PREDICATE) | 873 HYDROGEN_ABSTRACT_INSTRUCTION_LIST(DECLARE_PREDICATE) |
874 #undef DECLARE_PREDICATE | 874 #undef DECLARE_PREDICATE |
875 | 875 |
876 HValue() : block_(NULL), | 876 HValue(HType type = HType::Tagged()) |
877 id_(kNoNumber), | 877 : block_(NULL), |
878 type_(HType::Tagged()), | 878 id_(kNoNumber), |
879 use_list_(NULL), | 879 type_(type), |
880 range_(NULL), | 880 use_list_(NULL), |
881 flags_(0) {} | 881 range_(NULL), |
| 882 flags_(0) {} |
882 virtual ~HValue() {} | 883 virtual ~HValue() {} |
883 | 884 |
884 HBasicBlock* block() const { return block_; } | 885 HBasicBlock* block() const { return block_; } |
885 void SetBlock(HBasicBlock* block); | 886 void SetBlock(HBasicBlock* block); |
886 int LoopWeight() const; | 887 int LoopWeight() const; |
887 | 888 |
888 // Note: Never call this method for an unlinked value. | 889 // Note: Never call this method for an unlinked value. |
889 Isolate* isolate() const; | 890 Isolate* isolate() const; |
890 | 891 |
891 int id() const { return id_; } | 892 int id() const { return id_; } |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 | 1337 |
1337 #ifdef DEBUG | 1338 #ifdef DEBUG |
1338 virtual void Verify(); | 1339 virtual void Verify(); |
1339 #endif | 1340 #endif |
1340 | 1341 |
1341 virtual bool IsCall() { return false; } | 1342 virtual bool IsCall() { return false; } |
1342 | 1343 |
1343 DECLARE_ABSTRACT_INSTRUCTION(Instruction) | 1344 DECLARE_ABSTRACT_INSTRUCTION(Instruction) |
1344 | 1345 |
1345 protected: | 1346 protected: |
1346 HInstruction() | 1347 HInstruction(HType type = HType::Tagged()) |
1347 : next_(NULL), | 1348 : HValue(type), |
| 1349 next_(NULL), |
1348 previous_(NULL), | 1350 previous_(NULL), |
1349 position_(RelocInfo::kNoPosition) { | 1351 position_(RelocInfo::kNoPosition) { |
1350 SetGVNFlag(kDependsOnOsrEntries); | 1352 SetGVNFlag(kDependsOnOsrEntries); |
1351 } | 1353 } |
1352 | 1354 |
1353 virtual void DeleteFromGraph() { Unlink(); } | 1355 virtual void DeleteFromGraph() { Unlink(); } |
1354 | 1356 |
1355 private: | 1357 private: |
1356 void InitializeAsFirst(HBasicBlock* block) { | 1358 void InitializeAsFirst(HBasicBlock* block) { |
1357 ASSERT(!IsLinked()); | 1359 ASSERT(!IsLinked()); |
(...skipping 10 matching lines...) Expand all Loading... |
1368 }; | 1370 }; |
1369 | 1371 |
1370 | 1372 |
1371 template<int V> | 1373 template<int V> |
1372 class HTemplateInstruction : public HInstruction { | 1374 class HTemplateInstruction : public HInstruction { |
1373 public: | 1375 public: |
1374 int OperandCount() { return V; } | 1376 int OperandCount() { return V; } |
1375 HValue* OperandAt(int i) const { return inputs_[i]; } | 1377 HValue* OperandAt(int i) const { return inputs_[i]; } |
1376 | 1378 |
1377 protected: | 1379 protected: |
| 1380 HTemplateInstruction(HType type = HType::Tagged()) : HInstruction(type) {} |
| 1381 |
1378 void InternalSetOperandAt(int i, HValue* value) { inputs_[i] = value; } | 1382 void InternalSetOperandAt(int i, HValue* value) { inputs_[i] = value; } |
1379 | 1383 |
1380 private: | 1384 private: |
1381 EmbeddedContainer<HValue*, V> inputs_; | 1385 EmbeddedContainer<HValue*, V> inputs_; |
1382 }; | 1386 }; |
1383 | 1387 |
1384 | 1388 |
1385 class HControlInstruction: public HInstruction { | 1389 class HControlInstruction: public HInstruction { |
1386 public: | 1390 public: |
1387 virtual HBasicBlock* SuccessorAt(int i) = 0; | 1391 virtual HBasicBlock* SuccessorAt(int i) = 0; |
(...skipping 5617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7005 virtual bool IsDeletable() const { return true; } | 7009 virtual bool IsDeletable() const { return true; } |
7006 }; | 7010 }; |
7007 | 7011 |
7008 | 7012 |
7009 #undef DECLARE_INSTRUCTION | 7013 #undef DECLARE_INSTRUCTION |
7010 #undef DECLARE_CONCRETE_INSTRUCTION | 7014 #undef DECLARE_CONCRETE_INSTRUCTION |
7011 | 7015 |
7012 } } // namespace v8::internal | 7016 } } // namespace v8::internal |
7013 | 7017 |
7014 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7018 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |