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 5329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5340 } | 5340 } |
5341 | 5341 |
5342 static HObjectAccess ForElementsPointer() { | 5342 static HObjectAccess ForElementsPointer() { |
5343 return HObjectAccess(kElementsPointer, JSObject::kElementsOffset); | 5343 return HObjectAccess(kElementsPointer, JSObject::kElementsOffset); |
5344 } | 5344 } |
5345 | 5345 |
5346 static HObjectAccess ForArrayLength() { | 5346 static HObjectAccess ForArrayLength() { |
5347 return HObjectAccess(kArrayLengths, JSArray::kLengthOffset); | 5347 return HObjectAccess(kArrayLengths, JSArray::kLengthOffset); |
5348 } | 5348 } |
5349 | 5349 |
| 5350 static HObjectAccess ForAllocationSitePayload() { |
| 5351 return HObjectAccess(kInobject, AllocationSite::kPayloadOffset); |
| 5352 } |
| 5353 |
5350 static HObjectAccess ForFixedArrayLength() { | 5354 static HObjectAccess ForFixedArrayLength() { |
5351 return HObjectAccess(kArrayLengths, FixedArray::kLengthOffset); | 5355 return HObjectAccess(kArrayLengths, FixedArray::kLengthOffset); |
5352 } | 5356 } |
5353 | 5357 |
5354 static HObjectAccess ForPropertiesPointer() { | 5358 static HObjectAccess ForPropertiesPointer() { |
5355 return HObjectAccess(kInobject, JSObject::kPropertiesOffset); | 5359 return HObjectAccess(kInobject, JSObject::kPropertiesOffset); |
5356 } | 5360 } |
5357 | 5361 |
5358 static HObjectAccess ForPrototypeOrInitialMap() { | 5362 static HObjectAccess ForPrototypeOrInitialMap() { |
5359 return HObjectAccess(kInobject, JSFunction::kPrototypeOrInitialMapOffset); | 5363 return HObjectAccess(kInobject, JSFunction::kPrototypeOrInitialMapOffset); |
5360 } | 5364 } |
5361 | 5365 |
5362 static HObjectAccess ForMap() { | 5366 static HObjectAccess ForMap() { |
5363 return HObjectAccess(kMaps, JSObject::kMapOffset); | 5367 return HObjectAccess(kMaps, JSObject::kMapOffset); |
5364 } | 5368 } |
5365 | 5369 |
5366 static HObjectAccess ForAllocationSitePayload() { | 5370 static HObjectAccess ForPropertyCellValue() { |
5367 return HObjectAccess(kInobject, AllocationSiteInfo::kPayloadOffset); | 5371 return HObjectAccess(kInobject, PropertyCell::kValueOffset); |
| 5372 } |
| 5373 |
| 5374 static HObjectAccess ForCellValue() { |
| 5375 return HObjectAccess(kInobject, Cell::kValueOffset); |
| 5376 } |
| 5377 |
| 5378 static HObjectAccess ForAllocationSiteInfoSite() { |
| 5379 return HObjectAccess(kInobject, AllocationSiteInfo::kAllocationSiteOffset); |
5368 } | 5380 } |
5369 | 5381 |
5370 // Create an access to an offset in a fixed array header. | 5382 // Create an access to an offset in a fixed array header. |
5371 static HObjectAccess ForFixedArrayHeader(int offset); | 5383 static HObjectAccess ForFixedArrayHeader(int offset); |
5372 | 5384 |
5373 // Create an access to an in-object property in a JSObject. | 5385 // Create an access to an in-object property in a JSObject. |
5374 static HObjectAccess ForJSObjectOffset(int offset); | 5386 static HObjectAccess ForJSObjectOffset(int offset); |
5375 | 5387 |
5376 // Create an access to an in-object property in a JSArray. | 5388 // Create an access to an in-object property in a JSArray. |
5377 static HObjectAccess ForJSArrayOffset(int offset); | 5389 static HObjectAccess ForJSArrayOffset(int offset); |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5785 public: | 5797 public: |
5786 HStoreNamedField(HValue* obj, | 5798 HStoreNamedField(HValue* obj, |
5787 HObjectAccess access, | 5799 HObjectAccess access, |
5788 HValue* val, | 5800 HValue* val, |
5789 Representation field_representation | 5801 Representation field_representation |
5790 = Representation::Tagged()) | 5802 = Representation::Tagged()) |
5791 : access_(access), | 5803 : access_(access), |
5792 field_representation_(field_representation), | 5804 field_representation_(field_representation), |
5793 transition_(), | 5805 transition_(), |
5794 transition_unique_id_(), | 5806 transition_unique_id_(), |
5795 new_space_dominator_(NULL) { | 5807 new_space_dominator_(NULL), |
| 5808 write_barrier_mode_(UPDATE_WRITE_BARRIER) { |
5796 SetOperandAt(0, obj); | 5809 SetOperandAt(0, obj); |
5797 SetOperandAt(1, val); | 5810 SetOperandAt(1, val); |
5798 access.SetGVNFlags(this, true); | 5811 access.SetGVNFlags(this, true); |
5799 } | 5812 } |
5800 | 5813 |
5801 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) | 5814 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) |
5802 | 5815 |
5803 virtual bool HasEscapingOperandAt(int index) { return index == 1; } | 5816 virtual bool HasEscapingOperandAt(int index) { return index == 1; } |
5804 virtual Representation RequiredInputRepresentation(int index) { | 5817 virtual Representation RequiredInputRepresentation(int index) { |
5805 if (FLAG_track_double_fields && | 5818 if (FLAG_track_double_fields && |
5806 index == 1 && field_representation_.IsDouble()) { | 5819 index == 1 && field_representation_.IsDouble()) { |
5807 return field_representation_; | 5820 return field_representation_; |
5808 } else if (FLAG_track_fields && | 5821 } else if (FLAG_track_fields && |
5809 index == 1 && field_representation_.IsSmi()) { | 5822 index == 1 && field_representation_.IsSmi()) { |
5810 return field_representation_; | 5823 return field_representation_; |
5811 } | 5824 } |
5812 return Representation::Tagged(); | 5825 return Representation::Tagged(); |
5813 } | 5826 } |
5814 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) { | 5827 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) { |
5815 ASSERT(side_effect == kChangesNewSpacePromotion); | 5828 ASSERT(side_effect == kChangesNewSpacePromotion); |
5816 new_space_dominator_ = dominator; | 5829 new_space_dominator_ = dominator; |
5817 } | 5830 } |
5818 virtual void PrintDataTo(StringStream* stream); | 5831 virtual void PrintDataTo(StringStream* stream); |
5819 | 5832 |
| 5833 void SkipWriteBarrier() { write_barrier_mode_ = SKIP_WRITE_BARRIER; } |
| 5834 bool IsSkipWriteBarrier() const { |
| 5835 return write_barrier_mode_ == SKIP_WRITE_BARRIER; |
| 5836 } |
| 5837 |
5820 HValue* object() { return OperandAt(0); } | 5838 HValue* object() { return OperandAt(0); } |
5821 HValue* value() { return OperandAt(1); } | 5839 HValue* value() { return OperandAt(1); } |
5822 | 5840 |
5823 HObjectAccess access() const { return access_; } | 5841 HObjectAccess access() const { return access_; } |
5824 Handle<Map> transition() const { return transition_; } | 5842 Handle<Map> transition() const { return transition_; } |
5825 UniqueValueId transition_unique_id() const { return transition_unique_id_; } | 5843 UniqueValueId transition_unique_id() const { return transition_unique_id_; } |
5826 void SetTransition(Handle<Map> map, CompilationInfo* info) { | 5844 void SetTransition(Handle<Map> map, CompilationInfo* info) { |
5827 ASSERT(transition_.is_null()); // Only set once. | 5845 ASSERT(transition_.is_null()); // Only set once. |
5828 if (map->CanBeDeprecated()) { | 5846 if (map->CanBeDeprecated()) { |
5829 map->AddDependentCompilationInfo(DependentCode::kTransitionGroup, info); | 5847 map->AddDependentCompilationInfo(DependentCode::kTransitionGroup, info); |
5830 } | 5848 } |
5831 transition_ = map; | 5849 transition_ = map; |
5832 } | 5850 } |
5833 HValue* new_space_dominator() const { return new_space_dominator_; } | 5851 HValue* new_space_dominator() const { return new_space_dominator_; } |
5834 | 5852 |
5835 bool NeedsWriteBarrier() { | 5853 bool NeedsWriteBarrier() { |
5836 ASSERT(!(FLAG_track_double_fields && field_representation_.IsDouble()) || | 5854 ASSERT(!(FLAG_track_double_fields && field_representation_.IsDouble()) || |
5837 transition_.is_null()); | 5855 transition_.is_null()); |
| 5856 if (IsSkipWriteBarrier()) return false; |
5838 return (!FLAG_track_fields || !field_representation_.IsSmi()) && | 5857 return (!FLAG_track_fields || !field_representation_.IsSmi()) && |
5839 // If there is a transition, a new storage object needs to be allocated. | 5858 // If there is a transition, a new storage object needs to be allocated. |
5840 !(FLAG_track_double_fields && field_representation_.IsDouble()) && | 5859 !(FLAG_track_double_fields && field_representation_.IsDouble()) && |
5841 StoringValueNeedsWriteBarrier(value()) && | 5860 StoringValueNeedsWriteBarrier(value()) && |
5842 ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); | 5861 ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); |
5843 } | 5862 } |
5844 | 5863 |
5845 bool NeedsWriteBarrierForMap() { | 5864 bool NeedsWriteBarrierForMap() { |
| 5865 if (IsSkipWriteBarrier()) return false; |
5846 return ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); | 5866 return ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); |
5847 } | 5867 } |
5848 | 5868 |
5849 virtual void FinalizeUniqueValueId() { | 5869 virtual void FinalizeUniqueValueId() { |
5850 transition_unique_id_ = UniqueValueId(transition_); | 5870 transition_unique_id_ = UniqueValueId(transition_); |
5851 } | 5871 } |
5852 | 5872 |
5853 Representation field_representation() const { | 5873 Representation field_representation() const { |
5854 return field_representation_; | 5874 return field_representation_; |
5855 } | 5875 } |
5856 | 5876 |
5857 private: | 5877 private: |
5858 HObjectAccess access_; | 5878 HObjectAccess access_; |
5859 Representation field_representation_; | 5879 Representation field_representation_; |
5860 Handle<Map> transition_; | 5880 Handle<Map> transition_; |
5861 UniqueValueId transition_unique_id_; | 5881 UniqueValueId transition_unique_id_; |
5862 HValue* new_space_dominator_; | 5882 HValue* new_space_dominator_; |
| 5883 WriteBarrierMode write_barrier_mode_; |
5863 }; | 5884 }; |
5864 | 5885 |
5865 | 5886 |
5866 class HStoreNamedGeneric: public HTemplateInstruction<3> { | 5887 class HStoreNamedGeneric: public HTemplateInstruction<3> { |
5867 public: | 5888 public: |
5868 HStoreNamedGeneric(HValue* context, | 5889 HStoreNamedGeneric(HValue* context, |
5869 HValue* object, | 5890 HValue* object, |
5870 Handle<String> name, | 5891 Handle<String> name, |
5871 HValue* value, | 5892 HValue* value, |
5872 StrictModeFlag strict_mode_flag) | 5893 StrictModeFlag strict_mode_flag) |
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6689 virtual bool IsDeletable() const { return true; } | 6710 virtual bool IsDeletable() const { return true; } |
6690 }; | 6711 }; |
6691 | 6712 |
6692 | 6713 |
6693 #undef DECLARE_INSTRUCTION | 6714 #undef DECLARE_INSTRUCTION |
6694 #undef DECLARE_CONCRETE_INSTRUCTION | 6715 #undef DECLARE_CONCRETE_INSTRUCTION |
6695 | 6716 |
6696 } } // namespace v8::internal | 6717 } } // namespace v8::internal |
6697 | 6718 |
6698 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6719 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |