Chromium Code Reviews| Index: src/runtime/runtime-array.cc |
| diff --git a/src/runtime/runtime-array.cc b/src/runtime/runtime-array.cc |
| index 349bb622628a0156ad25591c97a3e12138a76b73..64ce191a05f35e224a6ad07ddeba15137d14576c 100644 |
| --- a/src/runtime/runtime-array.cc |
| +++ b/src/runtime/runtime-array.cc |
| @@ -206,6 +206,8 @@ RUNTIME_FUNCTION(Runtime_GetArrayKeys) { |
| } |
| KeyAccumulator accumulator(isolate); |
| + // No need to separate protoype levels sicne we only get numbers/element keys |
|
Igor Sheludko
2015/10/15 09:51:44
s/sicne/since/
|
| + accumulator.NextPrototype(); |
| for (PrototypeIterator iter(isolate, array, |
| PrototypeIterator::START_AT_RECEIVER); |
| !iter.IsAtEnd(); iter.Advance()) { |
| @@ -217,15 +219,12 @@ RUNTIME_FUNCTION(Runtime_GetArrayKeys) { |
| return *isolate->factory()->NewNumberFromUint(length); |
| } |
| Handle<JSObject> current = PrototypeIterator::GetCurrent<JSObject>(iter); |
| - Handle<FixedArray> current_keys = |
| - isolate->factory()->NewFixedArray(current->NumberOfOwnElements(NONE)); |
| - current->GetOwnElementKeys(*current_keys, NONE); |
| - accumulator.AddKeys(current_keys, INCLUDE_SYMBOLS); |
| + JSObject::CollectOwnElementKeys(current, &accumulator, NONE); |
| } |
| // Erase any keys >= length. |
| // TODO(adamk): Remove this step when the contract of %GetArrayKeys |
| // is changed to let this happen on the JS side. |
| - Handle<FixedArray> keys = accumulator.GetKeys(); |
| + Handle<FixedArray> keys = accumulator.GetKeys(KEEP_NUMBERS); |
| for (int i = 0; i < keys->length(); i++) { |
| if (NumberToUint32(keys->get(i)) >= length) keys->set_undefined(i); |
| } |