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 // Expects following symbols to be set in the bootstrapper during genesis: | 5 // Expects following symbols to be set in the bootstrapper during genesis: |
6 // - symbolHasInstance | 6 // - symbolHasInstance |
7 // - symbolIsConcatSpreadable | 7 // - symbolIsConcatSpreadable |
8 // - symbolIsRegExp | 8 // - symbolIsRegExp |
9 // - symbolIterator | 9 // - symbolIterator |
10 // - symbolToStringTag | 10 // - symbolToStringTag |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 if (IS_UNDEFINED(registry.for[key])) { | 55 if (IS_UNDEFINED(registry.for[key])) { |
56 var symbol = %CreateSymbol(key); | 56 var symbol = %CreateSymbol(key); |
57 registry.for[key] = symbol; | 57 registry.for[key] = symbol; |
58 registry.keyFor[symbol] = key; | 58 registry.keyFor[symbol] = key; |
59 } | 59 } |
60 return registry.for[key]; | 60 return registry.for[key]; |
61 } | 61 } |
62 | 62 |
63 | 63 |
64 function SymbolKeyFor(symbol) { | 64 function SymbolKeyFor(symbol) { |
65 if (!IS_SYMBOL(symbol)) throw MakeTypeError("not_a_symbol", [symbol]); | 65 if (!IS_SYMBOL(symbol)) throw MakeTypeError(kSymbolKeyFor, symbol); |
66 return %SymbolRegistry().keyFor[symbol]; | 66 return %SymbolRegistry().keyFor[symbol]; |
67 } | 67 } |
68 | 68 |
69 | 69 |
70 // ES6 19.1.2.8 | 70 // ES6 19.1.2.8 |
71 function ObjectGetOwnPropertySymbols(obj) { | 71 function ObjectGetOwnPropertySymbols(obj) { |
72 obj = $toObject(obj); | 72 obj = $toObject(obj); |
73 | 73 |
74 // TODO(arv): Proxies use a shared trap for String and Symbol keys. | 74 // TODO(arv): Proxies use a shared trap for String and Symbol keys. |
75 | 75 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 "valueOf", SymbolValueOf | 108 "valueOf", SymbolValueOf |
109 ]); | 109 ]); |
110 | 110 |
111 $installFunctions(GlobalObject, DONT_ENUM, [ | 111 $installFunctions(GlobalObject, DONT_ENUM, [ |
112 "getOwnPropertySymbols", ObjectGetOwnPropertySymbols | 112 "getOwnPropertySymbols", ObjectGetOwnPropertySymbols |
113 ]); | 113 ]); |
114 | 114 |
115 $symbolToString = SymbolToString; | 115 $symbolToString = SymbolToString; |
116 | 116 |
117 }) | 117 }) |
OLD | NEW |