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 6533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7511 | 7518 |
7512 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento) | 7519 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento) |
7513 | 7520 |
7514 private: | 7521 private: |
7515 explicit HTrapAllocationMemento(HValue* obj) { | 7522 explicit HTrapAllocationMemento(HValue* obj) { |
7516 SetOperandAt(0, obj); | 7523 SetOperandAt(0, obj); |
7517 } | 7524 } |
7518 }; | 7525 }; |
7519 | 7526 |
7520 | 7527 |
| 7528 class HMaybeGrowElements final : public HTemplateInstruction<5> { |
| 7529 public: |
| 7530 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P6(HMaybeGrowElements, HValue*, |
| 7531 HValue*, HValue*, HValue*, bool, |
| 7532 ElementsKind); |
| 7533 |
| 7534 Representation RequiredInputRepresentation(int index) override { |
| 7535 if (index < 3) { |
| 7536 return Representation::Tagged(); |
| 7537 } |
| 7538 DCHECK(index == 3 || index == 4); |
| 7539 return Representation::Integer32(); |
| 7540 } |
| 7541 |
| 7542 HValue* context() const { return OperandAt(0); } |
| 7543 HValue* object() const { return OperandAt(1); } |
| 7544 HValue* elements() const { return OperandAt(2); } |
| 7545 HValue* key() const { return OperandAt(3); } |
| 7546 HValue* current_capacity() const { return OperandAt(4); } |
| 7547 |
| 7548 bool is_js_array() const { return is_js_array_; } |
| 7549 ElementsKind kind() const { return kind_; } |
| 7550 |
| 7551 DECLARE_CONCRETE_INSTRUCTION(MaybeGrowElements) |
| 7552 |
| 7553 protected: |
| 7554 bool DataEquals(HValue* other) override { return true; } |
| 7555 |
| 7556 private: |
| 7557 explicit HMaybeGrowElements(HValue* context, HValue* object, HValue* elements, |
| 7558 HValue* key, HValue* current_capacity, |
| 7559 bool is_js_array, ElementsKind kind) { |
| 7560 is_js_array_ = is_js_array; |
| 7561 kind_ = kind; |
| 7562 |
| 7563 SetOperandAt(0, context); |
| 7564 SetOperandAt(1, object); |
| 7565 SetOperandAt(2, elements); |
| 7566 SetOperandAt(3, key); |
| 7567 SetOperandAt(4, current_capacity); |
| 7568 |
| 7569 SetFlag(kUseGVN); |
| 7570 SetChangesFlag(kElementsPointer); |
| 7571 SetChangesFlag(kNewSpacePromotion); |
| 7572 set_representation(Representation::Tagged()); |
| 7573 } |
| 7574 |
| 7575 bool is_js_array_; |
| 7576 ElementsKind kind_; |
| 7577 }; |
| 7578 |
| 7579 |
7521 class HToFastProperties final : public HUnaryOperation { | 7580 class HToFastProperties final : public HUnaryOperation { |
7522 public: | 7581 public: |
7523 DECLARE_INSTRUCTION_FACTORY_P1(HToFastProperties, HValue*); | 7582 DECLARE_INSTRUCTION_FACTORY_P1(HToFastProperties, HValue*); |
7524 | 7583 |
7525 Representation RequiredInputRepresentation(int index) override { | 7584 Representation RequiredInputRepresentation(int index) override { |
7526 return Representation::Tagged(); | 7585 return Representation::Tagged(); |
7527 } | 7586 } |
7528 | 7587 |
7529 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) | 7588 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) |
7530 | 7589 |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7846 }; | 7905 }; |
7847 | 7906 |
7848 | 7907 |
7849 | 7908 |
7850 #undef DECLARE_INSTRUCTION | 7909 #undef DECLARE_INSTRUCTION |
7851 #undef DECLARE_CONCRETE_INSTRUCTION | 7910 #undef DECLARE_CONCRETE_INSTRUCTION |
7852 | 7911 |
7853 } } // namespace v8::internal | 7912 } } // namespace v8::internal |
7854 | 7913 |
7855 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7914 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |