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 5303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5314 } | 5314 } |
5315 | 5315 |
5316 static HObjectAccess ForElementsPointer() { | 5316 static HObjectAccess ForElementsPointer() { |
5317 return HObjectAccess(kElementsPointer, JSObject::kElementsOffset); | 5317 return HObjectAccess(kElementsPointer, JSObject::kElementsOffset); |
5318 } | 5318 } |
5319 | 5319 |
5320 static HObjectAccess ForArrayLength() { | 5320 static HObjectAccess ForArrayLength() { |
5321 return HObjectAccess(kArrayLengths, JSArray::kLengthOffset); | 5321 return HObjectAccess(kArrayLengths, JSArray::kLengthOffset); |
5322 } | 5322 } |
5323 | 5323 |
| 5324 static HObjectAccess ForAllocationSitePayload() { |
| 5325 return HObjectAccess(kInobject, AllocationSite::kPayloadOffset); |
| 5326 } |
| 5327 |
5324 static HObjectAccess ForFixedArrayLength() { | 5328 static HObjectAccess ForFixedArrayLength() { |
5325 return HObjectAccess(kArrayLengths, FixedArray::kLengthOffset); | 5329 return HObjectAccess(kArrayLengths, FixedArray::kLengthOffset); |
5326 } | 5330 } |
5327 | 5331 |
5328 static HObjectAccess ForPropertiesPointer() { | 5332 static HObjectAccess ForPropertiesPointer() { |
5329 return HObjectAccess(kInobject, JSObject::kPropertiesOffset); | 5333 return HObjectAccess(kInobject, JSObject::kPropertiesOffset); |
5330 } | 5334 } |
5331 | 5335 |
5332 static HObjectAccess ForPrototypeOrInitialMap() { | 5336 static HObjectAccess ForPrototypeOrInitialMap() { |
5333 return HObjectAccess(kInobject, JSFunction::kPrototypeOrInitialMapOffset); | 5337 return HObjectAccess(kInobject, JSFunction::kPrototypeOrInitialMapOffset); |
5334 } | 5338 } |
5335 | 5339 |
5336 static HObjectAccess ForMap() { | 5340 static HObjectAccess ForMap() { |
5337 return HObjectAccess(kMaps, JSObject::kMapOffset); | 5341 return HObjectAccess(kMaps, JSObject::kMapOffset); |
5338 } | 5342 } |
5339 | 5343 |
5340 static HObjectAccess ForAllocationSitePayload() { | 5344 static HObjectAccess ForPropertyCellValue() { |
5341 return HObjectAccess(kInobject, AllocationSiteInfo::kPayloadOffset); | 5345 return HObjectAccess(kInobject, PropertyCell::kValueOffset); |
| 5346 } |
| 5347 |
| 5348 static HObjectAccess ForCellValue() { |
| 5349 return HObjectAccess(kInobject, Cell::kValueOffset); |
| 5350 } |
| 5351 |
| 5352 static HObjectAccess ForAllocationSiteInfoSite() { |
| 5353 return HObjectAccess(kInobject, AllocationSiteInfo::kAllocationSiteOffset); |
5342 } | 5354 } |
5343 | 5355 |
5344 // Create an access to an offset in a fixed array header. | 5356 // Create an access to an offset in a fixed array header. |
5345 static HObjectAccess ForFixedArrayHeader(int offset); | 5357 static HObjectAccess ForFixedArrayHeader(int offset); |
5346 | 5358 |
5347 // Create an access to an in-object property in a JSObject. | 5359 // Create an access to an in-object property in a JSObject. |
5348 static HObjectAccess ForJSObjectOffset(int offset); | 5360 static HObjectAccess ForJSObjectOffset(int offset); |
5349 | 5361 |
5350 // Create an access to an in-object property in a JSArray. | 5362 // Create an access to an in-object property in a JSArray. |
5351 static HObjectAccess ForJSArrayOffset(int offset); | 5363 static HObjectAccess ForJSArrayOffset(int offset); |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5756 public: | 5768 public: |
5757 HStoreNamedField(HValue* obj, | 5769 HStoreNamedField(HValue* obj, |
5758 HObjectAccess access, | 5770 HObjectAccess access, |
5759 HValue* val, | 5771 HValue* val, |
5760 Representation field_representation | 5772 Representation field_representation |
5761 = Representation::Tagged()) | 5773 = Representation::Tagged()) |
5762 : access_(access), | 5774 : access_(access), |
5763 field_representation_(field_representation), | 5775 field_representation_(field_representation), |
5764 transition_(), | 5776 transition_(), |
5765 transition_unique_id_(), | 5777 transition_unique_id_(), |
5766 new_space_dominator_(NULL) { | 5778 new_space_dominator_(NULL), |
| 5779 write_barrier_mode_(UPDATE_WRITE_BARRIER) { |
5767 SetOperandAt(0, obj); | 5780 SetOperandAt(0, obj); |
5768 SetOperandAt(1, val); | 5781 SetOperandAt(1, val); |
5769 access.SetGVNFlags(this, true); | 5782 access.SetGVNFlags(this, true); |
5770 } | 5783 } |
5771 | 5784 |
5772 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) | 5785 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) |
5773 | 5786 |
5774 virtual bool HasEscapingOperandAt(int index) { return index == 1; } | 5787 virtual bool HasEscapingOperandAt(int index) { return index == 1; } |
5775 virtual Representation RequiredInputRepresentation(int index) { | 5788 virtual Representation RequiredInputRepresentation(int index) { |
5776 if (FLAG_track_double_fields && | 5789 if (FLAG_track_double_fields && |
5777 index == 1 && field_representation_.IsDouble()) { | 5790 index == 1 && field_representation_.IsDouble()) { |
5778 return field_representation_; | 5791 return field_representation_; |
5779 } else if (FLAG_track_fields && | 5792 } else if (FLAG_track_fields && |
5780 index == 1 && field_representation_.IsSmi()) { | 5793 index == 1 && field_representation_.IsSmi()) { |
5781 return field_representation_; | 5794 return field_representation_; |
5782 } | 5795 } |
5783 return Representation::Tagged(); | 5796 return Representation::Tagged(); |
5784 } | 5797 } |
5785 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) { | 5798 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) { |
5786 ASSERT(side_effect == kChangesNewSpacePromotion); | 5799 ASSERT(side_effect == kChangesNewSpacePromotion); |
5787 new_space_dominator_ = dominator; | 5800 new_space_dominator_ = dominator; |
5788 } | 5801 } |
5789 virtual void PrintDataTo(StringStream* stream); | 5802 virtual void PrintDataTo(StringStream* stream); |
5790 | 5803 |
| 5804 void SkipWriteBarrier() { write_barrier_mode_ = SKIP_WRITE_BARRIER; } |
| 5805 bool IsSkipWriteBarrier() const { |
| 5806 return write_barrier_mode_ == SKIP_WRITE_BARRIER; |
| 5807 } |
| 5808 |
5791 HValue* object() { return OperandAt(0); } | 5809 HValue* object() { return OperandAt(0); } |
5792 HValue* value() { return OperandAt(1); } | 5810 HValue* value() { return OperandAt(1); } |
5793 | 5811 |
5794 HObjectAccess access() const { return access_; } | 5812 HObjectAccess access() const { return access_; } |
5795 Handle<Map> transition() const { return transition_; } | 5813 Handle<Map> transition() const { return transition_; } |
5796 UniqueValueId transition_unique_id() const { return transition_unique_id_; } | 5814 UniqueValueId transition_unique_id() const { return transition_unique_id_; } |
5797 void SetTransition(Handle<Map> map, CompilationInfo* info) { | 5815 void SetTransition(Handle<Map> map, CompilationInfo* info) { |
5798 ASSERT(transition_.is_null()); // Only set once. | 5816 ASSERT(transition_.is_null()); // Only set once. |
5799 if (map->CanBeDeprecated()) { | 5817 if (map->CanBeDeprecated()) { |
5800 map->AddDependentCompilationInfo(DependentCode::kTransitionGroup, info); | 5818 map->AddDependentCompilationInfo(DependentCode::kTransitionGroup, info); |
5801 } | 5819 } |
5802 transition_ = map; | 5820 transition_ = map; |
5803 } | 5821 } |
5804 HValue* new_space_dominator() const { return new_space_dominator_; } | 5822 HValue* new_space_dominator() const { return new_space_dominator_; } |
5805 | 5823 |
5806 bool NeedsWriteBarrier() { | 5824 bool NeedsWriteBarrier() { |
5807 ASSERT(!(FLAG_track_double_fields && field_representation_.IsDouble()) || | 5825 ASSERT(!(FLAG_track_double_fields && field_representation_.IsDouble()) || |
5808 transition_.is_null()); | 5826 transition_.is_null()); |
| 5827 if (IsSkipWriteBarrier()) return false; |
5809 return (!FLAG_track_fields || !field_representation_.IsSmi()) && | 5828 return (!FLAG_track_fields || !field_representation_.IsSmi()) && |
5810 // If there is a transition, a new storage object needs to be allocated. | 5829 // If there is a transition, a new storage object needs to be allocated. |
5811 !(FLAG_track_double_fields && field_representation_.IsDouble()) && | 5830 !(FLAG_track_double_fields && field_representation_.IsDouble()) && |
5812 StoringValueNeedsWriteBarrier(value()) && | 5831 StoringValueNeedsWriteBarrier(value()) && |
5813 ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); | 5832 ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); |
5814 } | 5833 } |
5815 | 5834 |
5816 bool NeedsWriteBarrierForMap() { | 5835 bool NeedsWriteBarrierForMap() { |
| 5836 if (IsSkipWriteBarrier()) return false; |
5817 return ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); | 5837 return ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); |
5818 } | 5838 } |
5819 | 5839 |
5820 virtual void FinalizeUniqueValueId() { | 5840 virtual void FinalizeUniqueValueId() { |
5821 transition_unique_id_ = UniqueValueId(transition_); | 5841 transition_unique_id_ = UniqueValueId(transition_); |
5822 } | 5842 } |
5823 | 5843 |
5824 Representation field_representation() const { | 5844 Representation field_representation() const { |
5825 return field_representation_; | 5845 return field_representation_; |
5826 } | 5846 } |
5827 | 5847 |
5828 private: | 5848 private: |
5829 HObjectAccess access_; | 5849 HObjectAccess access_; |
5830 Representation field_representation_; | 5850 Representation field_representation_; |
5831 Handle<Map> transition_; | 5851 Handle<Map> transition_; |
5832 UniqueValueId transition_unique_id_; | 5852 UniqueValueId transition_unique_id_; |
5833 HValue* new_space_dominator_; | 5853 HValue* new_space_dominator_; |
| 5854 WriteBarrierMode write_barrier_mode_; |
5834 }; | 5855 }; |
5835 | 5856 |
5836 | 5857 |
5837 class HStoreNamedGeneric: public HTemplateInstruction<3> { | 5858 class HStoreNamedGeneric: public HTemplateInstruction<3> { |
5838 public: | 5859 public: |
5839 HStoreNamedGeneric(HValue* context, | 5860 HStoreNamedGeneric(HValue* context, |
5840 HValue* object, | 5861 HValue* object, |
5841 Handle<String> name, | 5862 Handle<String> name, |
5842 HValue* value, | 5863 HValue* value, |
5843 StrictModeFlag strict_mode_flag) | 5864 StrictModeFlag strict_mode_flag) |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6651 virtual bool IsDeletable() const { return true; } | 6672 virtual bool IsDeletable() const { return true; } |
6652 }; | 6673 }; |
6653 | 6674 |
6654 | 6675 |
6655 #undef DECLARE_INSTRUCTION | 6676 #undef DECLARE_INSTRUCTION |
6656 #undef DECLARE_CONCRETE_INSTRUCTION | 6677 #undef DECLARE_CONCRETE_INSTRUCTION |
6657 | 6678 |
6658 } } // namespace v8::internal | 6679 } } // namespace v8::internal |
6659 | 6680 |
6660 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6681 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |