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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 V(IsConstructCall) \ | 120 V(IsConstructCall) \ |
121 V(JSArrayLength) \ | 121 V(JSArrayLength) \ |
122 V(LeaveInlined) \ | 122 V(LeaveInlined) \ |
123 V(LoadContextSlot) \ | 123 V(LoadContextSlot) \ |
124 V(LoadElements) \ | 124 V(LoadElements) \ |
125 V(LoadExternalArrayPointer) \ | 125 V(LoadExternalArrayPointer) \ |
126 V(LoadFunctionPrototype) \ | 126 V(LoadFunctionPrototype) \ |
127 V(LoadGlobal) \ | 127 V(LoadGlobal) \ |
128 V(LoadKeyedFastElement) \ | 128 V(LoadKeyedFastElement) \ |
129 V(LoadKeyedGeneric) \ | 129 V(LoadKeyedGeneric) \ |
| 130 V(LoadKeyedSpecializedArrayElement) \ |
130 V(LoadNamedField) \ | 131 V(LoadNamedField) \ |
| 132 V(LoadNamedFieldPolymorphic) \ |
131 V(LoadNamedGeneric) \ | 133 V(LoadNamedGeneric) \ |
132 V(LoadNamedFieldPolymorphic) \ | |
133 V(LoadPixelArrayElement) \ | |
134 V(Mod) \ | 134 V(Mod) \ |
135 V(Mul) \ | 135 V(Mul) \ |
136 V(ObjectLiteral) \ | 136 V(ObjectLiteral) \ |
137 V(OsrEntry) \ | 137 V(OsrEntry) \ |
138 V(OuterContext) \ | 138 V(OuterContext) \ |
139 V(Parameter) \ | 139 V(Parameter) \ |
140 V(Power) \ | 140 V(Power) \ |
141 V(PushArgument) \ | 141 V(PushArgument) \ |
142 V(RegExpLiteral) \ | 142 V(RegExpLiteral) \ |
143 V(Return) \ | 143 V(Return) \ |
144 V(Sar) \ | 144 V(Sar) \ |
145 V(Shl) \ | 145 V(Shl) \ |
146 V(Shr) \ | 146 V(Shr) \ |
147 V(Simulate) \ | 147 V(Simulate) \ |
148 V(StackCheck) \ | 148 V(StackCheck) \ |
149 V(StoreContextSlot) \ | 149 V(StoreContextSlot) \ |
150 V(StoreGlobal) \ | 150 V(StoreGlobal) \ |
151 V(StoreKeyedFastElement) \ | 151 V(StoreKeyedFastElement) \ |
152 V(StorePixelArrayElement) \ | 152 V(StoreKeyedSpecializedArrayElement) \ |
153 V(StoreKeyedGeneric) \ | 153 V(StoreKeyedGeneric) \ |
154 V(StoreNamedField) \ | 154 V(StoreNamedField) \ |
155 V(StoreNamedGeneric) \ | 155 V(StoreNamedGeneric) \ |
156 V(StringCharCodeAt) \ | 156 V(StringCharCodeAt) \ |
157 V(StringCharFromCode) \ | 157 V(StringCharFromCode) \ |
158 V(StringLength) \ | 158 V(StringLength) \ |
159 V(Sub) \ | 159 V(Sub) \ |
160 V(Test) \ | 160 V(Test) \ |
161 V(Throw) \ | 161 V(Throw) \ |
162 V(ToFastProperties) \ | 162 V(ToFastProperties) \ |
163 V(Typeof) \ | 163 V(Typeof) \ |
164 V(TypeofIs) \ | 164 V(TypeofIs) \ |
165 V(UnaryMathOperation) \ | 165 V(UnaryMathOperation) \ |
166 V(UnknownOSRValue) \ | 166 V(UnknownOSRValue) \ |
167 V(ValueOf) | 167 V(ValueOf) |
168 | 168 |
169 #define GVN_FLAG_LIST(V) \ | 169 #define GVN_FLAG_LIST(V) \ |
170 V(Calls) \ | 170 V(Calls) \ |
171 V(InobjectFields) \ | 171 V(InobjectFields) \ |
172 V(BackingStoreFields) \ | 172 V(BackingStoreFields) \ |
173 V(ArrayElements) \ | 173 V(ArrayElements) \ |
174 V(PixelArrayElements) \ | 174 V(SpecializedArrayElements) \ |
175 V(GlobalVars) \ | 175 V(GlobalVars) \ |
176 V(Maps) \ | 176 V(Maps) \ |
177 V(ArrayLengths) \ | 177 V(ArrayLengths) \ |
178 V(ContextSlots) \ | 178 V(ContextSlots) \ |
179 V(OsrEntries) | 179 V(OsrEntries) |
180 | 180 |
181 #define DECLARE_INSTRUCTION(type) \ | 181 #define DECLARE_INSTRUCTION(type) \ |
182 virtual bool Is##type() const { return true; } \ | 182 virtual bool Is##type() const { return true; } \ |
183 static H##type* cast(HValue* value) { \ | 183 static H##type* cast(HValue* value) { \ |
184 ASSERT(value->Is##type()); \ | 184 ASSERT(value->Is##type()); \ |
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1580 virtual bool DataEquals(HValue* other) { return true; } | 1580 virtual bool DataEquals(HValue* other) { return true; } |
1581 }; | 1581 }; |
1582 | 1582 |
1583 | 1583 |
1584 class HLoadExternalArrayPointer: public HUnaryOperation { | 1584 class HLoadExternalArrayPointer: public HUnaryOperation { |
1585 public: | 1585 public: |
1586 explicit HLoadExternalArrayPointer(HValue* value) | 1586 explicit HLoadExternalArrayPointer(HValue* value) |
1587 : HUnaryOperation(value) { | 1587 : HUnaryOperation(value) { |
1588 set_representation(Representation::External()); | 1588 set_representation(Representation::External()); |
1589 // The result of this instruction is idempotent as long as its inputs don't | 1589 // The result of this instruction is idempotent as long as its inputs don't |
1590 // change. The external array of a pixel array elements object cannot | 1590 // change. The external array of a specialized array elements object cannot |
1591 // change once set, so it's no necessary to introduce any additional | 1591 // change once set, so it's no necessary to introduce any additional |
1592 // dependencies on top of the inputs. | 1592 // dependencies on top of the inputs. |
1593 SetFlag(kUseGVN); | 1593 SetFlag(kUseGVN); |
1594 } | 1594 } |
1595 | 1595 |
1596 virtual Representation RequiredInputRepresentation(int index) const { | 1596 virtual Representation RequiredInputRepresentation(int index) const { |
1597 return Representation::Tagged(); | 1597 return Representation::Tagged(); |
1598 } | 1598 } |
1599 | 1599 |
1600 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer, | 1600 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer, |
(...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3072 virtual void PrintDataTo(StringStream* stream); | 3072 virtual void PrintDataTo(StringStream* stream); |
3073 | 3073 |
3074 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, | 3074 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, |
3075 "load_keyed_fast_element") | 3075 "load_keyed_fast_element") |
3076 | 3076 |
3077 protected: | 3077 protected: |
3078 virtual bool DataEquals(HValue* other) { return true; } | 3078 virtual bool DataEquals(HValue* other) { return true; } |
3079 }; | 3079 }; |
3080 | 3080 |
3081 | 3081 |
3082 class HLoadPixelArrayElement: public HBinaryOperation { | 3082 class HLoadKeyedSpecializedArrayElement: public HBinaryOperation { |
3083 public: | 3083 public: |
3084 HLoadPixelArrayElement(HValue* external_elements, HValue* key) | 3084 HLoadKeyedSpecializedArrayElement(HValue* external_elements, |
3085 : HBinaryOperation(external_elements, key) { | 3085 HValue* key, |
3086 set_representation(Representation::Integer32()); | 3086 ExternalArrayType array_type) |
3087 SetFlag(kDependsOnPixelArrayElements); | 3087 : HBinaryOperation(external_elements, key), |
3088 // Native code could change the pixel array. | 3088 array_type_(array_type) { |
| 3089 if (array_type == kExternalFloatArray) { |
| 3090 set_representation(Representation::Double()); |
| 3091 } else { |
| 3092 set_representation(Representation::Integer32()); |
| 3093 } |
| 3094 SetFlag(kDependsOnSpecializedArrayElements); |
| 3095 // Native code could change the specialized array. |
3089 SetFlag(kDependsOnCalls); | 3096 SetFlag(kDependsOnCalls); |
3090 SetFlag(kUseGVN); | 3097 SetFlag(kUseGVN); |
3091 } | 3098 } |
3092 | 3099 |
3093 virtual void PrintDataTo(StringStream* stream); | 3100 virtual void PrintDataTo(StringStream* stream); |
3094 | 3101 |
3095 virtual Representation RequiredInputRepresentation(int index) const { | 3102 virtual Representation RequiredInputRepresentation(int index) const { |
3096 // The key is supposed to be Integer32, but the base pointer | 3103 // The key is supposed to be Integer32, but the base pointer |
3097 // for the element load is a naked pointer. | 3104 // for the element load is a naked pointer. |
3098 return (index == 1) ? Representation::Integer32() | 3105 return (index == 1) ? Representation::Integer32() |
3099 : Representation::External(); | 3106 : Representation::External(); |
3100 } | 3107 } |
3101 | 3108 |
3102 HValue* external_pointer() { return OperandAt(0); } | 3109 HValue* external_pointer() { return OperandAt(0); } |
3103 HValue* key() { return OperandAt(1); } | 3110 HValue* key() { return OperandAt(1); } |
| 3111 ExternalArrayType array_type() const { return array_type_; } |
3104 | 3112 |
3105 DECLARE_CONCRETE_INSTRUCTION(LoadPixelArrayElement, | 3113 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedSpecializedArrayElement, |
3106 "load_pixel_array_element") | 3114 "load_keyed_specialized_array_element") |
3107 | 3115 |
3108 protected: | 3116 protected: |
3109 virtual bool DataEquals(HValue* other) { return true; } | 3117 virtual bool DataEquals(HValue* other) { |
| 3118 if (!other->IsLoadKeyedSpecializedArrayElement()) return false; |
| 3119 HLoadKeyedSpecializedArrayElement* cast_other = |
| 3120 HLoadKeyedSpecializedArrayElement::cast(other); |
| 3121 return array_type_ == cast_other->array_type(); |
| 3122 } |
| 3123 |
| 3124 private: |
| 3125 ExternalArrayType array_type_; |
3110 }; | 3126 }; |
3111 | 3127 |
3112 | 3128 |
3113 class HLoadKeyedGeneric: public HTemplateInstruction<3> { | 3129 class HLoadKeyedGeneric: public HTemplateInstruction<3> { |
3114 public: | 3130 public: |
3115 HLoadKeyedGeneric(HContext* context, HValue* obj, HValue* key) { | 3131 HLoadKeyedGeneric(HContext* context, HValue* obj, HValue* key) { |
3116 set_representation(Representation::Tagged()); | 3132 set_representation(Representation::Tagged()); |
3117 SetOperandAt(0, obj); | 3133 SetOperandAt(0, obj); |
3118 SetOperandAt(1, key); | 3134 SetOperandAt(1, key); |
3119 SetOperandAt(2, context); | 3135 SetOperandAt(2, context); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3234 return StoringValueNeedsWriteBarrier(value()); | 3250 return StoringValueNeedsWriteBarrier(value()); |
3235 } | 3251 } |
3236 | 3252 |
3237 virtual void PrintDataTo(StringStream* stream); | 3253 virtual void PrintDataTo(StringStream* stream); |
3238 | 3254 |
3239 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement, | 3255 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement, |
3240 "store_keyed_fast_element") | 3256 "store_keyed_fast_element") |
3241 }; | 3257 }; |
3242 | 3258 |
3243 | 3259 |
3244 class HStorePixelArrayElement: public HTemplateInstruction<3> { | 3260 class HStoreKeyedSpecializedArrayElement: public HTemplateInstruction<3> { |
3245 public: | 3261 public: |
3246 HStorePixelArrayElement(HValue* external_elements, HValue* key, HValue* val) { | 3262 HStoreKeyedSpecializedArrayElement(HValue* external_elements, |
3247 SetFlag(kChangesPixelArrayElements); | 3263 HValue* key, |
| 3264 HValue* val, |
| 3265 ExternalArrayType array_type) |
| 3266 : array_type_(array_type) { |
| 3267 SetFlag(kChangesSpecializedArrayElements); |
3248 SetOperandAt(0, external_elements); | 3268 SetOperandAt(0, external_elements); |
3249 SetOperandAt(1, key); | 3269 SetOperandAt(1, key); |
3250 SetOperandAt(2, val); | 3270 SetOperandAt(2, val); |
3251 } | 3271 } |
3252 | 3272 |
3253 virtual void PrintDataTo(StringStream* stream); | 3273 virtual void PrintDataTo(StringStream* stream); |
3254 | 3274 |
3255 virtual Representation RequiredInputRepresentation(int index) const { | 3275 virtual Representation RequiredInputRepresentation(int index) const { |
3256 if (index == 0) { | 3276 if (index == 0) { |
3257 return Representation::External(); | 3277 return Representation::External(); |
3258 } else { | 3278 } else { |
3259 return Representation::Integer32(); | 3279 if (index == 2 && array_type() == kExternalFloatArray) { |
| 3280 return Representation::Double(); |
| 3281 } else { |
| 3282 return Representation::Integer32(); |
| 3283 } |
3260 } | 3284 } |
3261 } | 3285 } |
3262 | 3286 |
3263 HValue* external_pointer() { return OperandAt(0); } | 3287 HValue* external_pointer() { return OperandAt(0); } |
3264 HValue* key() { return OperandAt(1); } | 3288 HValue* key() { return OperandAt(1); } |
3265 HValue* value() { return OperandAt(2); } | 3289 HValue* value() { return OperandAt(2); } |
| 3290 ExternalArrayType array_type() const { return array_type_; } |
3266 | 3291 |
3267 DECLARE_CONCRETE_INSTRUCTION(StorePixelArrayElement, | 3292 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedSpecializedArrayElement, |
3268 "store_pixel_array_element") | 3293 "store_keyed_specialized_array_element") |
| 3294 private: |
| 3295 ExternalArrayType array_type_; |
3269 }; | 3296 }; |
3270 | 3297 |
3271 | 3298 |
3272 class HStoreKeyedGeneric: public HTemplateInstruction<4> { | 3299 class HStoreKeyedGeneric: public HTemplateInstruction<4> { |
3273 public: | 3300 public: |
3274 HStoreKeyedGeneric(HValue* context, | 3301 HStoreKeyedGeneric(HValue* context, |
3275 HValue* object, | 3302 HValue* object, |
3276 HValue* key, | 3303 HValue* key, |
3277 HValue* value) { | 3304 HValue* value) { |
3278 SetOperandAt(0, object); | 3305 SetOperandAt(0, object); |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3559 HValue* object() { return left(); } | 3586 HValue* object() { return left(); } |
3560 HValue* key() { return right(); } | 3587 HValue* key() { return right(); } |
3561 }; | 3588 }; |
3562 | 3589 |
3563 #undef DECLARE_INSTRUCTION | 3590 #undef DECLARE_INSTRUCTION |
3564 #undef DECLARE_CONCRETE_INSTRUCTION | 3591 #undef DECLARE_CONCRETE_INSTRUCTION |
3565 | 3592 |
3566 } } // namespace v8::internal | 3593 } } // namespace v8::internal |
3567 | 3594 |
3568 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 3595 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |