| 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" |
| 20 #include "src/full-codegen.h" | 22 #include "src/full-codegen.h" |
| 21 #include "src/hydrogen.h" | 23 #include "src/hydrogen.h" |
| 22 #include "src/isolate-inl.h" | 24 #include "src/isolate-inl.h" |
| 23 #include "src/log.h" | 25 #include "src/log.h" |
| 24 #include "src/objects-inl.h" | 26 #include "src/objects-inl.h" |
| 25 #include "src/objects-visiting-inl.h" | 27 #include "src/objects-visiting-inl.h" |
| 26 #include "src/macro-assembler.h" | 28 #include "src/macro-assembler.h" |
| 27 #include "src/mark-compact.h" | 29 #include "src/mark-compact.h" |
| 28 #include "src/safepoint-table.h" | 30 #include "src/safepoint-table.h" |
| 29 #include "src/string-search.h" | 31 #include "src/string-search.h" |
| (...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 | 842 |
| 841 Handle<Object> value; | 843 Handle<Object> value; |
| 842 switch (result->type()) { | 844 switch (result->type()) { |
| 843 case NORMAL: { | 845 case NORMAL: { |
| 844 value = JSObject::GetNormalizedProperty( | 846 value = JSObject::GetNormalizedProperty( |
| 845 handle(result->holder(), isolate), result); | 847 handle(result->holder(), isolate), result); |
| 846 break; | 848 break; |
| 847 } | 849 } |
| 848 case FIELD: | 850 case FIELD: |
| 849 value = JSObject::FastPropertyAt(handle(result->holder(), isolate), | 851 value = JSObject::FastPropertyAt(handle(result->holder(), isolate), |
| 850 result->representation(), | 852 result->representation(), FieldIndex::ForLookupResult(result)); |
| 851 result->GetFieldIndex().field_index()); | |
| 852 break; | 853 break; |
| 853 case CONSTANT: | 854 case CONSTANT: |
| 854 return handle(result->GetConstant(), isolate); | 855 return handle(result->GetConstant(), isolate); |
| 855 case CALLBACKS: | 856 case CALLBACKS: |
| 856 return GetPropertyWithCallback( | 857 return GetPropertyWithCallback( |
| 857 receiver, name, handle(result->holder(), isolate), | 858 receiver, name, handle(result->holder(), isolate), |
| 858 handle(result->GetCallbackObject(), isolate)); | 859 handle(result->GetCallbackObject(), isolate)); |
| 859 case HANDLER: | 860 case HANDLER: |
| 860 return JSProxy::GetPropertyWithHandler( | 861 return JSProxy::GetPropertyWithHandler( |
| 861 handle(result->proxy(), isolate), receiver, name); | 862 handle(result->proxy(), isolate), receiver, name); |
| (...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2279 if (details.type() != FIELD) continue; | 2280 if (details.type() != FIELD) continue; |
| 2280 PropertyDetails old_details = old_descriptors->GetDetails(i); | 2281 PropertyDetails old_details = old_descriptors->GetDetails(i); |
| 2281 if (old_details.type() == CALLBACKS) { | 2282 if (old_details.type() == CALLBACKS) { |
| 2282 ASSERT(details.representation().IsTagged()); | 2283 ASSERT(details.representation().IsTagged()); |
| 2283 continue; | 2284 continue; |
| 2284 } | 2285 } |
| 2285 ASSERT(old_details.type() == CONSTANT || | 2286 ASSERT(old_details.type() == CONSTANT || |
| 2286 old_details.type() == FIELD); | 2287 old_details.type() == FIELD); |
| 2287 Object* raw_value = old_details.type() == CONSTANT | 2288 Object* raw_value = old_details.type() == CONSTANT |
| 2288 ? old_descriptors->GetValue(i) | 2289 ? old_descriptors->GetValue(i) |
| 2289 : object->RawFastPropertyAt(old_descriptors->GetFieldIndex(i)); | 2290 : object->RawFastPropertyAt(FieldIndex::ForDescriptor(*old_map, i)); |
| 2290 Handle<Object> value(raw_value, isolate); | 2291 Handle<Object> value(raw_value, isolate); |
| 2291 if (!old_details.representation().IsDouble() && | 2292 if (!old_details.representation().IsDouble() && |
| 2292 details.representation().IsDouble()) { | 2293 details.representation().IsDouble()) { |
| 2293 if (old_details.representation().IsNone()) { | 2294 if (old_details.representation().IsNone()) { |
| 2294 value = handle(Smi::FromInt(0), isolate); | 2295 value = handle(Smi::FromInt(0), isolate); |
| 2295 } | 2296 } |
| 2296 value = Object::NewStorageFor(isolate, value, details.representation()); | 2297 value = Object::NewStorageFor(isolate, value, details.representation()); |
| 2297 } | 2298 } |
| 2298 ASSERT(!(details.representation().IsDouble() && value->IsSmi())); | 2299 ASSERT(!(details.representation().IsDouble() && value->IsSmi())); |
| 2299 int target_index = new_descriptors->GetFieldIndex(i) - inobject; | 2300 int target_index = new_descriptors->GetFieldIndex(i) - inobject; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2315 array->set(target_index, *value); | 2316 array->set(target_index, *value); |
| 2316 } | 2317 } |
| 2317 | 2318 |
| 2318 // From here on we cannot fail and we shouldn't GC anymore. | 2319 // From here on we cannot fail and we shouldn't GC anymore. |
| 2319 DisallowHeapAllocation no_allocation; | 2320 DisallowHeapAllocation no_allocation; |
| 2320 | 2321 |
| 2321 // Copy (real) inobject properties. If necessary, stop at number_of_fields to | 2322 // Copy (real) inobject properties. If necessary, stop at number_of_fields to |
| 2322 // avoid overwriting |one_pointer_filler_map|. | 2323 // avoid overwriting |one_pointer_filler_map|. |
| 2323 int limit = Min(inobject, number_of_fields); | 2324 int limit = Min(inobject, number_of_fields); |
| 2324 for (int i = 0; i < limit; i++) { | 2325 for (int i = 0; i < limit; i++) { |
| 2325 object->FastPropertyAtPut(i, array->get(external + i)); | 2326 FieldIndex index = FieldIndex::ForPropertyIndex(*new_map, i); |
| 2327 object->FastPropertyAtPut(index, array->get(external + i)); |
| 2326 } | 2328 } |
| 2327 | 2329 |
| 2328 // Create filler object past the new instance size. | 2330 // Create filler object past the new instance size. |
| 2329 int new_instance_size = new_map->instance_size(); | 2331 int new_instance_size = new_map->instance_size(); |
| 2330 int instance_size_delta = old_map->instance_size() - new_instance_size; | 2332 int instance_size_delta = old_map->instance_size() - new_instance_size; |
| 2331 ASSERT(instance_size_delta >= 0); | 2333 ASSERT(instance_size_delta >= 0); |
| 2332 Address address = object->address() + new_instance_size; | 2334 Address address = object->address() + new_instance_size; |
| 2333 | 2335 |
| 2334 // The trimming is performed on a newly allocated object, which is on a | 2336 // The trimming is performed on a newly allocated object, which is on a |
| 2335 // fresly allocated page or on an already swept page. Hence, the sweeper | 2337 // 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... |
| 3514 map()->LookupDescriptor(this, *name, result); | 3516 map()->LookupDescriptor(this, *name, result); |
| 3515 // A property or a map transition was found. We return all of these result | 3517 // A property or a map transition was found. We return all of these result |
| 3516 // types because LookupOwnRealNamedProperty is used when setting | 3518 // types because LookupOwnRealNamedProperty is used when setting |
| 3517 // properties where map transitions are handled. | 3519 // properties where map transitions are handled. |
| 3518 ASSERT(!result->IsFound() || | 3520 ASSERT(!result->IsFound() || |
| 3519 (result->holder() == this && result->IsFastPropertyType())); | 3521 (result->holder() == this && result->IsFastPropertyType())); |
| 3520 // Disallow caching for uninitialized constants. These can only | 3522 // Disallow caching for uninitialized constants. These can only |
| 3521 // occur as fields. | 3523 // occur as fields. |
| 3522 if (result->IsField() && | 3524 if (result->IsField() && |
| 3523 result->IsReadOnly() && | 3525 result->IsReadOnly() && |
| 3524 RawFastPropertyAt(result->GetFieldIndex().field_index())->IsTheHole()) { | 3526 RawFastPropertyAt(result->GetFieldIndex())->IsTheHole()) { |
| 3525 result->DisallowCaching(); | 3527 result->DisallowCaching(); |
| 3526 } | 3528 } |
| 3527 return; | 3529 return; |
| 3528 } | 3530 } |
| 3529 | 3531 |
| 3530 int entry = property_dictionary()->FindEntry(name); | 3532 int entry = property_dictionary()->FindEntry(name); |
| 3531 if (entry != NameDictionary::kNotFound) { | 3533 if (entry != NameDictionary::kNotFound) { |
| 3532 Object* value = property_dictionary()->ValueAt(entry); | 3534 Object* value = property_dictionary()->ValueAt(entry); |
| 3533 if (IsGlobalObject()) { | 3535 if (IsGlobalObject()) { |
| 3534 PropertyDetails d = property_dictionary()->DetailsAt(entry); | 3536 PropertyDetails d = property_dictionary()->DetailsAt(entry); |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4030 | 4032 |
| 4031 | 4033 |
| 4032 void JSObject::WriteToField(int descriptor, Object* value) { | 4034 void JSObject::WriteToField(int descriptor, Object* value) { |
| 4033 DisallowHeapAllocation no_gc; | 4035 DisallowHeapAllocation no_gc; |
| 4034 | 4036 |
| 4035 DescriptorArray* desc = map()->instance_descriptors(); | 4037 DescriptorArray* desc = map()->instance_descriptors(); |
| 4036 PropertyDetails details = desc->GetDetails(descriptor); | 4038 PropertyDetails details = desc->GetDetails(descriptor); |
| 4037 | 4039 |
| 4038 ASSERT(details.type() == FIELD); | 4040 ASSERT(details.type() == FIELD); |
| 4039 | 4041 |
| 4040 int field_index = desc->GetFieldIndex(descriptor); | 4042 FieldIndex index = FieldIndex::ForDescriptor(map(), descriptor); |
| 4041 if (details.representation().IsDouble()) { | 4043 if (details.representation().IsDouble()) { |
| 4042 // Nothing more to be done. | 4044 // Nothing more to be done. |
| 4043 if (value->IsUninitialized()) return; | 4045 if (value->IsUninitialized()) return; |
| 4044 HeapNumber* box = HeapNumber::cast(RawFastPropertyAt(field_index)); | 4046 HeapNumber* box = HeapNumber::cast(RawFastPropertyAt(index)); |
| 4045 box->set_value(value->Number()); | 4047 box->set_value(value->Number()); |
| 4046 } else { | 4048 } else { |
| 4047 FastPropertyAtPut(field_index, value); | 4049 FastPropertyAtPut(index, value); |
| 4048 } | 4050 } |
| 4049 } | 4051 } |
| 4050 | 4052 |
| 4051 | 4053 |
| 4052 static void SetPropertyToField(LookupResult* lookup, | 4054 static void SetPropertyToField(LookupResult* lookup, |
| 4053 Handle<Object> value) { | 4055 Handle<Object> value) { |
| 4054 if (lookup->type() == CONSTANT || !lookup->CanHoldValue(value)) { | 4056 if (lookup->type() == CONSTANT || !lookup->CanHoldValue(value)) { |
| 4055 Representation field_representation = value->OptimalRepresentation(); | 4057 Representation field_representation = value->OptimalRepresentation(); |
| 4056 Handle<HeapType> field_type = value->OptimalType( | 4058 Handle<HeapType> field_type = value->OptimalType( |
| 4057 lookup->isolate(), field_representation); | 4059 lookup->isolate(), field_representation); |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4726 case CONSTANT: { | 4728 case CONSTANT: { |
| 4727 Handle<Name> key(descs->GetKey(i)); | 4729 Handle<Name> key(descs->GetKey(i)); |
| 4728 Handle<Object> value(descs->GetConstant(i), isolate); | 4730 Handle<Object> value(descs->GetConstant(i), isolate); |
| 4729 PropertyDetails d = PropertyDetails( | 4731 PropertyDetails d = PropertyDetails( |
| 4730 details.attributes(), NORMAL, i + 1); | 4732 details.attributes(), NORMAL, i + 1); |
| 4731 dictionary = NameDictionary::Add(dictionary, key, value, d); | 4733 dictionary = NameDictionary::Add(dictionary, key, value, d); |
| 4732 break; | 4734 break; |
| 4733 } | 4735 } |
| 4734 case FIELD: { | 4736 case FIELD: { |
| 4735 Handle<Name> key(descs->GetKey(i)); | 4737 Handle<Name> key(descs->GetKey(i)); |
| 4738 FieldIndex index = FieldIndex::ForDescriptor(*map, i); |
| 4736 Handle<Object> value( | 4739 Handle<Object> value( |
| 4737 object->RawFastPropertyAt(descs->GetFieldIndex(i)), isolate); | 4740 object->RawFastPropertyAt(index), isolate); |
| 4738 PropertyDetails d = | 4741 PropertyDetails d = |
| 4739 PropertyDetails(details.attributes(), NORMAL, i + 1); | 4742 PropertyDetails(details.attributes(), NORMAL, i + 1); |
| 4740 dictionary = NameDictionary::Add(dictionary, key, value, d); | 4743 dictionary = NameDictionary::Add(dictionary, key, value, d); |
| 4741 break; | 4744 break; |
| 4742 } | 4745 } |
| 4743 case CALLBACKS: { | 4746 case CALLBACKS: { |
| 4744 Handle<Name> key(descs->GetKey(i)); | 4747 Handle<Name> key(descs->GetKey(i)); |
| 4745 Handle<Object> value(descs->GetCallbacksObject(i), isolate); | 4748 Handle<Object> value(descs->GetCallbacksObject(i), isolate); |
| 4746 PropertyDetails d = PropertyDetails( | 4749 PropertyDetails d = PropertyDetails( |
| 4747 details.attributes(), CALLBACKS, i + 1); | 4750 details.attributes(), CALLBACKS, i + 1); |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5234 // hidden strings hash code is zero (and no other name has hash | 5237 // hidden strings hash code is zero (and no other name has hash |
| 5235 // code zero) it will always occupy the first entry if present. | 5238 // code zero) it will always occupy the first entry if present. |
| 5236 DescriptorArray* descriptors = this->map()->instance_descriptors(); | 5239 DescriptorArray* descriptors = this->map()->instance_descriptors(); |
| 5237 if (descriptors->number_of_descriptors() > 0) { | 5240 if (descriptors->number_of_descriptors() > 0) { |
| 5238 int sorted_index = descriptors->GetSortedKeyIndex(0); | 5241 int sorted_index = descriptors->GetSortedKeyIndex(0); |
| 5239 if (descriptors->GetKey(sorted_index) == GetHeap()->hidden_string() && | 5242 if (descriptors->GetKey(sorted_index) == GetHeap()->hidden_string() && |
| 5240 sorted_index < map()->NumberOfOwnDescriptors()) { | 5243 sorted_index < map()->NumberOfOwnDescriptors()) { |
| 5241 ASSERT(descriptors->GetType(sorted_index) == FIELD); | 5244 ASSERT(descriptors->GetType(sorted_index) == FIELD); |
| 5242 ASSERT(descriptors->GetDetails(sorted_index).representation(). | 5245 ASSERT(descriptors->GetDetails(sorted_index).representation(). |
| 5243 IsCompatibleForLoad(Representation::Tagged())); | 5246 IsCompatibleForLoad(Representation::Tagged())); |
| 5244 return this->RawFastPropertyAt( | 5247 FieldIndex index = FieldIndex::ForDescriptor(this->map(), |
| 5245 descriptors->GetFieldIndex(sorted_index)); | 5248 sorted_index); |
| 5249 return this->RawFastPropertyAt(index); |
| 5246 } else { | 5250 } else { |
| 5247 return GetHeap()->undefined_value(); | 5251 return GetHeap()->undefined_value(); |
| 5248 } | 5252 } |
| 5249 } else { | 5253 } else { |
| 5250 return GetHeap()->undefined_value(); | 5254 return GetHeap()->undefined_value(); |
| 5251 } | 5255 } |
| 5252 } else { | 5256 } else { |
| 5253 Isolate* isolate = GetIsolate(); | 5257 Isolate* isolate = GetIsolate(); |
| 5254 LookupResult result(isolate); | 5258 LookupResult result(isolate); |
| 5255 LookupOwnRealNamedProperty(isolate->factory()->hidden_string(), &result); | 5259 LookupOwnRealNamedProperty(isolate->factory()->hidden_string(), &result); |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5915 } else { | 5919 } else { |
| 5916 new_map = Map::Copy(old_map); | 5920 new_map = Map::Copy(old_map); |
| 5917 new_map->set_is_observed(); | 5921 new_map->set_is_observed(); |
| 5918 } | 5922 } |
| 5919 JSObject::MigrateToMap(object, new_map); | 5923 JSObject::MigrateToMap(object, new_map); |
| 5920 } | 5924 } |
| 5921 | 5925 |
| 5922 | 5926 |
| 5923 Handle<Object> JSObject::FastPropertyAt(Handle<JSObject> object, | 5927 Handle<Object> JSObject::FastPropertyAt(Handle<JSObject> object, |
| 5924 Representation representation, | 5928 Representation representation, |
| 5925 int index) { | 5929 FieldIndex index) { |
| 5926 Isolate* isolate = object->GetIsolate(); | 5930 Isolate* isolate = object->GetIsolate(); |
| 5927 Handle<Object> raw_value(object->RawFastPropertyAt(index), isolate); | 5931 Handle<Object> raw_value(object->RawFastPropertyAt(index), isolate); |
| 5928 return Object::NewStorageFor(isolate, raw_value, representation); | 5932 return Object::NewStorageFor(isolate, raw_value, representation); |
| 5929 } | 5933 } |
| 5930 | 5934 |
| 5931 | 5935 |
| 5932 template<class ContextObject> | 5936 template<class ContextObject> |
| 5933 class JSObjectWalkVisitor { | 5937 class JSObjectWalkVisitor { |
| 5934 public: | 5938 public: |
| 5935 JSObjectWalkVisitor(ContextObject* site_context, bool copying, | 5939 JSObjectWalkVisitor(ContextObject* site_context, bool copying, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6006 if (!shallow) { | 6010 if (!shallow) { |
| 6007 HandleScope scope(isolate); | 6011 HandleScope scope(isolate); |
| 6008 | 6012 |
| 6009 // Deep copy own properties. | 6013 // Deep copy own properties. |
| 6010 if (copy->HasFastProperties()) { | 6014 if (copy->HasFastProperties()) { |
| 6011 Handle<DescriptorArray> descriptors(copy->map()->instance_descriptors()); | 6015 Handle<DescriptorArray> descriptors(copy->map()->instance_descriptors()); |
| 6012 int limit = copy->map()->NumberOfOwnDescriptors(); | 6016 int limit = copy->map()->NumberOfOwnDescriptors(); |
| 6013 for (int i = 0; i < limit; i++) { | 6017 for (int i = 0; i < limit; i++) { |
| 6014 PropertyDetails details = descriptors->GetDetails(i); | 6018 PropertyDetails details = descriptors->GetDetails(i); |
| 6015 if (details.type() != FIELD) continue; | 6019 if (details.type() != FIELD) continue; |
| 6016 int index = descriptors->GetFieldIndex(i); | 6020 FieldIndex index = FieldIndex::ForDescriptor(copy->map(), i); |
| 6017 Handle<Object> value(object->RawFastPropertyAt(index), isolate); | 6021 Handle<Object> value(object->RawFastPropertyAt(index), isolate); |
| 6018 if (value->IsJSObject()) { | 6022 if (value->IsJSObject()) { |
| 6019 ASSIGN_RETURN_ON_EXCEPTION( | 6023 ASSIGN_RETURN_ON_EXCEPTION( |
| 6020 isolate, value, | 6024 isolate, value, |
| 6021 VisitElementOrProperty(copy, Handle<JSObject>::cast(value)), | 6025 VisitElementOrProperty(copy, Handle<JSObject>::cast(value)), |
| 6022 JSObject); | 6026 JSObject); |
| 6023 } else { | 6027 } else { |
| 6024 Representation representation = details.representation(); | 6028 Representation representation = details.representation(); |
| 6025 value = Object::NewStorageFor(isolate, value, representation); | 6029 value = Object::NewStorageFor(isolate, value, representation); |
| 6026 } | 6030 } |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6173 Handle<Object> result = isolate->factory()->undefined_value(); | 6177 Handle<Object> result = isolate->factory()->undefined_value(); |
| 6174 if (lookup.IsFound() && !lookup.IsTransition()) { | 6178 if (lookup.IsFound() && !lookup.IsTransition()) { |
| 6175 switch (lookup.type()) { | 6179 switch (lookup.type()) { |
| 6176 case NORMAL: | 6180 case NORMAL: |
| 6177 result = GetNormalizedProperty( | 6181 result = GetNormalizedProperty( |
| 6178 Handle<JSObject>(lookup.holder(), isolate), &lookup); | 6182 Handle<JSObject>(lookup.holder(), isolate), &lookup); |
| 6179 break; | 6183 break; |
| 6180 case FIELD: | 6184 case FIELD: |
| 6181 result = FastPropertyAt(Handle<JSObject>(lookup.holder(), isolate), | 6185 result = FastPropertyAt(Handle<JSObject>(lookup.holder(), isolate), |
| 6182 lookup.representation(), | 6186 lookup.representation(), |
| 6183 lookup.GetFieldIndex().field_index()); | 6187 lookup.GetFieldIndex()); |
| 6184 break; | 6188 break; |
| 6185 case CONSTANT: | 6189 case CONSTANT: |
| 6186 result = Handle<Object>(lookup.GetConstant(), isolate); | 6190 result = Handle<Object>(lookup.GetConstant(), isolate); |
| 6187 break; | 6191 break; |
| 6188 case CALLBACKS: | 6192 case CALLBACKS: |
| 6189 case HANDLER: | 6193 case HANDLER: |
| 6190 case INTERCEPTOR: | 6194 case INTERCEPTOR: |
| 6191 break; | 6195 break; |
| 6192 case NONEXISTENT: | 6196 case NONEXISTENT: |
| 6193 UNREACHABLE(); | 6197 UNREACHABLE(); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6407 | 6411 |
| 6408 for (int i = 0; i < size; i++) { | 6412 for (int i = 0; i < size; i++) { |
| 6409 PropertyDetails details = descs->GetDetails(i); | 6413 PropertyDetails details = descs->GetDetails(i); |
| 6410 Object* key = descs->GetKey(i); | 6414 Object* key = descs->GetKey(i); |
| 6411 if (!(details.IsDontEnum() || key->IsSymbol())) { | 6415 if (!(details.IsDontEnum() || key->IsSymbol())) { |
| 6412 storage->set(index, key); | 6416 storage->set(index, key); |
| 6413 if (!indices.is_null()) { | 6417 if (!indices.is_null()) { |
| 6414 if (details.type() != FIELD) { | 6418 if (details.type() != FIELD) { |
| 6415 indices = Handle<FixedArray>(); | 6419 indices = Handle<FixedArray>(); |
| 6416 } else { | 6420 } else { |
| 6417 int field_index = descs->GetFieldIndex(i); | 6421 FieldIndex field_index = FieldIndex::ForDescriptor(*map, i); |
| 6418 if (field_index >= map->inobject_properties()) { | 6422 int load_by_field_index = field_index.GetLoadByFieldIndex(); |
| 6419 field_index = -(field_index - map->inobject_properties() + 1); | 6423 indices->set(index, Smi::FromInt(load_by_field_index)); |
| 6420 } | |
| 6421 field_index = field_index << 1; | |
| 6422 if (details.representation().IsDouble()) { | |
| 6423 field_index |= 1; | |
| 6424 } | |
| 6425 indices->set(index, Smi::FromInt(field_index)); | |
| 6426 } | 6424 } |
| 6427 } | 6425 } |
| 6428 index++; | 6426 index++; |
| 6429 } | 6427 } |
| 6430 } | 6428 } |
| 6431 ASSERT(index == storage->length()); | 6429 ASSERT(index == storage->length()); |
| 6432 | 6430 |
| 6433 Handle<FixedArray> bridge_storage = | 6431 Handle<FixedArray> bridge_storage = |
| 6434 isolate->factory()->NewFixedArray( | 6432 isolate->factory()->NewFixedArray( |
| 6435 DescriptorArray::kEnumCacheBridgeLength); | 6433 DescriptorArray::kEnumCacheBridgeLength); |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7119 return isolate->factory()->undefined_value(); | 7117 return isolate->factory()->undefined_value(); |
| 7120 } | 7118 } |
| 7121 | 7119 |
| 7122 | 7120 |
| 7123 Object* JSObject::SlowReverseLookup(Object* value) { | 7121 Object* JSObject::SlowReverseLookup(Object* value) { |
| 7124 if (HasFastProperties()) { | 7122 if (HasFastProperties()) { |
| 7125 int number_of_own_descriptors = map()->NumberOfOwnDescriptors(); | 7123 int number_of_own_descriptors = map()->NumberOfOwnDescriptors(); |
| 7126 DescriptorArray* descs = map()->instance_descriptors(); | 7124 DescriptorArray* descs = map()->instance_descriptors(); |
| 7127 for (int i = 0; i < number_of_own_descriptors; i++) { | 7125 for (int i = 0; i < number_of_own_descriptors; i++) { |
| 7128 if (descs->GetType(i) == FIELD) { | 7126 if (descs->GetType(i) == FIELD) { |
| 7129 Object* property = RawFastPropertyAt(descs->GetFieldIndex(i)); | 7127 Object* property = |
| 7128 RawFastPropertyAt(FieldIndex::ForDescriptor(map(), i)); |
| 7130 if (descs->GetDetails(i).representation().IsDouble()) { | 7129 if (descs->GetDetails(i).representation().IsDouble()) { |
| 7131 ASSERT(property->IsHeapNumber()); | 7130 ASSERT(property->IsHeapNumber()); |
| 7132 if (value->IsNumber() && property->Number() == value->Number()) { | 7131 if (value->IsNumber() && property->Number() == value->Number()) { |
| 7133 return descs->GetKey(i); | 7132 return descs->GetKey(i); |
| 7134 } | 7133 } |
| 7135 } else if (property == value) { | 7134 } else if (property == value) { |
| 7136 return descs->GetKey(i); | 7135 return descs->GetKey(i); |
| 7137 } | 7136 } |
| 7138 } else if (descs->GetType(i) == CONSTANT) { | 7137 } else if (descs->GetType(i) == CONSTANT) { |
| 7139 if (descs->GetConstant(i) == value) { | 7138 if (descs->GetConstant(i) == value) { |
| (...skipping 10056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17196 #define ERROR_MESSAGES_TEXTS(C, T) T, | 17195 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 17197 static const char* error_messages_[] = { | 17196 static const char* error_messages_[] = { |
| 17198 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 17197 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 17199 }; | 17198 }; |
| 17200 #undef ERROR_MESSAGES_TEXTS | 17199 #undef ERROR_MESSAGES_TEXTS |
| 17201 return error_messages_[reason]; | 17200 return error_messages_[reason]; |
| 17202 } | 17201 } |
| 17203 | 17202 |
| 17204 | 17203 |
| 17205 } } // namespace v8::internal | 17204 } } // namespace v8::internal |
| OLD | NEW |