Chromium Code Reviews| Index: src/handles.cc |
| diff --git a/src/handles.cc b/src/handles.cc |
| index 398a68265cdf1c65d2b98a4d459ab972bbe34cef..ec4f7291b5bcd44f1d30ff273c89e474229d3a81 100644 |
| --- a/src/handles.cc |
| +++ b/src/handles.cc |
| @@ -663,7 +663,7 @@ Handle<FixedArray> GetEnumPropertyKeys(Handle<JSObject> object, |
| } |
| isolate->counters()->enum_cache_misses()->Increment(); |
| - int num_enum = map->NumberOfDescribedProperties(ALL_DESCRIPTORS, DONT_SHOW); |
| + int num_enum = map->NumberOfDescribedProperties(OWN_DESCRIPTORS, DONT_SHOW); |
|
Toon Verwaest
2014/03/27 11:53:39
This valid is already available as own_property_co
|
| Handle<FixedArray> storage = isolate->factory()->NewFixedArray(num_enum); |
| Handle<FixedArray> indices = isolate->factory()->NewFixedArray(num_enum); |
| @@ -671,15 +671,13 @@ Handle<FixedArray> GetEnumPropertyKeys(Handle<JSObject> object, |
| Handle<DescriptorArray> descs = |
| Handle<DescriptorArray>(object->map()->instance_descriptors(), isolate); |
| - int real_size = map->NumberOfOwnDescriptors(); |
| - int enum_size = 0; |
| + int size = map->NumberOfOwnDescriptors(); |
| int index = 0; |
| - for (int i = 0; i < descs->number_of_descriptors(); i++) { |
| + for (int i = 0; i < size; i++) { |
| PropertyDetails details = descs->GetDetails(i); |
| Object* key = descs->GetKey(i); |
| if (!(details.IsDontEnum() || key->IsSymbol())) { |
| - if (i < real_size) ++enum_size; |
| storage->set(index, key); |
| if (!indices.is_null()) { |
| if (details.type() != FIELD) { |
| @@ -706,10 +704,9 @@ Handle<FixedArray> GetEnumPropertyKeys(Handle<JSObject> object, |
| indices.is_null() ? Object::cast(Smi::FromInt(0)) |
| : Object::cast(*indices)); |
| if (cache_result) { |
| - object->map()->SetEnumLength(enum_size); |
| + object->map()->SetEnumLength(index); |
|
Toon Verwaest
2014/03/27 11:53:39
use own_property_count here.
|
| } |
| - |
| - return ReduceFixedArrayTo(storage, enum_size); |
| + return storage; |
| } else { |
| Handle<NameDictionary> dictionary(object->property_dictionary()); |
| int length = dictionary->NumberOfEnumElements(); |