OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 V(CheckFunction) \ | 90 V(CheckFunction) \ |
91 V(CheckInstanceType) \ | 91 V(CheckInstanceType) \ |
92 V(CheckMap) \ | 92 V(CheckMap) \ |
93 V(CheckNonSmi) \ | 93 V(CheckNonSmi) \ |
94 V(CheckPrototypeMaps) \ | 94 V(CheckPrototypeMaps) \ |
95 V(CheckSmi) \ | 95 V(CheckSmi) \ |
96 V(Compare) \ | 96 V(Compare) \ |
97 V(CompareJSObjectEq) \ | 97 V(CompareJSObjectEq) \ |
98 V(CompareMap) \ | 98 V(CompareMap) \ |
99 V(Constant) \ | 99 V(Constant) \ |
100 V(Context) \ | |
100 V(DeleteProperty) \ | 101 V(DeleteProperty) \ |
101 V(Deoptimize) \ | 102 V(Deoptimize) \ |
102 V(Div) \ | 103 V(Div) \ |
103 V(EnterInlined) \ | 104 V(EnterInlined) \ |
104 V(FixedArrayLength) \ | 105 V(FixedArrayLength) \ |
105 V(FunctionLiteral) \ | 106 V(FunctionLiteral) \ |
106 V(GlobalObject) \ | 107 V(GlobalObject) \ |
107 V(GlobalReceiver) \ | 108 V(GlobalReceiver) \ |
108 V(Goto) \ | 109 V(Goto) \ |
109 V(InstanceOf) \ | 110 V(InstanceOf) \ |
(...skipping 11 matching lines...) Expand all Loading... | |
121 V(LoadFunctionPrototype) \ | 122 V(LoadFunctionPrototype) \ |
122 V(LoadGlobal) \ | 123 V(LoadGlobal) \ |
123 V(LoadKeyedFastElement) \ | 124 V(LoadKeyedFastElement) \ |
124 V(LoadKeyedGeneric) \ | 125 V(LoadKeyedGeneric) \ |
125 V(LoadNamedField) \ | 126 V(LoadNamedField) \ |
126 V(LoadNamedGeneric) \ | 127 V(LoadNamedGeneric) \ |
127 V(Mod) \ | 128 V(Mod) \ |
128 V(Mul) \ | 129 V(Mul) \ |
129 V(ObjectLiteral) \ | 130 V(ObjectLiteral) \ |
130 V(OsrEntry) \ | 131 V(OsrEntry) \ |
132 V(OuterContext) \ | |
131 V(Parameter) \ | 133 V(Parameter) \ |
132 V(Power) \ | 134 V(Power) \ |
133 V(PushArgument) \ | 135 V(PushArgument) \ |
134 V(RegExpLiteral) \ | 136 V(RegExpLiteral) \ |
135 V(Return) \ | 137 V(Return) \ |
136 V(Sar) \ | 138 V(Sar) \ |
137 V(Shl) \ | 139 V(Shl) \ |
138 V(Shr) \ | 140 V(Shr) \ |
139 V(Simulate) \ | 141 V(Simulate) \ |
140 V(StackCheck) \ | 142 V(StackCheck) \ |
143 V(StoreContextSlot) \ | |
141 V(StoreGlobal) \ | 144 V(StoreGlobal) \ |
142 V(StoreKeyedFastElement) \ | 145 V(StoreKeyedFastElement) \ |
143 V(StoreKeyedGeneric) \ | 146 V(StoreKeyedGeneric) \ |
144 V(StoreNamedField) \ | 147 V(StoreNamedField) \ |
145 V(StoreNamedGeneric) \ | 148 V(StoreNamedGeneric) \ |
146 V(StringCharCodeAt) \ | 149 V(StringCharCodeAt) \ |
147 V(StringLength) \ | 150 V(StringLength) \ |
148 V(Sub) \ | 151 V(Sub) \ |
149 V(Test) \ | 152 V(Test) \ |
150 V(Throw) \ | 153 V(Throw) \ |
151 V(Typeof) \ | 154 V(Typeof) \ |
152 V(TypeofIs) \ | 155 V(TypeofIs) \ |
153 V(UnaryMathOperation) \ | 156 V(UnaryMathOperation) \ |
154 V(UnknownOSRValue) \ | 157 V(UnknownOSRValue) \ |
155 V(ValueOf) | 158 V(ValueOf) |
156 | 159 |
157 #define GVN_FLAG_LIST(V) \ | 160 #define GVN_FLAG_LIST(V) \ |
158 V(Calls) \ | 161 V(Calls) \ |
159 V(InobjectFields) \ | 162 V(InobjectFields) \ |
160 V(BackingStoreFields) \ | 163 V(BackingStoreFields) \ |
161 V(ArrayElements) \ | 164 V(ArrayElements) \ |
162 V(GlobalVars) \ | 165 V(GlobalVars) \ |
163 V(Maps) \ | 166 V(Maps) \ |
164 V(ArrayLengths) \ | 167 V(ArrayLengths) \ |
168 V(ContextSlots) \ | |
165 V(OsrEntries) | 169 V(OsrEntries) |
166 | 170 |
167 #define DECLARE_INSTRUCTION(type) \ | 171 #define DECLARE_INSTRUCTION(type) \ |
168 virtual bool Is##type() const { return true; } \ | 172 virtual bool Is##type() const { return true; } \ |
169 static H##type* cast(HValue* value) { \ | 173 static H##type* cast(HValue* value) { \ |
170 ASSERT(value->Is##type()); \ | 174 ASSERT(value->Is##type()); \ |
171 return reinterpret_cast<H##type*>(value); \ | 175 return reinterpret_cast<H##type*>(value); \ |
172 } \ | 176 } \ |
173 Opcode opcode() const { return HValue::k##type; } | 177 Opcode opcode() const { return HValue::k##type; } |
174 | 178 |
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1039 argument_index_ = index; | 1043 argument_index_ = index; |
1040 } | 1044 } |
1041 | 1045 |
1042 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push_argument") | 1046 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push_argument") |
1043 | 1047 |
1044 private: | 1048 private: |
1045 int argument_index_; | 1049 int argument_index_; |
1046 }; | 1050 }; |
1047 | 1051 |
1048 | 1052 |
1049 class HGlobalObject: public HInstruction { | 1053 class HContext: public HInstruction { |
1050 public: | 1054 public: |
1051 HGlobalObject() { | 1055 HContext() { |
1052 set_representation(Representation::Tagged()); | 1056 set_representation(Representation::Tagged()); |
1053 SetFlag(kUseGVN); | 1057 SetFlag(kUseGVN); |
1054 SetFlag(kDependsOnCalls); | 1058 } |
1059 | |
1060 DECLARE_CONCRETE_INSTRUCTION(Context, "context"); | |
1061 | |
1062 protected: | |
1063 virtual bool DataEquals(HValue* other) const { return true; } | |
1064 }; | |
1065 | |
1066 | |
1067 class HOuterContext: public HUnaryOperation { | |
1068 public: | |
1069 explicit HOuterContext(HValue* inner) : HUnaryOperation(inner) { | |
1070 set_representation(Representation::Tagged()); | |
1071 SetFlag(kUseGVN); | |
1072 } | |
1073 | |
1074 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer_context"); | |
1075 | |
1076 protected: | |
1077 virtual bool DataEquals(HValue* other) const { return true; } | |
1078 }; | |
1079 | |
1080 | |
1081 class HGlobalObject: public HUnaryOperation { | |
1082 public: | |
1083 explicit HGlobalObject(HValue* context) : HUnaryOperation(context) { | |
1084 set_representation(Representation::Tagged()); | |
1085 SetFlag(kUseGVN); | |
1055 } | 1086 } |
1056 | 1087 |
1057 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global_object") | 1088 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global_object") |
1058 | 1089 |
1059 protected: | 1090 protected: |
1060 virtual bool DataEquals(HValue* other) const { return true; } | 1091 virtual bool DataEquals(HValue* other) const { return true; } |
1061 }; | 1092 }; |
1062 | 1093 |
1063 | 1094 |
1064 class HGlobalReceiver: public HInstruction { | 1095 class HGlobalReceiver: public HUnaryOperation { |
1065 public: | 1096 public: |
1066 HGlobalReceiver() { | 1097 explicit HGlobalReceiver(HValue* global_object) |
1098 : HUnaryOperation(global_object) { | |
1067 set_representation(Representation::Tagged()); | 1099 set_representation(Representation::Tagged()); |
1068 SetFlag(kUseGVN); | 1100 SetFlag(kUseGVN); |
1069 SetFlag(kDependsOnCalls); | |
1070 } | 1101 } |
1071 | 1102 |
1072 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global_receiver") | 1103 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global_receiver") |
1073 | 1104 |
1074 protected: | 1105 protected: |
1075 virtual bool DataEquals(HValue* other) const { return true; } | 1106 virtual bool DataEquals(HValue* other) const { return true; } |
1076 }; | 1107 }; |
1077 | 1108 |
1078 | 1109 |
1079 class HCall: public HInstruction { | 1110 class HCall: public HInstruction { |
(...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2593 virtual void PrintDataTo(StringStream* stream) const; | 2624 virtual void PrintDataTo(StringStream* stream) const; |
2594 | 2625 |
2595 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store_global") | 2626 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store_global") |
2596 | 2627 |
2597 private: | 2628 private: |
2598 Handle<JSGlobalPropertyCell> cell_; | 2629 Handle<JSGlobalPropertyCell> cell_; |
2599 bool check_hole_value_; | 2630 bool check_hole_value_; |
2600 }; | 2631 }; |
2601 | 2632 |
2602 | 2633 |
2603 class HLoadContextSlot: public HInstruction { | 2634 class HLoadContextSlot: public HUnaryOperation { |
2604 public: | 2635 public: |
2605 HLoadContextSlot(int context_chain_length , int slot_index) | 2636 HLoadContextSlot(HValue* context , int slot_index) |
2606 : context_chain_length_(context_chain_length), slot_index_(slot_index) { | 2637 : HUnaryOperation(context), slot_index_(slot_index) { |
2607 set_representation(Representation::Tagged()); | 2638 set_representation(Representation::Tagged()); |
2608 SetFlag(kUseGVN); | 2639 SetFlag(kUseGVN); |
2609 SetFlag(kDependsOnCalls); | 2640 SetFlag(kDependsOnContextSlots); |
2610 } | 2641 } |
2611 | 2642 |
2612 int context_chain_length() const { return context_chain_length_; } | |
2613 int slot_index() const { return slot_index_; } | 2643 int slot_index() const { return slot_index_; } |
2614 | 2644 |
2645 virtual Representation RequiredInputRepresentation(int index) const { | |
fschneider
2011/01/28 11:54:50
I think we are not consistent with when to overrid
Kevin Millikin (Chromium)
2011/02/03 08:37:23
Do you think that's a good idea? It seems like an
| |
2646 return Representation::Tagged(); | |
2647 } | |
2648 | |
2615 virtual void PrintDataTo(StringStream* stream) const; | 2649 virtual void PrintDataTo(StringStream* stream) const; |
2616 | 2650 |
2617 virtual intptr_t Hashcode() const { | |
2618 return context_chain_length() * 29 + slot_index(); | |
2619 } | |
2620 | |
2621 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load_context_slot") | 2651 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load_context_slot") |
2622 | 2652 |
2623 protected: | 2653 protected: |
2624 virtual bool DataEquals(HValue* other) const { | 2654 virtual bool DataEquals(HValue* other) const { |
2625 HLoadContextSlot* b = HLoadContextSlot::cast(other); | 2655 HLoadContextSlot* b = HLoadContextSlot::cast(other); |
2626 return (context_chain_length() == b->context_chain_length()) | 2656 return (slot_index() == b->slot_index()); |
2627 && (slot_index() == b->slot_index()); | |
2628 } | 2657 } |
2629 | 2658 |
2630 private: | 2659 private: |
2631 int context_chain_length_; | |
2632 int slot_index_; | 2660 int slot_index_; |
2633 }; | 2661 }; |
2634 | 2662 |
2663 | |
2664 class HStoreContextSlot: public HBinaryOperation { | |
2665 public: | |
2666 HStoreContextSlot(HValue* context, int slot_index, HValue* value) | |
2667 : HBinaryOperation(context, value), slot_index_(slot_index) { | |
2668 SetFlag(kChangesContextSlots); | |
2669 } | |
2670 | |
2671 HValue* context() const { return OperandAt(0); } | |
2672 HValue* value() const { return OperandAt(1); } | |
2673 int slot_index() const { return slot_index_; } | |
2674 | |
2675 virtual Representation RequiredInputRepresentation(int index) const { | |
2676 return Representation::Tagged(); | |
2677 } | |
2678 | |
2679 virtual void PrintDataTo(StringStream* stream) const; | |
2680 | |
2681 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store_context_slot") | |
2682 | |
2683 private: | |
2684 int slot_index_; | |
2685 }; | |
2686 | |
2635 | 2687 |
2636 class HLoadNamedField: public HUnaryOperation { | 2688 class HLoadNamedField: public HUnaryOperation { |
2637 public: | 2689 public: |
2638 HLoadNamedField(HValue* object, bool is_in_object, int offset) | 2690 HLoadNamedField(HValue* object, bool is_in_object, int offset) |
2639 : HUnaryOperation(object), | 2691 : HUnaryOperation(object), |
2640 is_in_object_(is_in_object), | 2692 is_in_object_(is_in_object), |
2641 offset_(offset) { | 2693 offset_(offset) { |
2642 set_representation(Representation::Tagged()); | 2694 set_representation(Representation::Tagged()); |
2643 SetFlag(kUseGVN); | 2695 SetFlag(kUseGVN); |
2644 if (is_in_object) { | 2696 if (is_in_object) { |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2811 if (is_in_object_) { | 2863 if (is_in_object_) { |
2812 SetFlag(kChangesInobjectFields); | 2864 SetFlag(kChangesInobjectFields); |
2813 } else { | 2865 } else { |
2814 SetFlag(kChangesBackingStoreFields); | 2866 SetFlag(kChangesBackingStoreFields); |
2815 } | 2867 } |
2816 } | 2868 } |
2817 | 2869 |
2818 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store_named_field") | 2870 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store_named_field") |
2819 | 2871 |
2820 virtual Representation RequiredInputRepresentation(int index) const { | 2872 virtual Representation RequiredInputRepresentation(int index) const { |
2821 return Representation::Tagged(); | 2873 return Representation::Tagged(); |
2822 } | 2874 } |
2823 virtual void PrintDataTo(StringStream* stream) const; | 2875 virtual void PrintDataTo(StringStream* stream) const; |
2824 | 2876 |
2825 bool is_in_object() const { return is_in_object_; } | 2877 bool is_in_object() const { return is_in_object_; } |
2826 int offset() const { return offset_; } | 2878 int offset() const { return offset_; } |
2827 Handle<Map> transition() const { return transition_; } | 2879 Handle<Map> transition() const { return transition_; } |
2828 void set_transition(Handle<Map> map) { transition_ = map; } | 2880 void set_transition(Handle<Map> map) { transition_ = map; } |
2829 | 2881 |
2830 private: | 2882 private: |
2831 bool is_in_object_; | 2883 bool is_in_object_; |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3104 HValue* object() const { return left(); } | 3156 HValue* object() const { return left(); } |
3105 HValue* key() const { return right(); } | 3157 HValue* key() const { return right(); } |
3106 }; | 3158 }; |
3107 | 3159 |
3108 #undef DECLARE_INSTRUCTION | 3160 #undef DECLARE_INSTRUCTION |
3109 #undef DECLARE_CONCRETE_INSTRUCTION | 3161 #undef DECLARE_CONCRETE_INSTRUCTION |
3110 | 3162 |
3111 } } // namespace v8::internal | 3163 } } // namespace v8::internal |
3112 | 3164 |
3113 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 3165 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |