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 "use strict"; | 5 "use strict"; |
6 | 6 |
7 // This file relies on the fact that the following declaration has been made | 7 // This file relies on the fact that the following declaration has been made |
8 // in runtime.js: | 8 // in runtime.js: |
9 // var $Array = global.Array; | 9 // var $Array = global.Array; |
10 | 10 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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("not_a_symbol", [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 if (!IS_SPEC_OBJECT(obj)) { | 72 obj = ToObject(obj); |
73 throw MakeTypeError("called_on_non_object", | |
74 ["Object.getOwnPropertySymbols"]); | |
75 } | |
76 | 73 |
77 // 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. |
78 | 75 |
79 return ObjectGetOwnPropertyKeys(obj, true); | 76 return ObjectGetOwnPropertyKeys(obj, true); |
80 } | 77 } |
81 | 78 |
82 | 79 |
83 //------------------------------------------------------------------- | 80 //------------------------------------------------------------------- |
84 | 81 |
85 var symbolHasInstance = InternalSymbol("Symbol.hasInstance"); | 82 var symbolHasInstance = InternalSymbol("Symbol.hasInstance"); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 121 |
125 function ExtendObject() { | 122 function ExtendObject() { |
126 %CheckIsBootstrapping(); | 123 %CheckIsBootstrapping(); |
127 | 124 |
128 InstallFunctions($Object, DONT_ENUM, $Array( | 125 InstallFunctions($Object, DONT_ENUM, $Array( |
129 "getOwnPropertySymbols", ObjectGetOwnPropertySymbols | 126 "getOwnPropertySymbols", ObjectGetOwnPropertySymbols |
130 )); | 127 )); |
131 } | 128 } |
132 | 129 |
133 ExtendObject(); | 130 ExtendObject(); |
OLD | NEW |