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

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: Reland 1405243006: [es6] Partially implement Reflect.ownKeys. 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
« no previous file with comments | « src/objects.h ('k') | test/mjsunit/harmony/reflect.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 6123008afacbb9cd32133dcbfbd6fadd8a20503c..a53da5c2ff1ed2f9dcc41fb448bc39546294c8e3 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -7821,7 +7821,8 @@ Handle<FixedArray> JSObject::GetEnumPropertyKeys(Handle<JSObject> object,
MaybeHandle<FixedArray> JSReceiver::GetKeys(Handle<JSReceiver> object,
KeyCollectionType type,
KeyFilter filter,
- GetKeysConversion getConversion) {
+ GetKeysConversion getConversion,
+ Enumerability enum_policy) {
USE(ContainsOnlyValidKeys);
Isolate* isolate = object->GetIsolate();
KeyAccumulator accumulator(isolate, filter);
@@ -7830,6 +7831,10 @@ MaybeHandle<FixedArray> JSReceiver::GetKeys(Handle<JSReceiver> object,
PrototypeIterator::WhereToEnd end = type == OWN_ONLY
? PrototypeIterator::END_AT_NON_HIDDEN
: PrototypeIterator::END_AT_NULL;
+ PropertyAttributes attr_filter = static_cast<PropertyAttributes>(
+ (enum_policy == RESPECT_ENUMERABILITY ? DONT_ENUM : NONE) |
+ PRIVATE_SYMBOL);
+
// Only collect keys if access is permitted.
for (PrototypeIterator iter(isolate, object,
PrototypeIterator::START_AT_RECEIVER);
@@ -7863,8 +7868,7 @@ MaybeHandle<FixedArray> JSReceiver::GetKeys(Handle<JSReceiver> object,
break;
}
- JSObject::CollectOwnElementKeys(current, &accumulator,
- static_cast<PropertyAttributes>(DONT_ENUM));
+ JSObject::CollectOwnElementKeys(current, &accumulator, attr_filter);
// Add the element keys from the interceptor.
if (current->HasIndexedInterceptor()) {
@@ -7877,6 +7881,8 @@ MaybeHandle<FixedArray> JSReceiver::GetKeys(Handle<JSReceiver> object,
}
if (filter == SKIP_SYMBOLS) {
+ if (enum_policy == IGNORE_ENUMERABILITY) UNIMPLEMENTED();
+
// We can cache the computed property keys if access checks are
// not needed and no interceptors are involved.
//
@@ -7898,8 +7904,6 @@ 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);
current->CollectOwnPropertyNames(&accumulator, attr_filter);
}
« no previous file with comments | « src/objects.h ('k') | test/mjsunit/harmony/reflect.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698