| 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 3747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3758 | 3758 |
| 3759 | 3759 |
| 3760 HObjectAccess HObjectAccess::ForFixedArrayHeader(int offset) { | 3760 HObjectAccess HObjectAccess::ForFixedArrayHeader(int offset) { |
| 3761 ASSERT(offset >= 0); | 3761 ASSERT(offset >= 0); |
| 3762 ASSERT(offset < FixedArray::kHeaderSize); | 3762 ASSERT(offset < FixedArray::kHeaderSize); |
| 3763 if (offset == FixedArray::kLengthOffset) return ForFixedArrayLength(); | 3763 if (offset == FixedArray::kLengthOffset) return ForFixedArrayLength(); |
| 3764 return HObjectAccess(kInobject, offset); | 3764 return HObjectAccess(kInobject, offset); |
| 3765 } | 3765 } |
| 3766 | 3766 |
| 3767 | 3767 |
| 3768 HObjectAccess HObjectAccess::ForJSObjectOffset(int offset) { | 3768 HObjectAccess HObjectAccess::ForJSObjectOffset(int offset, |
| 3769 Representation representation) { |
| 3769 ASSERT(offset >= 0); | 3770 ASSERT(offset >= 0); |
| 3770 Portion portion = kInobject; | 3771 Portion portion = kInobject; |
| 3771 | 3772 |
| 3772 if (offset == JSObject::kElementsOffset) { | 3773 if (offset == JSObject::kElementsOffset) { |
| 3773 portion = kElementsPointer; | 3774 portion = kElementsPointer; |
| 3774 } else if (offset == JSObject::kMapOffset) { | 3775 } else if (offset == JSObject::kMapOffset) { |
| 3775 portion = kMaps; | 3776 portion = kMaps; |
| 3776 } | 3777 } |
| 3777 return HObjectAccess(portion, offset, Handle<String>::null()); | 3778 return HObjectAccess(portion, offset, representation); |
| 3778 } | 3779 } |
| 3779 | 3780 |
| 3780 | 3781 |
| 3781 HObjectAccess HObjectAccess::ForJSArrayOffset(int offset) { | 3782 HObjectAccess HObjectAccess::ForJSArrayOffset(int offset) { |
| 3782 ASSERT(offset >= 0); | 3783 ASSERT(offset >= 0); |
| 3783 Portion portion = kInobject; | 3784 Portion portion = kInobject; |
| 3784 | 3785 |
| 3785 if (offset == JSObject::kElementsOffset) { | 3786 if (offset == JSObject::kElementsOffset) { |
| 3786 portion = kElementsPointer; | 3787 portion = kElementsPointer; |
| 3787 } else if (offset == JSArray::kLengthOffset) { | 3788 } else if (offset == JSArray::kLengthOffset) { |
| 3788 portion = kArrayLengths; | 3789 portion = kArrayLengths; |
| 3789 } else if (offset == JSObject::kMapOffset) { | 3790 } else if (offset == JSObject::kMapOffset) { |
| 3790 portion = kMaps; | 3791 portion = kMaps; |
| 3791 } | 3792 } |
| 3792 return HObjectAccess(portion, offset, Handle<String>::null()); | 3793 return HObjectAccess(portion, offset); |
| 3793 } | 3794 } |
| 3794 | 3795 |
| 3795 | 3796 |
| 3796 HObjectAccess HObjectAccess::ForBackingStoreOffset(int offset) { | 3797 HObjectAccess HObjectAccess::ForBackingStoreOffset(int offset, |
| 3798 Representation representation) { |
| 3797 ASSERT(offset >= 0); | 3799 ASSERT(offset >= 0); |
| 3798 return HObjectAccess(kBackingStore, offset, Handle<String>::null()); | 3800 return HObjectAccess(kBackingStore, offset, representation); |
| 3799 } | 3801 } |
| 3800 | 3802 |
| 3801 | 3803 |
| 3802 HObjectAccess HObjectAccess::ForField(Handle<Map> map, | 3804 HObjectAccess HObjectAccess::ForField(Handle<Map> map, |
| 3803 LookupResult *lookup, Handle<String> name) { | 3805 LookupResult *lookup, Handle<String> name) { |
| 3804 ASSERT(lookup->IsField() || lookup->IsTransitionToField(*map)); | 3806 ASSERT(lookup->IsField() || lookup->IsTransitionToField(*map)); |
| 3805 int index; | 3807 int index; |
| 3808 Representation representation; |
| 3806 if (lookup->IsField()) { | 3809 if (lookup->IsField()) { |
| 3807 index = lookup->GetLocalFieldIndexFromMap(*map); | 3810 index = lookup->GetLocalFieldIndexFromMap(*map); |
| 3811 representation = lookup->representation(); |
| 3808 } else { | 3812 } else { |
| 3809 Map* transition = lookup->GetTransitionMapFromMap(*map); | 3813 Map* transition = lookup->GetTransitionMapFromMap(*map); |
| 3810 int descriptor = transition->LastAdded(); | 3814 int descriptor = transition->LastAdded(); |
| 3811 index = transition->instance_descriptors()->GetFieldIndex(descriptor) - | 3815 index = transition->instance_descriptors()->GetFieldIndex(descriptor) - |
| 3812 map->inobject_properties(); | 3816 map->inobject_properties(); |
| 3817 PropertyDetails details = |
| 3818 transition->instance_descriptors()->GetDetails(descriptor); |
| 3819 representation = details.representation(); |
| 3813 } | 3820 } |
| 3814 if (index < 0) { | 3821 if (index < 0) { |
| 3815 // Negative property indices are in-object properties, indexed | 3822 // Negative property indices are in-object properties, indexed |
| 3816 // from the end of the fixed part of the object. | 3823 // from the end of the fixed part of the object. |
| 3817 int offset = (index * kPointerSize) + map->instance_size(); | 3824 int offset = (index * kPointerSize) + map->instance_size(); |
| 3818 return HObjectAccess(kInobject, offset); | 3825 return HObjectAccess(kInobject, offset, representation); |
| 3819 } else { | 3826 } else { |
| 3820 // Non-negative property indices are in the properties array. | 3827 // Non-negative property indices are in the properties array. |
| 3821 int offset = (index * kPointerSize) + FixedArray::kHeaderSize; | 3828 int offset = (index * kPointerSize) + FixedArray::kHeaderSize; |
| 3822 return HObjectAccess(kBackingStore, offset, name); | 3829 return HObjectAccess(kBackingStore, offset, representation, name); |
| 3823 } | 3830 } |
| 3824 } | 3831 } |
| 3825 | 3832 |
| 3826 | 3833 |
| 3827 void HObjectAccess::SetGVNFlags(HValue *instr, bool is_store) { | 3834 void HObjectAccess::SetGVNFlags(HValue *instr, bool is_store) { |
| 3828 // set the appropriate GVN flags for a given load or store instruction | 3835 // set the appropriate GVN flags for a given load or store instruction |
| 3829 if (is_store) { | 3836 if (is_store) { |
| 3830 // track dominating allocations in order to eliminate write barriers | 3837 // track dominating allocations in order to eliminate write barriers |
| 3831 instr->SetGVNFlag(kDependsOnNewSpacePromotion); | 3838 instr->SetGVNFlag(kDependsOnNewSpacePromotion); |
| 3832 instr->SetFlag(HValue::kTrackSideEffectDominators); | 3839 instr->SetFlag(HValue::kTrackSideEffectDominators); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3886 case kBackingStore: | 3893 case kBackingStore: |
| 3887 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 3894 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); |
| 3888 stream->Add("[backing-store]"); | 3895 stream->Add("[backing-store]"); |
| 3889 break; | 3896 break; |
| 3890 } | 3897 } |
| 3891 | 3898 |
| 3892 stream->Add("@%d", offset()); | 3899 stream->Add("@%d", offset()); |
| 3893 } | 3900 } |
| 3894 | 3901 |
| 3895 } } // namespace v8::internal | 3902 } } // namespace v8::internal |
| OLD | NEW |