Chromium Code Reviews| Index: src/objects.cc |
| diff --git a/src/objects.cc b/src/objects.cc |
| index fef74442c3da4a6b93cd0028868e6a4a51c4bdcf..f3ed02ea6844e27c648efc472eb7e271f81ac6b9 100644 |
| --- a/src/objects.cc |
| +++ b/src/objects.cc |
| @@ -7583,7 +7583,8 @@ Handle<FixedArray> JSObject::GetEnumPropertyKeys(Handle<JSObject> object, |
| MaybeHandle<FixedArray> JSReceiver::GetKeys(Handle<JSReceiver> object, |
| KeyCollectionType type, |
| KeyFilter filter, |
| - GetKeysConversion getConversion) { |
| + GetKeysConversion getConversion, |
| + bool only_enumerables) { |
| USE(ContainsOnlyValidKeys); |
| Isolate* isolate = object->GetIsolate(); |
| KeyAccumulator accumulator(isolate, filter); |
| @@ -7625,8 +7626,9 @@ MaybeHandle<FixedArray> JSReceiver::GetKeys(Handle<JSReceiver> object, |
| break; |
| } |
| - JSObject::CollectOwnElementKeys(current, &accumulator, |
| - static_cast<PropertyAttributes>(DONT_ENUM)); |
| + JSObject::CollectOwnElementKeys( |
| + current, &accumulator, |
| + static_cast<PropertyAttributes>(only_enumerables ? DONT_ENUM : NONE)); |
| // Add the element keys from the interceptor. |
| if (current->HasIndexedInterceptor()) { |
| @@ -7639,6 +7641,8 @@ MaybeHandle<FixedArray> JSReceiver::GetKeys(Handle<JSReceiver> object, |
| } |
| if (filter == SKIP_SYMBOLS) { |
| + if (!only_enumerables) UNIMPLEMENTED(); |
| + |
| // We can cache the computed property keys if access checks are |
| // not needed and no interceptors are involved. |
| // |
| @@ -7660,8 +7664,8 @@ MaybeHandle<FixedArray> JSReceiver::GetKeys(Handle<JSReceiver> object, |
| accumulator.AddKeys(enum_keys); |
| } else { |
| DCHECK(filter == INCLUDE_SYMBOLS); |
| - PropertyAttributes attr_filter = |
| - static_cast<PropertyAttributes>(DONT_ENUM | PRIVATE_SYMBOL); |
| + PropertyAttributes attr_filter = static_cast<PropertyAttributes>( |
| + (only_enumerables ? DONT_ENUM : NONE) | PRIVATE_SYMBOL); |
|
Camillo Bruni
2015/11/05 08:29:35
If we're already at it, could you move attr_filter
|
| current->CollectOwnPropertyNames(&accumulator, attr_filter); |
| } |