Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index cf21e802ebc14b32afd64beb0a891939bc213ea5..b70e4f1bbde4c7b70daeef5c3984936a16fc3e6a 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -5924,6 +5924,24 @@ bool JSReceiver::IsSimpleEnum() { |
} |
+static bool FilterKey(Object* key, PropertyAttributes filter) { |
+ if ((filter & SYMBOLIC) && key->IsSymbol()) { |
+ return true; |
+ } |
+ |
+ if ((filter & PRIVATE_SYMBOL) && |
+ key->IsSymbol() && Symbol::cast(key)->is_private()) { |
+ return true; |
+ } |
+ |
+ if ((filter & STRING) && !key->IsSymbol()) { |
+ return true; |
+ } |
+ |
+ return false; |
+} |
+ |
+ |
int Map::NumberOfDescribedProperties(DescriptorFlag which, |
PropertyAttributes filter) { |
int result = 0; |
@@ -5933,7 +5951,7 @@ int Map::NumberOfDescribedProperties(DescriptorFlag which, |
: NumberOfOwnDescriptors(); |
for (int i = 0; i < limit; i++) { |
if ((descs->GetDetails(i).attributes() & filter) == 0 && |
- ((filter & SYMBOLIC) == 0 || !descs->GetKey(i)->IsSymbol())) { |
+ !FilterKey(descs->GetKey(i), filter)) { |
result++; |
} |
} |
@@ -13532,7 +13550,7 @@ void JSObject::GetLocalPropertyNames( |
DescriptorArray* descs = map()->instance_descriptors(); |
for (int i = 0; i < real_size; i++) { |
if ((descs->GetDetails(i).attributes() & filter) == 0 && |
- ((filter & SYMBOLIC) == 0 || !descs->GetKey(i)->IsSymbol())) { |
+ !FilterKey(descs->GetKey(i), filter)) { |
storage->set(index++, descs->GetKey(i)); |
} |
} |
@@ -15634,7 +15652,7 @@ int Dictionary<Shape, Key>::NumberOfElementsFilterAttributes( |
for (int i = 0; i < capacity; i++) { |
Object* k = HashTable<Shape, Key>::KeyAt(i); |
if (HashTable<Shape, Key>::IsKey(k) && |
- ((filter & SYMBOLIC) == 0 || !k->IsSymbol())) { |
+ !FilterKey(k, filter)) { |
PropertyDetails details = DetailsAt(i); |
if (details.IsDeleted()) continue; |
PropertyAttributes attr = details.attributes(); |