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

Unified Diff: src/objects.cc

Issue 108083005: ES6: Add Object.getOwnPropertySymbols (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove FilterKeyNames from js and inverse filter check Created 7 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/mirror-debugger.js ('k') | src/property-details.h » ('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 43a047e78c0cd80c179a3c476c919f6251475362..8472d00ae92ba05af013d9dab7254867b01abd32 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -5911,6 +5911,24 @@ bool JSReceiver::IsSimpleEnum() {
}
+static bool FilterKey(Object* key, PropertyAttributes filter) {
+ if ((filter & SYMBOLIC) && key->IsSymbol()) {
arv (Not doing code reviews) 2013/12/18 18:10:02 One option here would be: if (filter & (SYMBOLIC
rossberg 2013/12/19 10:28:04 I leave that up to you, I'm fine either way.
+ 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;
@@ -5920,7 +5938,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++;
}
}
@@ -13551,7 +13569,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));
}
}
@@ -15653,7 +15671,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();
« no previous file with comments | « src/mirror-debugger.js ('k') | src/property-details.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698