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 5245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5256 | 5256 |
5257 // Create an access to the backing store of an object. | 5257 // Create an access to the backing store of an object. |
5258 static HObjectAccess ForBackingStoreOffset(int offset); | 5258 static HObjectAccess ForBackingStoreOffset(int offset); |
5259 | 5259 |
5260 // Create an access to a resolved field (in-object or backing store). | 5260 // Create an access to a resolved field (in-object or backing store). |
5261 static HObjectAccess ForField(Handle<Map> map, | 5261 static HObjectAccess ForField(Handle<Map> map, |
5262 LookupResult *lookup, Handle<String> name = Handle<String>::null()); | 5262 LookupResult *lookup, Handle<String> name = Handle<String>::null()); |
5263 | 5263 |
5264 void PrintTo(StringStream* stream); | 5264 void PrintTo(StringStream* stream); |
5265 | 5265 |
| 5266 inline bool Equals(HObjectAccess that) const { |
| 5267 return value_ == that.value_; // portion and offset must match |
| 5268 } |
| 5269 |
5266 protected: | 5270 protected: |
5267 void SetGVNFlags(HValue *instr, bool is_store); | 5271 void SetGVNFlags(HValue *instr, bool is_store); |
5268 | 5272 |
5269 private: | 5273 private: |
5270 // internal use only; different parts of an object or array | 5274 // internal use only; different parts of an object or array |
5271 enum Portion { | 5275 enum Portion { |
5272 kMaps, // map of an object | 5276 kMaps, // map of an object |
5273 kArrayLengths, // the length of an array | 5277 kArrayLengths, // the length of an array |
5274 kElementsPointer, // elements pointer | 5278 kElementsPointer, // elements pointer |
5275 kBackingStore, // some field in the backing store | 5279 kBackingStore, // some field in the backing store |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5329 } | 5333 } |
5330 | 5334 |
5331 HValue* object() { return OperandAt(0); } | 5335 HValue* object() { return OperandAt(0); } |
5332 HValue* typecheck() { | 5336 HValue* typecheck() { |
5333 ASSERT(HasTypeCheck()); | 5337 ASSERT(HasTypeCheck()); |
5334 return OperandAt(1); | 5338 return OperandAt(1); |
5335 } | 5339 } |
5336 | 5340 |
5337 bool HasTypeCheck() const { return OperandAt(0) != OperandAt(1); } | 5341 bool HasTypeCheck() const { return OperandAt(0) != OperandAt(1); } |
5338 HObjectAccess access() const { return access_; } | 5342 HObjectAccess access() const { return access_; } |
5339 bool is_in_object() const { return access_.IsInobject(); } | |
5340 Representation field_representation() const { return representation_; } | 5343 Representation field_representation() const { return representation_; } |
5341 int offset() const { return access_.offset(); } | |
5342 | 5344 |
5343 virtual Representation RequiredInputRepresentation(int index) { | 5345 virtual Representation RequiredInputRepresentation(int index) { |
5344 return Representation::Tagged(); | 5346 return Representation::Tagged(); |
5345 } | 5347 } |
5346 virtual void PrintDataTo(StringStream* stream); | 5348 virtual void PrintDataTo(StringStream* stream); |
5347 | 5349 |
5348 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) | 5350 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) |
5349 | 5351 |
5350 protected: | 5352 protected: |
5351 virtual bool DataEquals(HValue* other) { | 5353 virtual bool DataEquals(HValue* other) { |
5352 HLoadNamedField* b = HLoadNamedField::cast(other); | 5354 HLoadNamedField* b = HLoadNamedField::cast(other); |
5353 return is_in_object() == b->is_in_object() && offset() == b->offset(); | 5355 return access_.Equals(b->access_); |
5354 } | 5356 } |
5355 | 5357 |
5356 private: | 5358 private: |
5357 virtual bool IsDeletable() const { return true; } | 5359 virtual bool IsDeletable() const { return true; } |
5358 | 5360 |
5359 HObjectAccess access_; | 5361 HObjectAccess access_; |
5360 Representation field_representation_; | 5362 Representation field_representation_; |
5361 }; | 5363 }; |
5362 | 5364 |
5363 | 5365 |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5682 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) { | 5684 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) { |
5683 ASSERT(side_effect == kChangesNewSpacePromotion); | 5685 ASSERT(side_effect == kChangesNewSpacePromotion); |
5684 new_space_dominator_ = dominator; | 5686 new_space_dominator_ = dominator; |
5685 } | 5687 } |
5686 virtual void PrintDataTo(StringStream* stream); | 5688 virtual void PrintDataTo(StringStream* stream); |
5687 | 5689 |
5688 HValue* object() { return OperandAt(0); } | 5690 HValue* object() { return OperandAt(0); } |
5689 HValue* value() { return OperandAt(1); } | 5691 HValue* value() { return OperandAt(1); } |
5690 | 5692 |
5691 HObjectAccess access() const { return access_; } | 5693 HObjectAccess access() const { return access_; } |
5692 Handle<String> name() const { return access_.name(); } | |
5693 bool is_in_object() const { return access_.IsInobject(); } | |
5694 int offset() const { return access_.offset(); } | |
5695 Handle<Map> transition() const { return transition_; } | 5694 Handle<Map> transition() const { return transition_; } |
5696 UniqueValueId transition_unique_id() const { return transition_unique_id_; } | 5695 UniqueValueId transition_unique_id() const { return transition_unique_id_; } |
5697 void set_transition(Handle<Map> map) { transition_ = map; } | 5696 void set_transition(Handle<Map> map) { transition_ = map; } |
5698 HValue* new_space_dominator() const { return new_space_dominator_; } | 5697 HValue* new_space_dominator() const { return new_space_dominator_; } |
5699 | 5698 |
5700 bool NeedsWriteBarrier() { | 5699 bool NeedsWriteBarrier() { |
5701 ASSERT(!(FLAG_track_double_fields && field_representation_.IsDouble()) || | 5700 ASSERT(!(FLAG_track_double_fields && field_representation_.IsDouble()) || |
5702 transition_.is_null()); | 5701 transition_.is_null()); |
5703 return (!FLAG_track_fields || !field_representation_.IsSmi()) && | 5702 return (!FLAG_track_fields || !field_representation_.IsSmi()) && |
5704 // If there is a transition, a new storage object needs to be allocated. | 5703 // If there is a transition, a new storage object needs to be allocated. |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6541 virtual bool IsDeletable() const { return true; } | 6540 virtual bool IsDeletable() const { return true; } |
6542 }; | 6541 }; |
6543 | 6542 |
6544 | 6543 |
6545 #undef DECLARE_INSTRUCTION | 6544 #undef DECLARE_INSTRUCTION |
6546 #undef DECLARE_CONCRETE_INSTRUCTION | 6545 #undef DECLARE_CONCRETE_INSTRUCTION |
6547 | 6546 |
6548 } } // namespace v8::internal | 6547 } } // namespace v8::internal |
6549 | 6548 |
6550 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6549 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |