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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 | 72 |
73 function SymbolKeyFor(symbol) { | 73 function SymbolKeyFor(symbol) { |
74 if (!IS_SYMBOL(symbol)) throw MakeTypeError(kSymbolKeyFor, symbol); | 74 if (!IS_SYMBOL(symbol)) throw MakeTypeError(kSymbolKeyFor, symbol); |
75 return %SymbolRegistry().keyFor[symbol]; | 75 return %SymbolRegistry().keyFor[symbol]; |
76 } | 76 } |
77 | 77 |
78 | 78 |
79 // ES6 19.1.2.8 | 79 // ES6 19.1.2.8 |
80 function ObjectGetOwnPropertySymbols(obj) { | 80 function ObjectGetOwnPropertySymbols(obj) { |
81 obj = $toObject(obj); | 81 obj = TO_OBJECT(obj); |
82 | 82 |
83 // TODO(arv): Proxies use a shared trap for String and Symbol keys. | 83 // TODO(arv): Proxies use a shared trap for String and Symbol keys. |
84 | 84 |
85 return ObjectGetOwnPropertyKeys(obj, PROPERTY_ATTRIBUTES_STRING); | 85 return ObjectGetOwnPropertyKeys(obj, PROPERTY_ATTRIBUTES_STRING); |
86 } | 86 } |
87 | 87 |
88 //------------------------------------------------------------------- | 88 //------------------------------------------------------------------- |
89 | 89 |
90 %SetCode(GlobalSymbol, SymbolConstructor); | 90 %SetCode(GlobalSymbol, SymbolConstructor); |
91 %FunctionSetPrototype(GlobalSymbol, new GlobalObject()); | 91 %FunctionSetPrototype(GlobalSymbol, new GlobalObject()); |
(...skipping 25 matching lines...) Expand all Loading... |
117 "valueOf", SymbolValueOf | 117 "valueOf", SymbolValueOf |
118 ]); | 118 ]); |
119 | 119 |
120 utils.InstallFunctions(GlobalObject, DONT_ENUM, [ | 120 utils.InstallFunctions(GlobalObject, DONT_ENUM, [ |
121 "getOwnPropertySymbols", ObjectGetOwnPropertySymbols | 121 "getOwnPropertySymbols", ObjectGetOwnPropertySymbols |
122 ]); | 122 ]); |
123 | 123 |
124 $symbolToString = SymbolToString; | 124 $symbolToString = SymbolToString; |
125 | 125 |
126 }) | 126 }) |
OLD | NEW |