Index: src/symbol.js |
diff --git a/src/symbol.js b/src/symbol.js |
index 49f909694c19f3ee44c60a39def7fbbd0f39c6a5..550ebe1f7a8d6cf360c9233335091fc170b19f9f 100644 |
--- a/src/symbol.js |
+++ b/src/symbol.js |
@@ -63,30 +63,19 @@ function SymbolValueOf() { |
} |
-function GetSymbolRegistry() { |
- var registry = %SymbolRegistry(); |
- if (!('internal' in registry)) { |
- registry.internal = {__proto__: null}; |
- registry.for = {__proto__: null}; |
- registry.keyFor = {__proto__: null}; |
- } |
- return registry; |
-} |
- |
- |
function InternalSymbol(key) { |
- var registry = GetSymbolRegistry(); |
- if (!(key in registry.internal)) { |
- registry.internal[key] = %CreateSymbol(key); |
+ var internal_registry = %SymbolRegistry().for_intern; |
+ if (IS_UNDEFINED(internal_registry[key])) { |
+ internal_registry[key] = %CreateSymbol(key); |
} |
- return registry.internal[key]; |
+ return internal_registry[key]; |
} |
function SymbolFor(key) { |
key = TO_STRING_INLINE(key); |
- var registry = GetSymbolRegistry(); |
- if (!(key in registry.for)) { |
+ var registry = %SymbolRegistry(); |
+ if (IS_UNDEFINED(registry.for[key])) { |
var symbol = %CreateSymbol(key); |
registry.for[key] = symbol; |
registry.keyFor[symbol] = key; |
@@ -96,10 +85,8 @@ function SymbolFor(key) { |
function SymbolKeyFor(symbol) { |
- if (!IS_SYMBOL(symbol)) { |
- throw MakeTypeError("not_a_symbol", [symbol]); |
- } |
- return GetSymbolRegistry().keyFor[symbol]; |
+ if (!IS_SYMBOL(symbol)) throw MakeTypeError("not_a_symbol", [symbol]); |
+ return %SymbolRegistry().keyFor[symbol]; |
} |