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 "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 // Declare virtual predicates for abstract HInstruction or HValue | 544 // Declare virtual predicates for abstract HInstruction or HValue |
545 #define DECLARE_PREDICATE(type) \ | 545 #define DECLARE_PREDICATE(type) \ |
546 virtual bool Is##type() const { return false; } | 546 virtual bool Is##type() const { return false; } |
547 HYDROGEN_ABSTRACT_INSTRUCTION_LIST(DECLARE_PREDICATE) | 547 HYDROGEN_ABSTRACT_INSTRUCTION_LIST(DECLARE_PREDICATE) |
548 #undef DECLARE_PREDICATE | 548 #undef DECLARE_PREDICATE |
549 | 549 |
550 bool IsBitwiseBinaryShift() { | 550 bool IsBitwiseBinaryShift() { |
551 return IsShl() || IsShr() || IsSar(); | 551 return IsShl() || IsShr() || IsSar(); |
552 } | 552 } |
553 | 553 |
554 HValue(HType type = HType::Tagged()) | 554 explicit HValue(HType type = HType::Tagged()) |
555 : block_(NULL), | 555 : block_(NULL), |
556 id_(kNoNumber), | 556 id_(kNoNumber), |
557 type_(type), | 557 type_(type), |
558 use_list_(NULL), | 558 use_list_(NULL), |
559 range_(NULL), | 559 range_(NULL), |
560 #ifdef DEBUG | 560 #ifdef DEBUG |
561 range_poisoned_(false), | 561 range_poisoned_(false), |
562 #endif | 562 #endif |
563 flags_(0) {} | 563 flags_(0) {} |
564 virtual ~HValue() {} | 564 virtual ~HValue() {} |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 virtual void Verify() V8_OVERRIDE; | 1198 virtual void Verify() V8_OVERRIDE; |
1199 #endif | 1199 #endif |
1200 | 1200 |
1201 bool CanDeoptimize(); | 1201 bool CanDeoptimize(); |
1202 | 1202 |
1203 virtual bool HasStackCheck() { return false; } | 1203 virtual bool HasStackCheck() { return false; } |
1204 | 1204 |
1205 DECLARE_ABSTRACT_INSTRUCTION(Instruction) | 1205 DECLARE_ABSTRACT_INSTRUCTION(Instruction) |
1206 | 1206 |
1207 protected: | 1207 protected: |
1208 HInstruction(HType type = HType::Tagged()) | 1208 explicit HInstruction(HType type = HType::Tagged()) |
1209 : HValue(type), | 1209 : HValue(type), |
1210 next_(NULL), | 1210 next_(NULL), |
1211 previous_(NULL), | 1211 previous_(NULL), |
1212 position_(RelocInfo::kNoPosition) { | 1212 position_(RelocInfo::kNoPosition) { |
1213 SetDependsOnFlag(kOsrEntries); | 1213 SetDependsOnFlag(kOsrEntries); |
1214 } | 1214 } |
1215 | 1215 |
1216 virtual void DeleteFromGraph() V8_OVERRIDE { Unlink(); } | 1216 virtual void DeleteFromGraph() V8_OVERRIDE { Unlink(); } |
1217 | 1217 |
1218 private: | 1218 private: |
(...skipping 12 matching lines...) Expand all Loading... |
1231 | 1231 |
1232 template<int V> | 1232 template<int V> |
1233 class HTemplateInstruction : public HInstruction { | 1233 class HTemplateInstruction : public HInstruction { |
1234 public: | 1234 public: |
1235 virtual int OperandCount() const V8_FINAL V8_OVERRIDE { return V; } | 1235 virtual int OperandCount() const V8_FINAL V8_OVERRIDE { return V; } |
1236 virtual HValue* OperandAt(int i) const V8_FINAL V8_OVERRIDE { | 1236 virtual HValue* OperandAt(int i) const V8_FINAL V8_OVERRIDE { |
1237 return inputs_[i]; | 1237 return inputs_[i]; |
1238 } | 1238 } |
1239 | 1239 |
1240 protected: | 1240 protected: |
1241 HTemplateInstruction(HType type = HType::Tagged()) : HInstruction(type) {} | 1241 explicit HTemplateInstruction(HType type = HType::Tagged()) |
| 1242 : HInstruction(type) {} |
1242 | 1243 |
1243 virtual void InternalSetOperandAt(int i, HValue* value) V8_FINAL V8_OVERRIDE { | 1244 virtual void InternalSetOperandAt(int i, HValue* value) V8_FINAL V8_OVERRIDE { |
1244 inputs_[i] = value; | 1245 inputs_[i] = value; |
1245 } | 1246 } |
1246 | 1247 |
1247 private: | 1248 private: |
1248 EmbeddedContainer<HValue*, V> inputs_; | 1249 EmbeddedContainer<HValue*, V> inputs_; |
1249 }; | 1250 }; |
1250 | 1251 |
1251 | 1252 |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1591 } | 1592 } |
1592 | 1593 |
1593 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit) | 1594 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit) |
1594 private: | 1595 private: |
1595 HAbnormalExit() {} | 1596 HAbnormalExit() {} |
1596 }; | 1597 }; |
1597 | 1598 |
1598 | 1599 |
1599 class HUnaryOperation : public HTemplateInstruction<1> { | 1600 class HUnaryOperation : public HTemplateInstruction<1> { |
1600 public: | 1601 public: |
1601 HUnaryOperation(HValue* value, HType type = HType::Tagged()) | 1602 explicit HUnaryOperation(HValue* value, HType type = HType::Tagged()) |
1602 : HTemplateInstruction<1>(type) { | 1603 : HTemplateInstruction<1>(type) { |
1603 SetOperandAt(0, value); | 1604 SetOperandAt(0, value); |
1604 } | 1605 } |
1605 | 1606 |
1606 static HUnaryOperation* cast(HValue* value) { | 1607 static HUnaryOperation* cast(HValue* value) { |
1607 return reinterpret_cast<HUnaryOperation*>(value); | 1608 return reinterpret_cast<HUnaryOperation*>(value); |
1608 } | 1609 } |
1609 | 1610 |
1610 HValue* value() const { return OperandAt(0); } | 1611 HValue* value() const { return OperandAt(0); } |
1611 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT | 1612 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT |
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2709 | 2710 |
2710 DECLARE_CONCRETE_INSTRUCTION(LoadRoot) | 2711 DECLARE_CONCRETE_INSTRUCTION(LoadRoot) |
2711 | 2712 |
2712 protected: | 2713 protected: |
2713 virtual bool DataEquals(HValue* other) V8_OVERRIDE { | 2714 virtual bool DataEquals(HValue* other) V8_OVERRIDE { |
2714 HLoadRoot* b = HLoadRoot::cast(other); | 2715 HLoadRoot* b = HLoadRoot::cast(other); |
2715 return index_ == b->index_; | 2716 return index_ == b->index_; |
2716 } | 2717 } |
2717 | 2718 |
2718 private: | 2719 private: |
2719 HLoadRoot(Heap::RootListIndex index, HType type = HType::Tagged()) | 2720 explicit HLoadRoot(Heap::RootListIndex index, HType type = HType::Tagged()) |
2720 : HTemplateInstruction<0>(type), index_(index) { | 2721 : HTemplateInstruction<0>(type), index_(index) { |
2721 SetFlag(kUseGVN); | 2722 SetFlag(kUseGVN); |
2722 // TODO(bmeurer): We'll need kDependsOnRoots once we add the | 2723 // TODO(bmeurer): We'll need kDependsOnRoots once we add the |
2723 // corresponding HStoreRoot instruction. | 2724 // corresponding HStoreRoot instruction. |
2724 SetDependsOnFlag(kCalls); | 2725 SetDependsOnFlag(kCalls); |
2725 } | 2726 } |
2726 | 2727 |
2727 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 2728 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
2728 | 2729 |
2729 const Heap::RootListIndex index_; | 2730 const Heap::RootListIndex index_; |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3699 virtual void Verify() V8_OVERRIDE { } | 3700 virtual void Verify() V8_OVERRIDE { } |
3700 #endif | 3701 #endif |
3701 | 3702 |
3702 DECLARE_CONCRETE_INSTRUCTION(Constant) | 3703 DECLARE_CONCRETE_INSTRUCTION(Constant) |
3703 | 3704 |
3704 protected: | 3705 protected: |
3705 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 3706 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; |
3706 | 3707 |
3707 private: | 3708 private: |
3708 friend class HGraph; | 3709 friend class HGraph; |
3709 HConstant(Handle<Object> handle, Representation r = Representation::None()); | 3710 explicit HConstant(Handle<Object> handle, |
| 3711 Representation r = Representation::None()); |
3710 HConstant(int32_t value, | 3712 HConstant(int32_t value, |
3711 Representation r = Representation::None(), | 3713 Representation r = Representation::None(), |
3712 bool is_not_in_new_space = true, | 3714 bool is_not_in_new_space = true, |
3713 Unique<Object> optional = Unique<Object>(Handle<Object>::null())); | 3715 Unique<Object> optional = Unique<Object>(Handle<Object>::null())); |
3714 HConstant(double value, | 3716 HConstant(double value, |
3715 Representation r = Representation::None(), | 3717 Representation r = Representation::None(), |
3716 bool is_not_in_new_space = true, | 3718 bool is_not_in_new_space = true, |
3717 Unique<Object> optional = Unique<Object>(Handle<Object>::null())); | 3719 Unique<Object> optional = Unique<Object>(Handle<Object>::null())); |
3718 HConstant(Unique<Object> object, | 3720 HConstant(Unique<Object> object, |
3719 Unique<Map> object_map, | 3721 Unique<Map> object_map, |
(...skipping 4137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7857 }; | 7859 }; |
7858 | 7860 |
7859 | 7861 |
7860 | 7862 |
7861 #undef DECLARE_INSTRUCTION | 7863 #undef DECLARE_INSTRUCTION |
7862 #undef DECLARE_CONCRETE_INSTRUCTION | 7864 #undef DECLARE_CONCRETE_INSTRUCTION |
7863 | 7865 |
7864 } } // namespace v8::internal | 7866 } } // namespace v8::internal |
7865 | 7867 |
7866 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7868 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |