| 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 3901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3912 | 3912 |
| 3913 | 3913 |
| 3914 HObjectAccess HObjectAccess::ForFixedArrayHeader(int offset) { | 3914 HObjectAccess HObjectAccess::ForFixedArrayHeader(int offset) { |
| 3915 ASSERT(offset >= 0); | 3915 ASSERT(offset >= 0); |
| 3916 ASSERT(offset < FixedArray::kHeaderSize); | 3916 ASSERT(offset < FixedArray::kHeaderSize); |
| 3917 if (offset == FixedArray::kLengthOffset) return ForFixedArrayLength(); | 3917 if (offset == FixedArray::kLengthOffset) return ForFixedArrayLength(); |
| 3918 return HObjectAccess(kInobject, offset); | 3918 return HObjectAccess(kInobject, offset); |
| 3919 } | 3919 } |
| 3920 | 3920 |
| 3921 | 3921 |
| 3922 HObjectAccess HObjectAccess::ForJSObjectOffset(int offset) { | 3922 HObjectAccess HObjectAccess::ForJSObjectOffset(int offset, |
| 3923 Representation representation) { |
| 3923 ASSERT(offset >= 0); | 3924 ASSERT(offset >= 0); |
| 3924 Portion portion = kInobject; | 3925 Portion portion = kInobject; |
| 3925 | 3926 |
| 3926 if (offset == JSObject::kElementsOffset) { | 3927 if (offset == JSObject::kElementsOffset) { |
| 3927 portion = kElementsPointer; | 3928 portion = kElementsPointer; |
| 3928 } else if (offset == JSObject::kMapOffset) { | 3929 } else if (offset == JSObject::kMapOffset) { |
| 3929 portion = kMaps; | 3930 portion = kMaps; |
| 3930 } | 3931 } |
| 3931 return HObjectAccess(portion, offset, Handle<String>::null()); | 3932 return HObjectAccess(portion, offset, representation); |
| 3932 } | 3933 } |
| 3933 | 3934 |
| 3934 | 3935 |
| 3935 HObjectAccess HObjectAccess::ForJSArrayOffset(int offset) { | 3936 HObjectAccess HObjectAccess::ForJSArrayOffset(int offset) { |
| 3936 ASSERT(offset >= 0); | 3937 ASSERT(offset >= 0); |
| 3937 Portion portion = kInobject; | 3938 Portion portion = kInobject; |
| 3938 | 3939 |
| 3939 if (offset == JSObject::kElementsOffset) { | 3940 if (offset == JSObject::kElementsOffset) { |
| 3940 portion = kElementsPointer; | 3941 portion = kElementsPointer; |
| 3941 } else if (offset == JSArray::kLengthOffset) { | 3942 } else if (offset == JSArray::kLengthOffset) { |
| 3942 portion = kArrayLengths; | 3943 portion = kArrayLengths; |
| 3943 } else if (offset == JSObject::kMapOffset) { | 3944 } else if (offset == JSObject::kMapOffset) { |
| 3944 portion = kMaps; | 3945 portion = kMaps; |
| 3945 } | 3946 } |
| 3946 return HObjectAccess(portion, offset, Handle<String>::null()); | 3947 return HObjectAccess(portion, offset); |
| 3947 } | 3948 } |
| 3948 | 3949 |
| 3949 | 3950 |
| 3950 HObjectAccess HObjectAccess::ForBackingStoreOffset(int offset) { | 3951 HObjectAccess HObjectAccess::ForBackingStoreOffset(int offset, |
| 3952 Representation representation) { |
| 3951 ASSERT(offset >= 0); | 3953 ASSERT(offset >= 0); |
| 3952 return HObjectAccess(kBackingStore, offset, Handle<String>::null()); | 3954 return HObjectAccess(kBackingStore, offset, representation); |
| 3953 } | 3955 } |
| 3954 | 3956 |
| 3955 | 3957 |
| 3956 HObjectAccess HObjectAccess::ForField(Handle<Map> map, | 3958 HObjectAccess HObjectAccess::ForField(Handle<Map> map, |
| 3957 LookupResult *lookup, Handle<String> name) { | 3959 LookupResult *lookup, Handle<String> name) { |
| 3958 ASSERT(lookup->IsField() || lookup->IsTransitionToField(*map)); | 3960 ASSERT(lookup->IsField() || lookup->IsTransitionToField(*map)); |
| 3959 int index; | 3961 int index; |
| 3962 Representation representation; |
| 3960 if (lookup->IsField()) { | 3963 if (lookup->IsField()) { |
| 3961 index = lookup->GetLocalFieldIndexFromMap(*map); | 3964 index = lookup->GetLocalFieldIndexFromMap(*map); |
| 3965 representation = lookup->representation(); |
| 3962 } else { | 3966 } else { |
| 3963 Map* transition = lookup->GetTransitionMapFromMap(*map); | 3967 Map* transition = lookup->GetTransitionMapFromMap(*map); |
| 3964 int descriptor = transition->LastAdded(); | 3968 int descriptor = transition->LastAdded(); |
| 3965 index = transition->instance_descriptors()->GetFieldIndex(descriptor) - | 3969 index = transition->instance_descriptors()->GetFieldIndex(descriptor) - |
| 3966 map->inobject_properties(); | 3970 map->inobject_properties(); |
| 3971 PropertyDetails details = |
| 3972 transition->instance_descriptors()->GetDetails(descriptor); |
| 3973 representation = details.representation(); |
| 3967 } | 3974 } |
| 3968 if (index < 0) { | 3975 if (index < 0) { |
| 3969 // Negative property indices are in-object properties, indexed | 3976 // Negative property indices are in-object properties, indexed |
| 3970 // from the end of the fixed part of the object. | 3977 // from the end of the fixed part of the object. |
| 3971 int offset = (index * kPointerSize) + map->instance_size(); | 3978 int offset = (index * kPointerSize) + map->instance_size(); |
| 3972 return HObjectAccess(kInobject, offset); | 3979 return HObjectAccess(kInobject, offset, representation); |
| 3973 } else { | 3980 } else { |
| 3974 // Non-negative property indices are in the properties array. | 3981 // Non-negative property indices are in the properties array. |
| 3975 int offset = (index * kPointerSize) + FixedArray::kHeaderSize; | 3982 int offset = (index * kPointerSize) + FixedArray::kHeaderSize; |
| 3976 return HObjectAccess(kBackingStore, offset, name); | 3983 return HObjectAccess(kBackingStore, offset, representation, name); |
| 3977 } | 3984 } |
| 3978 } | 3985 } |
| 3979 | 3986 |
| 3980 | 3987 |
| 3981 HObjectAccess HObjectAccess::ForCellPayload(Isolate* isolate) { | 3988 HObjectAccess HObjectAccess::ForCellPayload(Isolate* isolate) { |
| 3982 return HObjectAccess( | 3989 return HObjectAccess( |
| 3983 kInobject, Cell::kValueOffset, | 3990 kInobject, Cell::kValueOffset, Representation::Tagged(), |
| 3984 Handle<String>(isolate->heap()->cell_value_string())); | 3991 Handle<String>(isolate->heap()->cell_value_string())); |
| 3985 } | 3992 } |
| 3986 | 3993 |
| 3987 | 3994 |
| 3988 void HObjectAccess::SetGVNFlags(HValue *instr, bool is_store) { | 3995 void HObjectAccess::SetGVNFlags(HValue *instr, bool is_store) { |
| 3989 // set the appropriate GVN flags for a given load or store instruction | 3996 // set the appropriate GVN flags for a given load or store instruction |
| 3990 if (is_store) { | 3997 if (is_store) { |
| 3991 // track dominating allocations in order to eliminate write barriers | 3998 // track dominating allocations in order to eliminate write barriers |
| 3992 instr->SetGVNFlag(kDependsOnNewSpacePromotion); | 3999 instr->SetGVNFlag(kDependsOnNewSpacePromotion); |
| 3993 instr->SetFlag(HValue::kTrackSideEffectDominators); | 4000 instr->SetFlag(HValue::kTrackSideEffectDominators); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4047 case kBackingStore: | 4054 case kBackingStore: |
| 4048 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 4055 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); |
| 4049 stream->Add("[backing-store]"); | 4056 stream->Add("[backing-store]"); |
| 4050 break; | 4057 break; |
| 4051 } | 4058 } |
| 4052 | 4059 |
| 4053 stream->Add("@%d", offset()); | 4060 stream->Add("@%d", offset()); |
| 4054 } | 4061 } |
| 4055 | 4062 |
| 4056 } } // namespace v8::internal | 4063 } } // namespace v8::internal |
| OLD | NEW |