| Index: src/handles.cc
|
| diff --git a/src/handles.cc b/src/handles.cc
|
| index 899f9bfb5c8d0d15c1e5fb578670b09848c09835..398a68265cdf1c65d2b98a4d459ab972bbe34cef 100644
|
| --- a/src/handles.cc
|
| +++ b/src/handles.cc
|
| @@ -712,35 +712,12 @@ Handle<FixedArray> GetEnumPropertyKeys(Handle<JSObject> object,
|
| return ReduceFixedArrayTo(storage, enum_size);
|
| } else {
|
| Handle<NameDictionary> dictionary(object->property_dictionary());
|
| -
|
| - int length = dictionary->NumberOfElements();
|
| + int length = dictionary->NumberOfEnumElements();
|
| if (length == 0) {
|
| return Handle<FixedArray>(isolate->heap()->empty_fixed_array());
|
| }
|
| -
|
| - // The enumeration array is generated by allocating an array big enough to
|
| - // hold all properties that have been seen, whether they are are deleted or
|
| - // not. Subsequently all visible properties are added to the array. If some
|
| - // properties were not visible, the array is trimmed so it only contains
|
| - // visible properties. This improves over adding elements and sorting by
|
| - // index by having linear complexity rather than n*log(n).
|
| -
|
| - // By comparing the monotonous NextEnumerationIndex to the NumberOfElements,
|
| - // we can predict the number of holes in the final array. If there will be
|
| - // more than 50% holes, regenerate the enumeration indices to reduce the
|
| - // number of holes to a minimum. This avoids allocating a large array if
|
| - // many properties were added but subsequently deleted.
|
| - int next_enumeration = dictionary->NextEnumerationIndex();
|
| - if (!object->IsGlobalObject() && next_enumeration > (length * 3) / 2) {
|
| - NameDictionary::DoGenerateNewEnumerationIndices(dictionary);
|
| - next_enumeration = dictionary->NextEnumerationIndex();
|
| - }
|
| -
|
| - Handle<FixedArray> storage =
|
| - isolate->factory()->NewFixedArray(next_enumeration);
|
| -
|
| - storage = Handle<FixedArray>(dictionary->CopyEnumKeysTo(*storage));
|
| - ASSERT(storage->length() == object->NumberOfLocalProperties(DONT_SHOW));
|
| + Handle<FixedArray> storage = isolate->factory()->NewFixedArray(length);
|
| + dictionary->CopyEnumKeysTo(*storage);
|
| return storage;
|
| }
|
| }
|
|
|