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 <cstring> | 8 #include <cstring> |
9 #include <iosfwd> | 9 #include <iosfwd> |
10 | 10 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 V(LoadFunctionPrototype) \ | 120 V(LoadFunctionPrototype) \ |
121 V(LoadGlobalGeneric) \ | 121 V(LoadGlobalGeneric) \ |
122 V(LoadKeyed) \ | 122 V(LoadKeyed) \ |
123 V(LoadKeyedGeneric) \ | 123 V(LoadKeyedGeneric) \ |
124 V(LoadNamedField) \ | 124 V(LoadNamedField) \ |
125 V(LoadNamedGeneric) \ | 125 V(LoadNamedGeneric) \ |
126 V(LoadRoot) \ | 126 V(LoadRoot) \ |
127 V(MapEnumLength) \ | 127 V(MapEnumLength) \ |
128 V(MathFloorOfDiv) \ | 128 V(MathFloorOfDiv) \ |
129 V(MathMinMax) \ | 129 V(MathMinMax) \ |
| 130 V(MaybeGrowElements) \ |
130 V(Mod) \ | 131 V(Mod) \ |
131 V(Mul) \ | 132 V(Mul) \ |
132 V(OsrEntry) \ | 133 V(OsrEntry) \ |
133 V(Parameter) \ | 134 V(Parameter) \ |
134 V(Power) \ | 135 V(Power) \ |
135 V(PushArguments) \ | 136 V(PushArguments) \ |
136 V(RegExpLiteral) \ | 137 V(RegExpLiteral) \ |
137 V(Return) \ | 138 V(Return) \ |
138 V(Ror) \ | 139 V(Ror) \ |
139 V(Sar) \ | 140 V(Sar) \ |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 P3 p3, P4 p4) { \ | 959 P3 p3, P4 p4) { \ |
959 return new (zone) I(context, p1, p2, p3, p4); \ | 960 return new (zone) I(context, p1, p2, p3, p4); \ |
960 } | 961 } |
961 | 962 |
962 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P5(I, P1, P2, P3, P4, P5) \ | 963 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P5(I, P1, P2, P3, P4, P5) \ |
963 static I* New(Isolate* isolate, Zone* zone, HValue* context, P1 p1, P2 p2, \ | 964 static I* New(Isolate* isolate, Zone* zone, HValue* context, P1 p1, P2 p2, \ |
964 P3 p3, P4 p4, P5 p5) { \ | 965 P3 p3, P4 p4, P5 p5) { \ |
965 return new (zone) I(context, p1, p2, p3, p4, p5); \ | 966 return new (zone) I(context, p1, p2, p3, p4, p5); \ |
966 } | 967 } |
967 | 968 |
| 969 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P6(I, P1, P2, P3, P4, P5, P6) \ |
| 970 static I* New(Isolate* isolate, Zone* zone, HValue* context, P1 p1, P2 p2, \ |
| 971 P3 p3, P4 p4, P5 p5, P6 p6) { \ |
| 972 return new (zone) I(context, p1, p2, p3, p4, p5, p6); \ |
| 973 } |
| 974 |
968 | 975 |
969 // A helper class to represent per-operand position information attached to | 976 // A helper class to represent per-operand position information attached to |
970 // the HInstruction in the compact form. Uses tagging to distinguish between | 977 // the HInstruction in the compact form. Uses tagging to distinguish between |
971 // case when only instruction's position is available and case when operands' | 978 // case when only instruction's position is available and case when operands' |
972 // positions are also available. | 979 // positions are also available. |
973 // In the first case it contains intruction's position as a tagged value. | 980 // In the first case it contains intruction's position as a tagged value. |
974 // In the second case it points to an array which contains instruction's | 981 // In the second case it points to an array which contains instruction's |
975 // position and operands' positions. | 982 // position and operands' positions. |
976 class HPositionInfo { | 983 class HPositionInfo { |
977 public: | 984 public: |
(...skipping 6573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7551 | 7558 |
7552 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento) | 7559 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento) |
7553 | 7560 |
7554 private: | 7561 private: |
7555 explicit HTrapAllocationMemento(HValue* obj) { | 7562 explicit HTrapAllocationMemento(HValue* obj) { |
7556 SetOperandAt(0, obj); | 7563 SetOperandAt(0, obj); |
7557 } | 7564 } |
7558 }; | 7565 }; |
7559 | 7566 |
7560 | 7567 |
| 7568 class HMaybeGrowElements final : public HTemplateInstruction<5> { |
| 7569 public: |
| 7570 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P6(HMaybeGrowElements, HValue*, |
| 7571 HValue*, HValue*, HValue*, bool, |
| 7572 ElementsKind); |
| 7573 |
| 7574 Representation RequiredInputRepresentation(int index) override { |
| 7575 if (index < 3) { |
| 7576 return Representation::Tagged(); |
| 7577 } |
| 7578 DCHECK(index == 3 || index == 4); |
| 7579 return Representation::Integer32(); |
| 7580 } |
| 7581 |
| 7582 HValue* context() const { return OperandAt(0); } |
| 7583 HValue* object() const { return OperandAt(1); } |
| 7584 HValue* elements() const { return OperandAt(2); } |
| 7585 HValue* key() const { return OperandAt(3); } |
| 7586 HValue* current_capacity() const { return OperandAt(4); } |
| 7587 |
| 7588 bool is_js_array() const { return is_js_array_; } |
| 7589 ElementsKind kind() const { return kind_; } |
| 7590 |
| 7591 DECLARE_CONCRETE_INSTRUCTION(MaybeGrowElements) |
| 7592 |
| 7593 protected: |
| 7594 bool DataEquals(HValue* other) override { return true; } |
| 7595 |
| 7596 private: |
| 7597 explicit HMaybeGrowElements(HValue* context, HValue* object, HValue* elements, |
| 7598 HValue* key, HValue* current_capacity, |
| 7599 bool is_js_array, ElementsKind kind) { |
| 7600 is_js_array_ = is_js_array; |
| 7601 kind_ = kind; |
| 7602 |
| 7603 SetOperandAt(0, context); |
| 7604 SetOperandAt(1, object); |
| 7605 SetOperandAt(2, elements); |
| 7606 SetOperandAt(3, key); |
| 7607 SetOperandAt(4, current_capacity); |
| 7608 |
| 7609 SetFlag(kUseGVN); |
| 7610 SetChangesFlag(kElementsPointer); |
| 7611 SetChangesFlag(kNewSpacePromotion); |
| 7612 set_representation(Representation::Tagged()); |
| 7613 } |
| 7614 |
| 7615 bool is_js_array_; |
| 7616 ElementsKind kind_; |
| 7617 }; |
| 7618 |
| 7619 |
7561 class HToFastProperties final : public HUnaryOperation { | 7620 class HToFastProperties final : public HUnaryOperation { |
7562 public: | 7621 public: |
7563 DECLARE_INSTRUCTION_FACTORY_P1(HToFastProperties, HValue*); | 7622 DECLARE_INSTRUCTION_FACTORY_P1(HToFastProperties, HValue*); |
7564 | 7623 |
7565 Representation RequiredInputRepresentation(int index) override { | 7624 Representation RequiredInputRepresentation(int index) override { |
7566 return Representation::Tagged(); | 7625 return Representation::Tagged(); |
7567 } | 7626 } |
7568 | 7627 |
7569 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) | 7628 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) |
7570 | 7629 |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7886 }; | 7945 }; |
7887 | 7946 |
7888 | 7947 |
7889 | 7948 |
7890 #undef DECLARE_INSTRUCTION | 7949 #undef DECLARE_INSTRUCTION |
7891 #undef DECLARE_CONCRETE_INSTRUCTION | 7950 #undef DECLARE_CONCRETE_INSTRUCTION |
7892 | 7951 |
7893 } } // namespace v8::internal | 7952 } } // namespace v8::internal |
7894 | 7953 |
7895 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7954 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |