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

Unified Diff: src/key-accumulator.cc

Issue 1492653004: [cleanup] Introduce PropertyFilter (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: windows ♥ Created 5 years 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/key-accumulator.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/key-accumulator.cc
diff --git a/src/key-accumulator.cc b/src/key-accumulator.cc
index 43d74733225008dac4ff2563c9c6c6855de3a509..f79561b392ba51b1a77534d539780b3729f6fa7b 100644
--- a/src/key-accumulator.cc
+++ b/src/key-accumulator.cc
@@ -99,7 +99,8 @@ bool KeyAccumulator::AddKey(Object* key, AddKeyConversion convert) {
bool KeyAccumulator::AddKey(Handle<Object> key, AddKeyConversion convert) {
if (key->IsSymbol()) {
- if (filter_ == SKIP_SYMBOLS) return false;
+ if (filter_ & SKIP_SYMBOLS) return false;
+ if (Handle<Symbol>::cast(key)->is_private()) return false;
return AddSymbolKey(key);
}
// Make sure we do not add keys to a proxy-level (see AddKeysFromProxy).
@@ -221,17 +222,20 @@ void KeyAccumulator::AddKeysFromProxy(Handle<JSObject> array_like) {
MaybeHandle<FixedArray> FilterProxyKeys(Isolate* isolate, Handle<JSProxy> owner,
Handle<FixedArray> keys,
- KeyFilter filter,
- Enumerability enum_policy) {
- if (filter == INCLUDE_SYMBOLS && enum_policy == IGNORE_ENUMERABILITY) {
+ PropertyFilter filter) {
+ if (filter == ALL_PROPERTIES) {
// Nothing to do.
return keys;
}
int store_position = 0;
for (int i = 0; i < keys->length(); ++i) {
Handle<Name> key(Name::cast(keys->get(i)), isolate);
- if (filter == SKIP_SYMBOLS && key->IsSymbol()) continue; // Skip this key.
- if (enum_policy == RESPECT_ENUMERABILITY) {
+ if (key->IsSymbol()) {
+ if ((filter & SKIP_SYMBOLS) || Handle<Symbol>::cast(key)->is_private()) {
+ continue; // Skip this key.
+ }
+ }
+ if (filter & ONLY_ENUMERABLE) {
PropertyDescriptor desc;
bool found =
JSProxy::GetOwnPropertyDescriptor(isolate, owner, key, &desc);
@@ -252,11 +256,9 @@ MaybeHandle<FixedArray> FilterProxyKeys(Isolate* isolate, Handle<JSProxy> owner,
// Returns "false" in case of exception, "true" on success.
bool KeyAccumulator::AddKeysFromProxy(Handle<JSProxy> proxy,
- Handle<FixedArray> keys, KeyFilter filter,
- Enumerability enum_policy) {
+ Handle<FixedArray> keys) {
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
- isolate_, keys,
- FilterProxyKeys(isolate_, proxy, keys, filter, enum_policy), false);
+ isolate_, keys, FilterProxyKeys(isolate_, proxy, keys, filter_), false);
// Proxies define a complete list of keys with no distinction of
// elements and properties, which breaks the normal assumption for the
// KeyAccumulator.
« no previous file with comments | « src/key-accumulator.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698