OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
11 #include "src/bootstrapper.h" | 11 #include "src/bootstrapper.h" |
12 #include "src/codegen.h" | 12 #include "src/codegen.h" |
13 #include "src/code-stubs.h" | 13 #include "src/code-stubs.h" |
14 #include "src/cpu-profiler.h" | 14 #include "src/cpu-profiler.h" |
15 #include "src/debug.h" | 15 #include "src/debug.h" |
16 #include "src/deoptimizer.h" | 16 #include "src/deoptimizer.h" |
17 #include "src/date.h" | 17 #include "src/date.h" |
18 #include "src/elements.h" | 18 #include "src/elements.h" |
19 #include "src/execution.h" | 19 #include "src/execution.h" |
20 #include "src/field-index.h" | |
21 #include "src/field-index-inl.h" | |
22 #include "src/full-codegen.h" | 20 #include "src/full-codegen.h" |
23 #include "src/hydrogen.h" | 21 #include "src/hydrogen.h" |
24 #include "src/isolate-inl.h" | 22 #include "src/isolate-inl.h" |
25 #include "src/log.h" | 23 #include "src/log.h" |
26 #include "src/objects-inl.h" | 24 #include "src/objects-inl.h" |
27 #include "src/objects-visiting-inl.h" | 25 #include "src/objects-visiting-inl.h" |
28 #include "src/macro-assembler.h" | 26 #include "src/macro-assembler.h" |
29 #include "src/mark-compact.h" | 27 #include "src/mark-compact.h" |
30 #include "src/safepoint-table.h" | 28 #include "src/safepoint-table.h" |
31 #include "src/string-search.h" | 29 #include "src/string-search.h" |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 | 840 |
843 Handle<Object> value; | 841 Handle<Object> value; |
844 switch (result->type()) { | 842 switch (result->type()) { |
845 case NORMAL: { | 843 case NORMAL: { |
846 value = JSObject::GetNormalizedProperty( | 844 value = JSObject::GetNormalizedProperty( |
847 handle(result->holder(), isolate), result); | 845 handle(result->holder(), isolate), result); |
848 break; | 846 break; |
849 } | 847 } |
850 case FIELD: | 848 case FIELD: |
851 value = JSObject::FastPropertyAt(handle(result->holder(), isolate), | 849 value = JSObject::FastPropertyAt(handle(result->holder(), isolate), |
852 result->representation(), FieldIndex::ForLookupResult(result)); | 850 result->representation(), |
| 851 result->GetFieldIndex().field_index()); |
853 break; | 852 break; |
854 case CONSTANT: | 853 case CONSTANT: |
855 return handle(result->GetConstant(), isolate); | 854 return handle(result->GetConstant(), isolate); |
856 case CALLBACKS: | 855 case CALLBACKS: |
857 return GetPropertyWithCallback( | 856 return GetPropertyWithCallback( |
858 receiver, name, handle(result->holder(), isolate), | 857 receiver, name, handle(result->holder(), isolate), |
859 handle(result->GetCallbackObject(), isolate)); | 858 handle(result->GetCallbackObject(), isolate)); |
860 case HANDLER: | 859 case HANDLER: |
861 return JSProxy::GetPropertyWithHandler( | 860 return JSProxy::GetPropertyWithHandler( |
862 handle(result->proxy(), isolate), receiver, name); | 861 handle(result->proxy(), isolate), receiver, name); |
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2274 if (details.type() != FIELD) continue; | 2273 if (details.type() != FIELD) continue; |
2275 PropertyDetails old_details = old_descriptors->GetDetails(i); | 2274 PropertyDetails old_details = old_descriptors->GetDetails(i); |
2276 if (old_details.type() == CALLBACKS) { | 2275 if (old_details.type() == CALLBACKS) { |
2277 ASSERT(details.representation().IsTagged()); | 2276 ASSERT(details.representation().IsTagged()); |
2278 continue; | 2277 continue; |
2279 } | 2278 } |
2280 ASSERT(old_details.type() == CONSTANT || | 2279 ASSERT(old_details.type() == CONSTANT || |
2281 old_details.type() == FIELD); | 2280 old_details.type() == FIELD); |
2282 Object* raw_value = old_details.type() == CONSTANT | 2281 Object* raw_value = old_details.type() == CONSTANT |
2283 ? old_descriptors->GetValue(i) | 2282 ? old_descriptors->GetValue(i) |
2284 : object->RawFastPropertyAt(FieldIndex::ForDescriptor(*old_map, i)); | 2283 : object->RawFastPropertyAt(old_descriptors->GetFieldIndex(i)); |
2285 Handle<Object> value(raw_value, isolate); | 2284 Handle<Object> value(raw_value, isolate); |
2286 if (!old_details.representation().IsDouble() && | 2285 if (!old_details.representation().IsDouble() && |
2287 details.representation().IsDouble()) { | 2286 details.representation().IsDouble()) { |
2288 if (old_details.representation().IsNone()) { | 2287 if (old_details.representation().IsNone()) { |
2289 value = handle(Smi::FromInt(0), isolate); | 2288 value = handle(Smi::FromInt(0), isolate); |
2290 } | 2289 } |
2291 value = Object::NewStorageFor(isolate, value, details.representation()); | 2290 value = Object::NewStorageFor(isolate, value, details.representation()); |
2292 } | 2291 } |
2293 ASSERT(!(details.representation().IsDouble() && value->IsSmi())); | 2292 ASSERT(!(details.representation().IsDouble() && value->IsSmi())); |
2294 int target_index = new_descriptors->GetFieldIndex(i) - inobject; | 2293 int target_index = new_descriptors->GetFieldIndex(i) - inobject; |
(...skipping 15 matching lines...) Expand all Loading... |
2310 array->set(target_index, *value); | 2309 array->set(target_index, *value); |
2311 } | 2310 } |
2312 | 2311 |
2313 // From here on we cannot fail and we shouldn't GC anymore. | 2312 // From here on we cannot fail and we shouldn't GC anymore. |
2314 DisallowHeapAllocation no_allocation; | 2313 DisallowHeapAllocation no_allocation; |
2315 | 2314 |
2316 // Copy (real) inobject properties. If necessary, stop at number_of_fields to | 2315 // Copy (real) inobject properties. If necessary, stop at number_of_fields to |
2317 // avoid overwriting |one_pointer_filler_map|. | 2316 // avoid overwriting |one_pointer_filler_map|. |
2318 int limit = Min(inobject, number_of_fields); | 2317 int limit = Min(inobject, number_of_fields); |
2319 for (int i = 0; i < limit; i++) { | 2318 for (int i = 0; i < limit; i++) { |
2320 FieldIndex index = FieldIndex::ForPropertyIndex(*new_map, i); | 2319 object->FastPropertyAtPut(i, array->get(external + i)); |
2321 object->FastPropertyAtPut(index, array->get(external + i)); | |
2322 } | 2320 } |
2323 | 2321 |
2324 // Create filler object past the new instance size. | 2322 // Create filler object past the new instance size. |
2325 int new_instance_size = new_map->instance_size(); | 2323 int new_instance_size = new_map->instance_size(); |
2326 int instance_size_delta = old_map->instance_size() - new_instance_size; | 2324 int instance_size_delta = old_map->instance_size() - new_instance_size; |
2327 ASSERT(instance_size_delta >= 0); | 2325 ASSERT(instance_size_delta >= 0); |
2328 Address address = object->address() + new_instance_size; | 2326 Address address = object->address() + new_instance_size; |
2329 | 2327 |
2330 // The trimming is performed on a newly allocated object, which is on a | 2328 // The trimming is performed on a newly allocated object, which is on a |
2331 // fresly allocated page or on an already swept page. Hence, the sweeper | 2329 // fresly allocated page or on an already swept page. Hence, the sweeper |
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3510 map()->LookupDescriptor(this, *name, result); | 3508 map()->LookupDescriptor(this, *name, result); |
3511 // A property or a map transition was found. We return all of these result | 3509 // A property or a map transition was found. We return all of these result |
3512 // types because LookupOwnRealNamedProperty is used when setting | 3510 // types because LookupOwnRealNamedProperty is used when setting |
3513 // properties where map transitions are handled. | 3511 // properties where map transitions are handled. |
3514 ASSERT(!result->IsFound() || | 3512 ASSERT(!result->IsFound() || |
3515 (result->holder() == this && result->IsFastPropertyType())); | 3513 (result->holder() == this && result->IsFastPropertyType())); |
3516 // Disallow caching for uninitialized constants. These can only | 3514 // Disallow caching for uninitialized constants. These can only |
3517 // occur as fields. | 3515 // occur as fields. |
3518 if (result->IsField() && | 3516 if (result->IsField() && |
3519 result->IsReadOnly() && | 3517 result->IsReadOnly() && |
3520 RawFastPropertyAt(result->GetFieldIndex())->IsTheHole()) { | 3518 RawFastPropertyAt(result->GetFieldIndex().field_index())->IsTheHole()) { |
3521 result->DisallowCaching(); | 3519 result->DisallowCaching(); |
3522 } | 3520 } |
3523 return; | 3521 return; |
3524 } | 3522 } |
3525 | 3523 |
3526 int entry = property_dictionary()->FindEntry(name); | 3524 int entry = property_dictionary()->FindEntry(name); |
3527 if (entry != NameDictionary::kNotFound) { | 3525 if (entry != NameDictionary::kNotFound) { |
3528 Object* value = property_dictionary()->ValueAt(entry); | 3526 Object* value = property_dictionary()->ValueAt(entry); |
3529 if (IsGlobalObject()) { | 3527 if (IsGlobalObject()) { |
3530 PropertyDetails d = property_dictionary()->DetailsAt(entry); | 3528 PropertyDetails d = property_dictionary()->DetailsAt(entry); |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4026 | 4024 |
4027 | 4025 |
4028 void JSObject::WriteToField(int descriptor, Object* value) { | 4026 void JSObject::WriteToField(int descriptor, Object* value) { |
4029 DisallowHeapAllocation no_gc; | 4027 DisallowHeapAllocation no_gc; |
4030 | 4028 |
4031 DescriptorArray* desc = map()->instance_descriptors(); | 4029 DescriptorArray* desc = map()->instance_descriptors(); |
4032 PropertyDetails details = desc->GetDetails(descriptor); | 4030 PropertyDetails details = desc->GetDetails(descriptor); |
4033 | 4031 |
4034 ASSERT(details.type() == FIELD); | 4032 ASSERT(details.type() == FIELD); |
4035 | 4033 |
4036 FieldIndex index = FieldIndex::ForDescriptor(map(), descriptor); | 4034 int field_index = desc->GetFieldIndex(descriptor); |
4037 if (details.representation().IsDouble()) { | 4035 if (details.representation().IsDouble()) { |
4038 // Nothing more to be done. | 4036 // Nothing more to be done. |
4039 if (value->IsUninitialized()) return; | 4037 if (value->IsUninitialized()) return; |
4040 HeapNumber* box = HeapNumber::cast(RawFastPropertyAt(index)); | 4038 HeapNumber* box = HeapNumber::cast(RawFastPropertyAt(field_index)); |
4041 box->set_value(value->Number()); | 4039 box->set_value(value->Number()); |
4042 } else { | 4040 } else { |
4043 FastPropertyAtPut(index, value); | 4041 FastPropertyAtPut(field_index, value); |
4044 } | 4042 } |
4045 } | 4043 } |
4046 | 4044 |
4047 | 4045 |
4048 static void SetPropertyToField(LookupResult* lookup, | 4046 static void SetPropertyToField(LookupResult* lookup, |
4049 Handle<Object> value) { | 4047 Handle<Object> value) { |
4050 if (lookup->type() == CONSTANT || !lookup->CanHoldValue(value)) { | 4048 if (lookup->type() == CONSTANT || !lookup->CanHoldValue(value)) { |
4051 Representation field_representation = value->OptimalRepresentation(); | 4049 Representation field_representation = value->OptimalRepresentation(); |
4052 Handle<HeapType> field_type = value->OptimalType( | 4050 Handle<HeapType> field_type = value->OptimalType( |
4053 lookup->isolate(), field_representation); | 4051 lookup->isolate(), field_representation); |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4722 case CONSTANT: { | 4720 case CONSTANT: { |
4723 Handle<Name> key(descs->GetKey(i)); | 4721 Handle<Name> key(descs->GetKey(i)); |
4724 Handle<Object> value(descs->GetConstant(i), isolate); | 4722 Handle<Object> value(descs->GetConstant(i), isolate); |
4725 PropertyDetails d = PropertyDetails( | 4723 PropertyDetails d = PropertyDetails( |
4726 details.attributes(), NORMAL, i + 1); | 4724 details.attributes(), NORMAL, i + 1); |
4727 dictionary = NameDictionary::Add(dictionary, key, value, d); | 4725 dictionary = NameDictionary::Add(dictionary, key, value, d); |
4728 break; | 4726 break; |
4729 } | 4727 } |
4730 case FIELD: { | 4728 case FIELD: { |
4731 Handle<Name> key(descs->GetKey(i)); | 4729 Handle<Name> key(descs->GetKey(i)); |
4732 FieldIndex index = FieldIndex::ForDescriptor(*map, i); | |
4733 Handle<Object> value( | 4730 Handle<Object> value( |
4734 object->RawFastPropertyAt(index), isolate); | 4731 object->RawFastPropertyAt(descs->GetFieldIndex(i)), isolate); |
4735 PropertyDetails d = | 4732 PropertyDetails d = |
4736 PropertyDetails(details.attributes(), NORMAL, i + 1); | 4733 PropertyDetails(details.attributes(), NORMAL, i + 1); |
4737 dictionary = NameDictionary::Add(dictionary, key, value, d); | 4734 dictionary = NameDictionary::Add(dictionary, key, value, d); |
4738 break; | 4735 break; |
4739 } | 4736 } |
4740 case CALLBACKS: { | 4737 case CALLBACKS: { |
4741 Handle<Name> key(descs->GetKey(i)); | 4738 Handle<Name> key(descs->GetKey(i)); |
4742 Handle<Object> value(descs->GetCallbacksObject(i), isolate); | 4739 Handle<Object> value(descs->GetCallbacksObject(i), isolate); |
4743 PropertyDetails d = PropertyDetails( | 4740 PropertyDetails d = PropertyDetails( |
4744 details.attributes(), CALLBACKS, i + 1); | 4741 details.attributes(), CALLBACKS, i + 1); |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5231 // hidden strings hash code is zero (and no other name has hash | 5228 // hidden strings hash code is zero (and no other name has hash |
5232 // code zero) it will always occupy the first entry if present. | 5229 // code zero) it will always occupy the first entry if present. |
5233 DescriptorArray* descriptors = this->map()->instance_descriptors(); | 5230 DescriptorArray* descriptors = this->map()->instance_descriptors(); |
5234 if (descriptors->number_of_descriptors() > 0) { | 5231 if (descriptors->number_of_descriptors() > 0) { |
5235 int sorted_index = descriptors->GetSortedKeyIndex(0); | 5232 int sorted_index = descriptors->GetSortedKeyIndex(0); |
5236 if (descriptors->GetKey(sorted_index) == GetHeap()->hidden_string() && | 5233 if (descriptors->GetKey(sorted_index) == GetHeap()->hidden_string() && |
5237 sorted_index < map()->NumberOfOwnDescriptors()) { | 5234 sorted_index < map()->NumberOfOwnDescriptors()) { |
5238 ASSERT(descriptors->GetType(sorted_index) == FIELD); | 5235 ASSERT(descriptors->GetType(sorted_index) == FIELD); |
5239 ASSERT(descriptors->GetDetails(sorted_index).representation(). | 5236 ASSERT(descriptors->GetDetails(sorted_index).representation(). |
5240 IsCompatibleForLoad(Representation::Tagged())); | 5237 IsCompatibleForLoad(Representation::Tagged())); |
5241 FieldIndex index = FieldIndex::ForDescriptor(this->map(), | 5238 return this->RawFastPropertyAt( |
5242 sorted_index); | 5239 descriptors->GetFieldIndex(sorted_index)); |
5243 return this->RawFastPropertyAt(index); | |
5244 } else { | 5240 } else { |
5245 return GetHeap()->undefined_value(); | 5241 return GetHeap()->undefined_value(); |
5246 } | 5242 } |
5247 } else { | 5243 } else { |
5248 return GetHeap()->undefined_value(); | 5244 return GetHeap()->undefined_value(); |
5249 } | 5245 } |
5250 } else { | 5246 } else { |
5251 Isolate* isolate = GetIsolate(); | 5247 Isolate* isolate = GetIsolate(); |
5252 LookupResult result(isolate); | 5248 LookupResult result(isolate); |
5253 LookupOwnRealNamedProperty(isolate->factory()->hidden_string(), &result); | 5249 LookupOwnRealNamedProperty(isolate->factory()->hidden_string(), &result); |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5913 } else { | 5909 } else { |
5914 new_map = Map::Copy(old_map); | 5910 new_map = Map::Copy(old_map); |
5915 new_map->set_is_observed(); | 5911 new_map->set_is_observed(); |
5916 } | 5912 } |
5917 JSObject::MigrateToMap(object, new_map); | 5913 JSObject::MigrateToMap(object, new_map); |
5918 } | 5914 } |
5919 | 5915 |
5920 | 5916 |
5921 Handle<Object> JSObject::FastPropertyAt(Handle<JSObject> object, | 5917 Handle<Object> JSObject::FastPropertyAt(Handle<JSObject> object, |
5922 Representation representation, | 5918 Representation representation, |
5923 FieldIndex index) { | 5919 int index) { |
5924 Isolate* isolate = object->GetIsolate(); | 5920 Isolate* isolate = object->GetIsolate(); |
5925 Handle<Object> raw_value(object->RawFastPropertyAt(index), isolate); | 5921 Handle<Object> raw_value(object->RawFastPropertyAt(index), isolate); |
5926 return Object::NewStorageFor(isolate, raw_value, representation); | 5922 return Object::NewStorageFor(isolate, raw_value, representation); |
5927 } | 5923 } |
5928 | 5924 |
5929 | 5925 |
5930 template<class ContextObject> | 5926 template<class ContextObject> |
5931 class JSObjectWalkVisitor { | 5927 class JSObjectWalkVisitor { |
5932 public: | 5928 public: |
5933 JSObjectWalkVisitor(ContextObject* site_context, bool copying, | 5929 JSObjectWalkVisitor(ContextObject* site_context, bool copying, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6004 if (!shallow) { | 6000 if (!shallow) { |
6005 HandleScope scope(isolate); | 6001 HandleScope scope(isolate); |
6006 | 6002 |
6007 // Deep copy own properties. | 6003 // Deep copy own properties. |
6008 if (copy->HasFastProperties()) { | 6004 if (copy->HasFastProperties()) { |
6009 Handle<DescriptorArray> descriptors(copy->map()->instance_descriptors()); | 6005 Handle<DescriptorArray> descriptors(copy->map()->instance_descriptors()); |
6010 int limit = copy->map()->NumberOfOwnDescriptors(); | 6006 int limit = copy->map()->NumberOfOwnDescriptors(); |
6011 for (int i = 0; i < limit; i++) { | 6007 for (int i = 0; i < limit; i++) { |
6012 PropertyDetails details = descriptors->GetDetails(i); | 6008 PropertyDetails details = descriptors->GetDetails(i); |
6013 if (details.type() != FIELD) continue; | 6009 if (details.type() != FIELD) continue; |
6014 FieldIndex index = FieldIndex::ForDescriptor(copy->map(), i); | 6010 int index = descriptors->GetFieldIndex(i); |
6015 Handle<Object> value(object->RawFastPropertyAt(index), isolate); | 6011 Handle<Object> value(object->RawFastPropertyAt(index), isolate); |
6016 if (value->IsJSObject()) { | 6012 if (value->IsJSObject()) { |
6017 ASSIGN_RETURN_ON_EXCEPTION( | 6013 ASSIGN_RETURN_ON_EXCEPTION( |
6018 isolate, value, | 6014 isolate, value, |
6019 VisitElementOrProperty(copy, Handle<JSObject>::cast(value)), | 6015 VisitElementOrProperty(copy, Handle<JSObject>::cast(value)), |
6020 JSObject); | 6016 JSObject); |
6021 } else { | 6017 } else { |
6022 Representation representation = details.representation(); | 6018 Representation representation = details.representation(); |
6023 value = Object::NewStorageFor(isolate, value, representation); | 6019 value = Object::NewStorageFor(isolate, value, representation); |
6024 } | 6020 } |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6171 Handle<Object> result = isolate->factory()->undefined_value(); | 6167 Handle<Object> result = isolate->factory()->undefined_value(); |
6172 if (lookup.IsFound() && !lookup.IsTransition()) { | 6168 if (lookup.IsFound() && !lookup.IsTransition()) { |
6173 switch (lookup.type()) { | 6169 switch (lookup.type()) { |
6174 case NORMAL: | 6170 case NORMAL: |
6175 result = GetNormalizedProperty( | 6171 result = GetNormalizedProperty( |
6176 Handle<JSObject>(lookup.holder(), isolate), &lookup); | 6172 Handle<JSObject>(lookup.holder(), isolate), &lookup); |
6177 break; | 6173 break; |
6178 case FIELD: | 6174 case FIELD: |
6179 result = FastPropertyAt(Handle<JSObject>(lookup.holder(), isolate), | 6175 result = FastPropertyAt(Handle<JSObject>(lookup.holder(), isolate), |
6180 lookup.representation(), | 6176 lookup.representation(), |
6181 lookup.GetFieldIndex()); | 6177 lookup.GetFieldIndex().field_index()); |
6182 break; | 6178 break; |
6183 case CONSTANT: | 6179 case CONSTANT: |
6184 result = Handle<Object>(lookup.GetConstant(), isolate); | 6180 result = Handle<Object>(lookup.GetConstant(), isolate); |
6185 break; | 6181 break; |
6186 case CALLBACKS: | 6182 case CALLBACKS: |
6187 case HANDLER: | 6183 case HANDLER: |
6188 case INTERCEPTOR: | 6184 case INTERCEPTOR: |
6189 break; | 6185 break; |
6190 case NONEXISTENT: | 6186 case NONEXISTENT: |
6191 UNREACHABLE(); | 6187 UNREACHABLE(); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6405 | 6401 |
6406 for (int i = 0; i < size; i++) { | 6402 for (int i = 0; i < size; i++) { |
6407 PropertyDetails details = descs->GetDetails(i); | 6403 PropertyDetails details = descs->GetDetails(i); |
6408 Object* key = descs->GetKey(i); | 6404 Object* key = descs->GetKey(i); |
6409 if (!(details.IsDontEnum() || key->IsSymbol())) { | 6405 if (!(details.IsDontEnum() || key->IsSymbol())) { |
6410 storage->set(index, key); | 6406 storage->set(index, key); |
6411 if (!indices.is_null()) { | 6407 if (!indices.is_null()) { |
6412 if (details.type() != FIELD) { | 6408 if (details.type() != FIELD) { |
6413 indices = Handle<FixedArray>(); | 6409 indices = Handle<FixedArray>(); |
6414 } else { | 6410 } else { |
6415 FieldIndex field_index = FieldIndex::ForDescriptor(*map, i); | 6411 int field_index = descs->GetFieldIndex(i); |
6416 int load_by_field_index = field_index.GetLoadByFieldIndex(); | 6412 if (field_index >= map->inobject_properties()) { |
6417 indices->set(index, Smi::FromInt(load_by_field_index)); | 6413 field_index = -(field_index - map->inobject_properties() + 1); |
| 6414 } |
| 6415 field_index = field_index << 1; |
| 6416 if (details.representation().IsDouble()) { |
| 6417 field_index |= 1; |
| 6418 } |
| 6419 indices->set(index, Smi::FromInt(field_index)); |
6418 } | 6420 } |
6419 } | 6421 } |
6420 index++; | 6422 index++; |
6421 } | 6423 } |
6422 } | 6424 } |
6423 ASSERT(index == storage->length()); | 6425 ASSERT(index == storage->length()); |
6424 | 6426 |
6425 Handle<FixedArray> bridge_storage = | 6427 Handle<FixedArray> bridge_storage = |
6426 isolate->factory()->NewFixedArray( | 6428 isolate->factory()->NewFixedArray( |
6427 DescriptorArray::kEnumCacheBridgeLength); | 6429 DescriptorArray::kEnumCacheBridgeLength); |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7111 return isolate->factory()->undefined_value(); | 7113 return isolate->factory()->undefined_value(); |
7112 } | 7114 } |
7113 | 7115 |
7114 | 7116 |
7115 Object* JSObject::SlowReverseLookup(Object* value) { | 7117 Object* JSObject::SlowReverseLookup(Object* value) { |
7116 if (HasFastProperties()) { | 7118 if (HasFastProperties()) { |
7117 int number_of_own_descriptors = map()->NumberOfOwnDescriptors(); | 7119 int number_of_own_descriptors = map()->NumberOfOwnDescriptors(); |
7118 DescriptorArray* descs = map()->instance_descriptors(); | 7120 DescriptorArray* descs = map()->instance_descriptors(); |
7119 for (int i = 0; i < number_of_own_descriptors; i++) { | 7121 for (int i = 0; i < number_of_own_descriptors; i++) { |
7120 if (descs->GetType(i) == FIELD) { | 7122 if (descs->GetType(i) == FIELD) { |
7121 Object* property = | 7123 Object* property = RawFastPropertyAt(descs->GetFieldIndex(i)); |
7122 RawFastPropertyAt(FieldIndex::ForDescriptor(map(), i)); | |
7123 if (descs->GetDetails(i).representation().IsDouble()) { | 7124 if (descs->GetDetails(i).representation().IsDouble()) { |
7124 ASSERT(property->IsHeapNumber()); | 7125 ASSERT(property->IsHeapNumber()); |
7125 if (value->IsNumber() && property->Number() == value->Number()) { | 7126 if (value->IsNumber() && property->Number() == value->Number()) { |
7126 return descs->GetKey(i); | 7127 return descs->GetKey(i); |
7127 } | 7128 } |
7128 } else if (property == value) { | 7129 } else if (property == value) { |
7129 return descs->GetKey(i); | 7130 return descs->GetKey(i); |
7130 } | 7131 } |
7131 } else if (descs->GetType(i) == CONSTANT) { | 7132 } else if (descs->GetType(i) == CONSTANT) { |
7132 if (descs->GetConstant(i) == value) { | 7133 if (descs->GetConstant(i) == value) { |
(...skipping 10056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17189 #define ERROR_MESSAGES_TEXTS(C, T) T, | 17190 #define ERROR_MESSAGES_TEXTS(C, T) T, |
17190 static const char* error_messages_[] = { | 17191 static const char* error_messages_[] = { |
17191 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 17192 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
17192 }; | 17193 }; |
17193 #undef ERROR_MESSAGES_TEXTS | 17194 #undef ERROR_MESSAGES_TEXTS |
17194 return error_messages_[reason]; | 17195 return error_messages_[reason]; |
17195 } | 17196 } |
17196 | 17197 |
17197 | 17198 |
17198 } } // namespace v8::internal | 17199 } } // namespace v8::internal |
OLD | NEW |