OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 V(InstanceOf) \ | 127 V(InstanceOf) \ |
128 V(InstanceOfKnownGlobal) \ | 128 V(InstanceOfKnownGlobal) \ |
129 V(InstanceSize) \ | 129 V(InstanceSize) \ |
130 V(InvokeFunction) \ | 130 V(InvokeFunction) \ |
131 V(IsConstructCallAndBranch) \ | 131 V(IsConstructCallAndBranch) \ |
132 V(IsNilAndBranch) \ | 132 V(IsNilAndBranch) \ |
133 V(IsObjectAndBranch) \ | 133 V(IsObjectAndBranch) \ |
134 V(IsStringAndBranch) \ | 134 V(IsStringAndBranch) \ |
135 V(IsSmiAndBranch) \ | 135 V(IsSmiAndBranch) \ |
136 V(IsUndetectableAndBranch) \ | 136 V(IsUndetectableAndBranch) \ |
137 V(JSArrayLength) \ | |
138 V(LeaveInlined) \ | 137 V(LeaveInlined) \ |
139 V(LoadContextSlot) \ | 138 V(LoadContextSlot) \ |
140 V(LoadElements) \ | 139 V(LoadElements) \ |
141 V(LoadExternalArrayPointer) \ | 140 V(LoadExternalArrayPointer) \ |
142 V(LoadFunctionPrototype) \ | 141 V(LoadFunctionPrototype) \ |
143 V(LoadGlobalCell) \ | 142 V(LoadGlobalCell) \ |
144 V(LoadGlobalGeneric) \ | 143 V(LoadGlobalGeneric) \ |
145 V(LoadKeyed) \ | 144 V(LoadKeyed) \ |
146 V(LoadKeyedGeneric) \ | 145 V(LoadKeyedGeneric) \ |
147 V(LoadNamedField) \ | 146 V(LoadNamedField) \ |
(...skipping 2237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2385 } | 2384 } |
2386 | 2385 |
2387 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) | 2386 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) |
2388 | 2387 |
2389 private: | 2388 private: |
2390 const Runtime::Function* c_function_; | 2389 const Runtime::Function* c_function_; |
2391 Handle<String> name_; | 2390 Handle<String> name_; |
2392 }; | 2391 }; |
2393 | 2392 |
2394 | 2393 |
2395 class HJSArrayLength: public HTemplateInstruction<2> { | |
2396 public: | |
2397 HJSArrayLength(HValue* value, HValue* typecheck, | |
2398 HType type = HType::Tagged()) { | |
2399 set_type(type); | |
2400 // The length of an array is stored as a tagged value in the array | |
2401 // object. It is guaranteed to be 32 bit integer, but it can be | |
2402 // represented as either a smi or heap number. | |
2403 SetOperandAt(0, value); | |
2404 SetOperandAt(1, typecheck != NULL ? typecheck : value); | |
2405 set_representation(Representation::Tagged()); | |
2406 SetFlag(kUseGVN); | |
2407 SetGVNFlag(kDependsOnArrayLengths); | |
2408 SetGVNFlag(kDependsOnMaps); | |
2409 } | |
2410 | |
2411 virtual Representation RequiredInputRepresentation(int index) { | |
2412 return Representation::Tagged(); | |
2413 } | |
2414 | |
2415 virtual void PrintDataTo(StringStream* stream); | |
2416 | |
2417 HValue* value() { return OperandAt(0); } | |
2418 HValue* typecheck() { | |
2419 ASSERT(HasTypeCheck()); | |
2420 return OperandAt(1); | |
2421 } | |
2422 bool HasTypeCheck() const { return OperandAt(0) != OperandAt(1); } | |
2423 | |
2424 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength) | |
2425 | |
2426 protected: | |
2427 virtual bool DataEquals(HValue* other_raw) { return true; } | |
2428 | |
2429 private: | |
2430 virtual bool IsDeletable() const { return true; } | |
2431 }; | |
2432 | |
2433 | |
2434 class HFixedArrayBaseLength: public HUnaryOperation { | 2394 class HFixedArrayBaseLength: public HUnaryOperation { |
2435 public: | 2395 public: |
2436 explicit HFixedArrayBaseLength(HValue* value) : HUnaryOperation(value) { | 2396 explicit HFixedArrayBaseLength(HValue* value) : HUnaryOperation(value) { |
2437 set_type(HType::Smi()); | 2397 set_type(HType::Smi()); |
2438 set_representation(Representation::Tagged()); | 2398 set_representation(Representation::Tagged()); |
2439 SetFlag(kUseGVN); | 2399 SetFlag(kUseGVN); |
2440 SetGVNFlag(kDependsOnArrayLengths); | 2400 SetGVNFlag(kDependsOnArrayLengths); |
2441 } | 2401 } |
2442 | 2402 |
2443 virtual Representation RequiredInputRepresentation(int index) { | 2403 virtual Representation RequiredInputRepresentation(int index) { |
(...skipping 2735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5179 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) | 5139 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) |
5180 | 5140 |
5181 private: | 5141 private: |
5182 int slot_index_; | 5142 int slot_index_; |
5183 Mode mode_; | 5143 Mode mode_; |
5184 }; | 5144 }; |
5185 | 5145 |
5186 | 5146 |
5187 class HLoadNamedField: public HUnaryOperation { | 5147 class HLoadNamedField: public HUnaryOperation { |
5188 public: | 5148 public: |
5189 HLoadNamedField(HValue* object, bool is_in_object, int offset) | 5149 HLoadNamedField(HValue* object, bool is_in_object, int offset) |
danno
2013/03/22 15:13:41
I don't this is totally ok. I think you need to ad
| |
5190 : HUnaryOperation(object), | 5150 : HUnaryOperation(object), |
5191 is_in_object_(is_in_object), | 5151 is_in_object_(is_in_object), |
5192 offset_(offset) { | 5152 offset_(offset) { |
5193 set_representation(Representation::Tagged()); | 5153 set_representation(Representation::Tagged()); |
5194 SetFlag(kUseGVN); | 5154 SetFlag(kUseGVN); |
5195 SetGVNFlag(kDependsOnMaps); | 5155 SetGVNFlag(kDependsOnMaps); |
5196 if (is_in_object) { | 5156 if (is_in_object) { |
5197 SetGVNFlag(kDependsOnInobjectFields); | 5157 SetGVNFlag(kDependsOnInobjectFields); |
5198 } else { | 5158 } else { |
5199 SetGVNFlag(kDependsOnBackingStoreFields); | 5159 SetGVNFlag(kDependsOnBackingStoreFields); |
5200 } | 5160 } |
5201 } | 5161 } |
5202 | 5162 |
5163 static HLoadNamedField* NewArrayLength(HValue* object, Zone* zone) { | |
5164 HLoadNamedField* result = new(zone) HLoadNamedField( | |
5165 object, true, JSArray::kLengthOffset); | |
5166 result->SetGVNFlag(kDependsOnArrayLengths); | |
5167 return result; | |
5168 } | |
5169 | |
5203 HValue* object() { return OperandAt(0); } | 5170 HValue* object() { return OperandAt(0); } |
5204 bool is_in_object() const { return is_in_object_; } | 5171 bool is_in_object() const { return is_in_object_; } |
5205 int offset() const { return offset_; } | 5172 int offset() const { return offset_; } |
5206 | 5173 |
5207 virtual Representation RequiredInputRepresentation(int index) { | 5174 virtual Representation RequiredInputRepresentation(int index) { |
5208 return Representation::Tagged(); | 5175 return Representation::Tagged(); |
5209 } | 5176 } |
5210 virtual void PrintDataTo(StringStream* stream); | 5177 virtual void PrintDataTo(StringStream* stream); |
5211 | 5178 |
5212 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) | 5179 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) |
(...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6460 virtual bool IsDeletable() const { return true; } | 6427 virtual bool IsDeletable() const { return true; } |
6461 }; | 6428 }; |
6462 | 6429 |
6463 | 6430 |
6464 #undef DECLARE_INSTRUCTION | 6431 #undef DECLARE_INSTRUCTION |
6465 #undef DECLARE_CONCRETE_INSTRUCTION | 6432 #undef DECLARE_CONCRETE_INSTRUCTION |
6466 | 6433 |
6467 } } // namespace v8::internal | 6434 } } // namespace v8::internal |
6468 | 6435 |
6469 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6436 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |