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

Unified Diff: src/v8natives.js

Issue 557023002: Refactor ObjectGetOwnPropertyKeys to accept bitmask rather than boolean (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Style/typo correction Created 6 years, 3 months 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/symbol.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index a522738b881b9042f4a3cc0a44e3ec76e022229e..98ff24cd7b34f9910430ed8491d51a6c05a0ee70 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -1038,16 +1038,15 @@ function ToNameArray(obj, trap, includeSymbols) {
}
-function ObjectGetOwnPropertyKeys(obj, symbolsOnly) {
+function ObjectGetOwnPropertyKeys(obj, filter) {
var nameArrays = new InternalArray();
- var filter = symbolsOnly ?
- PROPERTY_ATTRIBUTES_STRING | PROPERTY_ATTRIBUTES_PRIVATE_SYMBOL :
- PROPERTY_ATTRIBUTES_SYMBOLIC;
+ filter = (filter || PROPERTY_ATTRIBUTES_NONE)
rossberg 2014/09/10 07:37:59 Please remove the defaulting and make sure that it
caitp (gmail) 2014/09/10 16:54:11 `filter |= PROPERTY_ATTRIBUTES_PRIVATE_SYMBOL` wou
+ | PROPERTY_ATTRIBUTES_PRIVATE_SYMBOL;
// Find all the indexed properties.
// Only get own element names if we want to include string keys.
- if (!symbolsOnly) {
+ if ((filter & PROPERTY_ATTRIBUTES_STRING) === 0) {
var ownElementNames = %GetOwnElementNames(obj);
for (var i = 0; i < ownElementNames.length; ++i) {
ownElementNames[i] = %_NumberToString(ownElementNames[i]);
@@ -1089,12 +1088,16 @@ function ObjectGetOwnPropertyKeys(obj, symbolsOnly) {
var j = 0;
for (var i = 0; i < propertyNames.length; ++i) {
var name = propertyNames[i];
- if (symbolsOnly) {
- if (!IS_SYMBOL(name) || IS_PRIVATE(name)) continue;
+
+ if (IS_SYMBOL(name)) {
+ if ((filter & PROPERTY_ATTRIBUTES_SYMBOLIC) || IS_PRIVATE(name)) {
+ continue;
+ }
} else {
- if (IS_SYMBOL(name)) continue;
+ if (filter & PROPERTY_ATTRIBUTES_STRING) continue;
name = ToString(name);
}
+
if (seenKeys[name]) continue;
seenKeys[name] = true;
propertyNames[j++] = name;
@@ -1118,7 +1121,7 @@ function ObjectGetOwnPropertyNames(obj) {
return ToNameArray(names, "getOwnPropertyNames", false);
}
- return ObjectGetOwnPropertyKeys(obj, false);
+ return ObjectGetOwnPropertyKeys(obj, PROPERTY_ATTRIBUTES_SYMBOLIC);
}
« no previous file with comments | « src/symbol.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698