OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 (function(global, utils) { | 5 (function(global, utils) { |
6 | 6 |
7 "use strict"; | 7 "use strict"; |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 function SymbolValueOf() { | 51 function SymbolValueOf() { |
52 if (!(IS_SYMBOL(this) || IS_SYMBOL_WRAPPER(this))) { | 52 if (!(IS_SYMBOL(this) || IS_SYMBOL_WRAPPER(this))) { |
53 throw MakeTypeError(kIncompatibleMethodReceiver, | 53 throw MakeTypeError(kIncompatibleMethodReceiver, |
54 "Symbol.prototype.valueOf", this); | 54 "Symbol.prototype.valueOf", this); |
55 } | 55 } |
56 return %_ValueOf(this); | 56 return %_ValueOf(this); |
57 } | 57 } |
58 | 58 |
59 | 59 |
60 function SymbolFor(key) { | 60 function SymbolFor(key) { |
61 key = TO_STRING_INLINE(key); | 61 key = TO_STRING(key); |
62 var registry = %SymbolRegistry(); | 62 var registry = %SymbolRegistry(); |
63 if (IS_UNDEFINED(registry.for[key])) { | 63 if (IS_UNDEFINED(registry.for[key])) { |
64 var symbol = %CreateSymbol(key); | 64 var symbol = %CreateSymbol(key); |
65 registry.for[key] = symbol; | 65 registry.for[key] = symbol; |
66 registry.keyFor[symbol] = key; | 66 registry.keyFor[symbol] = key; |
67 } | 67 } |
68 return registry.for[key]; | 68 return registry.for[key]; |
69 } | 69 } |
70 | 70 |
71 | 71 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 ]); | 125 ]); |
126 | 126 |
127 // ------------------------------------------------------------------- | 127 // ------------------------------------------------------------------- |
128 // Exports | 128 // Exports |
129 | 129 |
130 utils.Export(function(to) { | 130 utils.Export(function(to) { |
131 to.SymbolToString = SymbolToString; | 131 to.SymbolToString = SymbolToString; |
132 }) | 132 }) |
133 | 133 |
134 }) | 134 }) |
OLD | NEW |