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 3769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3780 | 3780 |
3781 | 3781 |
3782 HObjectAccess HObjectAccess::ForFixedArrayHeader(int offset) { | 3782 HObjectAccess HObjectAccess::ForFixedArrayHeader(int offset) { |
3783 ASSERT(offset >= 0); | 3783 ASSERT(offset >= 0); |
3784 ASSERT(offset < FixedArray::kHeaderSize); | 3784 ASSERT(offset < FixedArray::kHeaderSize); |
3785 if (offset == FixedArray::kLengthOffset) return ForFixedArrayLength(); | 3785 if (offset == FixedArray::kLengthOffset) return ForFixedArrayLength(); |
3786 return HObjectAccess(kInobject, offset); | 3786 return HObjectAccess(kInobject, offset); |
3787 } | 3787 } |
3788 | 3788 |
3789 | 3789 |
3790 HObjectAccess HObjectAccess::ForJSObjectOffset(int offset) { | 3790 HObjectAccess HObjectAccess::ForJSObjectOffset(int offset, |
| 3791 Representation representation) { |
3791 ASSERT(offset >= 0); | 3792 ASSERT(offset >= 0); |
3792 Portion portion = kInobject; | 3793 Portion portion = kInobject; |
3793 | 3794 |
3794 if (offset == JSObject::kElementsOffset) { | 3795 if (offset == JSObject::kElementsOffset) { |
3795 portion = kElementsPointer; | 3796 portion = kElementsPointer; |
3796 } else if (offset == JSObject::kMapOffset) { | 3797 } else if (offset == JSObject::kMapOffset) { |
3797 portion = kMaps; | 3798 portion = kMaps; |
3798 } | 3799 } |
3799 return HObjectAccess(portion, offset, Handle<String>::null()); | 3800 return HObjectAccess(portion, offset, representation); |
3800 } | 3801 } |
3801 | 3802 |
3802 | 3803 |
3803 HObjectAccess HObjectAccess::ForJSArrayOffset(int offset) { | 3804 HObjectAccess HObjectAccess::ForJSArrayOffset(int offset) { |
3804 ASSERT(offset >= 0); | 3805 ASSERT(offset >= 0); |
3805 Portion portion = kInobject; | 3806 Portion portion = kInobject; |
3806 | 3807 |
3807 if (offset == JSObject::kElementsOffset) { | 3808 if (offset == JSObject::kElementsOffset) { |
3808 portion = kElementsPointer; | 3809 portion = kElementsPointer; |
3809 } else if (offset == JSArray::kLengthOffset) { | 3810 } else if (offset == JSArray::kLengthOffset) { |
3810 portion = kArrayLengths; | 3811 portion = kArrayLengths; |
3811 } else if (offset == JSObject::kMapOffset) { | 3812 } else if (offset == JSObject::kMapOffset) { |
3812 portion = kMaps; | 3813 portion = kMaps; |
3813 } | 3814 } |
3814 return HObjectAccess(portion, offset, Handle<String>::null()); | 3815 return HObjectAccess(portion, offset); |
3815 } | 3816 } |
3816 | 3817 |
3817 | 3818 |
3818 HObjectAccess HObjectAccess::ForBackingStoreOffset(int offset) { | 3819 HObjectAccess HObjectAccess::ForBackingStoreOffset(int offset, |
| 3820 Representation representation) { |
3819 ASSERT(offset >= 0); | 3821 ASSERT(offset >= 0); |
3820 return HObjectAccess(kBackingStore, offset, Handle<String>::null()); | 3822 return HObjectAccess(kBackingStore, offset, representation); |
3821 } | 3823 } |
3822 | 3824 |
3823 | 3825 |
3824 HObjectAccess HObjectAccess::ForField(Handle<Map> map, | 3826 HObjectAccess HObjectAccess::ForField(Handle<Map> map, |
3825 LookupResult *lookup, Handle<String> name) { | 3827 LookupResult *lookup, Handle<String> name) { |
3826 ASSERT(lookup->IsField() || lookup->IsTransitionToField(*map)); | 3828 ASSERT(lookup->IsField() || lookup->IsTransitionToField(*map)); |
3827 int index; | 3829 int index; |
| 3830 Representation representation; |
3828 if (lookup->IsField()) { | 3831 if (lookup->IsField()) { |
3829 index = lookup->GetLocalFieldIndexFromMap(*map); | 3832 index = lookup->GetLocalFieldIndexFromMap(*map); |
| 3833 representation = lookup->representation(); |
3830 } else { | 3834 } else { |
3831 Map* transition = lookup->GetTransitionMapFromMap(*map); | 3835 Map* transition = lookup->GetTransitionMapFromMap(*map); |
3832 int descriptor = transition->LastAdded(); | 3836 int descriptor = transition->LastAdded(); |
3833 index = transition->instance_descriptors()->GetFieldIndex(descriptor) - | 3837 index = transition->instance_descriptors()->GetFieldIndex(descriptor) - |
3834 map->inobject_properties(); | 3838 map->inobject_properties(); |
| 3839 PropertyDetails details = |
| 3840 transition->instance_descriptors()->GetDetails(descriptor); |
| 3841 representation = details.representation(); |
3835 } | 3842 } |
3836 if (index < 0) { | 3843 if (index < 0) { |
3837 // Negative property indices are in-object properties, indexed | 3844 // Negative property indices are in-object properties, indexed |
3838 // from the end of the fixed part of the object. | 3845 // from the end of the fixed part of the object. |
3839 int offset = (index * kPointerSize) + map->instance_size(); | 3846 int offset = (index * kPointerSize) + map->instance_size(); |
3840 return HObjectAccess(kInobject, offset); | 3847 return HObjectAccess(kInobject, offset, representation); |
3841 } else { | 3848 } else { |
3842 // Non-negative property indices are in the properties array. | 3849 // Non-negative property indices are in the properties array. |
3843 int offset = (index * kPointerSize) + FixedArray::kHeaderSize; | 3850 int offset = (index * kPointerSize) + FixedArray::kHeaderSize; |
3844 return HObjectAccess(kBackingStore, offset, name); | 3851 return HObjectAccess(kBackingStore, offset, representation, name); |
3845 } | 3852 } |
3846 } | 3853 } |
3847 | 3854 |
3848 | 3855 |
3849 HObjectAccess HObjectAccess::ForCellPayload(Isolate* isolate) { | 3856 HObjectAccess HObjectAccess::ForCellPayload(Isolate* isolate) { |
3850 return HObjectAccess( | 3857 return HObjectAccess( |
3851 kInobject, Cell::kValueOffset, | 3858 kInobject, Cell::kValueOffset, |
| 3859 Representation::Tagged(), |
3852 Handle<String>(isolate->heap()->cell_value_string())); | 3860 Handle<String>(isolate->heap()->cell_value_string())); |
3853 } | 3861 } |
3854 | 3862 |
3855 | 3863 |
3856 void HObjectAccess::SetGVNFlags(HValue *instr, bool is_store) { | 3864 void HObjectAccess::SetGVNFlags(HValue *instr, bool is_store) { |
3857 // set the appropriate GVN flags for a given load or store instruction | 3865 // set the appropriate GVN flags for a given load or store instruction |
3858 if (is_store) { | 3866 if (is_store) { |
3859 // track dominating allocations in order to eliminate write barriers | 3867 // track dominating allocations in order to eliminate write barriers |
3860 instr->SetGVNFlag(kDependsOnNewSpacePromotion); | 3868 instr->SetGVNFlag(kDependsOnNewSpacePromotion); |
3861 instr->SetFlag(HValue::kTrackSideEffectDominators); | 3869 instr->SetFlag(HValue::kTrackSideEffectDominators); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3915 case kBackingStore: | 3923 case kBackingStore: |
3916 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 3924 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); |
3917 stream->Add("[backing-store]"); | 3925 stream->Add("[backing-store]"); |
3918 break; | 3926 break; |
3919 } | 3927 } |
3920 | 3928 |
3921 stream->Add("@%d", offset()); | 3929 stream->Add("@%d", offset()); |
3922 } | 3930 } |
3923 | 3931 |
3924 } } // namespace v8::internal | 3932 } } // namespace v8::internal |
OLD | NEW |