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

Unified Diff: src/symbol.js

Issue 208423013: Spec adjustments for well-known symbols (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comment Created 6 years, 9 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 | « no previous file | test/mjsunit/harmony/symbols.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/symbol.js
diff --git a/src/symbol.js b/src/symbol.js
index 49f909694c19f3ee44c60a39def7fbbd0f39c6a5..7bf10d1288967c222108c451f987735e2420b2b4 100644
--- a/src/symbol.js
+++ b/src/symbol.js
@@ -65,7 +65,7 @@ function SymbolValueOf() {
function GetSymbolRegistry() {
var registry = %SymbolRegistry();
- if (!('internal' in registry)) {
+ if (IS_UNDEFINED(registry.internal)) {
registry.internal = {__proto__: null};
registry.for = {__proto__: null};
registry.keyFor = {__proto__: null};
@@ -76,7 +76,7 @@ function GetSymbolRegistry() {
function InternalSymbol(key) {
var registry = GetSymbolRegistry();
- if (!(key in registry.internal)) {
+ if (IS_UNDEFINED(registry.internal[key])) {
registry.internal[key] = %CreateSymbol(key);
}
return registry.internal[key];
@@ -86,7 +86,7 @@ function InternalSymbol(key) {
function SymbolFor(key) {
key = TO_STRING_INLINE(key);
var registry = GetSymbolRegistry();
- if (!(key in registry.for)) {
+ if (IS_UNDEFINED(registry.for[key])) {
var symbol = %CreateSymbol(key);
registry.for[key] = symbol;
registry.keyFor[symbol] = key;
@@ -118,13 +118,13 @@ function ObjectGetOwnPropertySymbols(obj) {
//-------------------------------------------------------------------
-var symbolCreate = InternalSymbol("@@create");
-var symbolHasInstance = InternalSymbol("@@hasInstance");
-var symbolIsConcatSpreadable = InternalSymbol("@@isConcatSpreadable");
-var symbolIsRegExp = InternalSymbol("@@isRegExp");
-var symbolIterator = InternalSymbol("@@iterator");
-var symbolToStringTag = InternalSymbol("@@toStringTag");
-var symbolUnscopables = InternalSymbol("@@unscopables");
+var symbolCreate = InternalSymbol("Symbol.create");
+var symbolHasInstance = InternalSymbol("Symbol.hasInstance");
+var symbolIsConcatSpreadable = InternalSymbol("Symbol.isConcatSpreadable");
+var symbolIsRegExp = InternalSymbol("Symbol.isRegExp");
+var symbolIterator = InternalSymbol("Symbol.iterator");
+var symbolToStringTag = InternalSymbol("Symbol.toStringTag");
+var symbolUnscopables = InternalSymbol("Symbol.unscopables");
//-------------------------------------------------------------------
@@ -135,14 +135,15 @@ function SetUpSymbol() {
%SetCode($Symbol, SymbolConstructor);
%FunctionSetPrototype($Symbol, new $Object());
- %SetProperty($Symbol, "create", symbolCreate, DONT_ENUM);
- %SetProperty($Symbol, "hasInstance", symbolHasInstance, DONT_ENUM);
- %SetProperty($Symbol, "isConcatSpreadable",
- symbolIsConcatSpreadable, DONT_ENUM);
- %SetProperty($Symbol, "isRegExp", symbolIsRegExp, DONT_ENUM);
- %SetProperty($Symbol, "iterator", symbolIterator, DONT_ENUM);
- %SetProperty($Symbol, "toStringTag", symbolToStringTag, DONT_ENUM);
- %SetProperty($Symbol, "unscopables", symbolUnscopables, DONT_ENUM);
+ InstallConstants($Symbol, $Array(
+ "create", symbolCreate,
+ "hasInstance", symbolHasInstance,
+ "isConcatSpreadable", symbolIsConcatSpreadable,
+ "isRegExp", symbolIsRegExp,
+ "iterator", symbolIterator,
+ "toStringTag", symbolToStringTag,
+ "unscopables", symbolUnscopables
+ ));
InstallFunctions($Symbol, DONT_ENUM, $Array(
"for", SymbolFor,
"keyFor", SymbolKeyFor
« no previous file with comments | « no previous file | test/mjsunit/harmony/symbols.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698