Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Unified Diff: src/objects.cc

Issue 1405243006: [es6] Partially implement Reflect.ownKeys. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}

Powered by Google App Engine
This is Rietveld 408576698