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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 %SetCode($Symbol, SymbolConstructor); | 95 %SetCode($Symbol, SymbolConstructor); |
96 %FunctionSetPrototype($Symbol, new $Object()); | 96 %FunctionSetPrototype($Symbol, new $Object()); |
97 | 97 |
98 InstallConstants($Symbol, $Array( | 98 InstallConstants($Symbol, $Array( |
99 // TODO(rossberg): expose when implemented. | 99 // TODO(rossberg): expose when implemented. |
100 // "hasInstance", symbolHasInstance, | 100 // "hasInstance", symbolHasInstance, |
101 // "isConcatSpreadable", symbolIsConcatSpreadable, | 101 // "isConcatSpreadable", symbolIsConcatSpreadable, |
102 // "isRegExp", symbolIsRegExp, | 102 // "isRegExp", symbolIsRegExp, |
103 "iterator", symbolIterator, | 103 "iterator", symbolIterator, |
| 104 // TODO(dslomov, caitp): Currently defined in harmony-tostring.js --- |
| 105 // Move here when shipping |
104 // "toStringTag", symbolToStringTag, | 106 // "toStringTag", symbolToStringTag, |
105 "unscopables", symbolUnscopables | 107 "unscopables", symbolUnscopables |
106 )); | 108 )); |
107 InstallFunctions($Symbol, DONT_ENUM, $Array( | 109 InstallFunctions($Symbol, DONT_ENUM, $Array( |
108 "for", SymbolFor, | 110 "for", SymbolFor, |
109 "keyFor", SymbolKeyFor | 111 "keyFor", SymbolKeyFor |
110 )); | 112 )); |
111 | 113 |
112 %AddNamedProperty($Symbol.prototype, "constructor", $Symbol, DONT_ENUM); | 114 %AddNamedProperty($Symbol.prototype, "constructor", $Symbol, DONT_ENUM); |
| 115 %AddNamedProperty( |
| 116 $Symbol.prototype, symbolToStringTag, "Symbol", DONT_ENUM | READ_ONLY); |
113 InstallFunctions($Symbol.prototype, DONT_ENUM, $Array( | 117 InstallFunctions($Symbol.prototype, DONT_ENUM, $Array( |
114 "toString", SymbolToString, | 118 "toString", SymbolToString, |
115 "valueOf", SymbolValueOf | 119 "valueOf", SymbolValueOf |
116 )); | 120 )); |
117 } | 121 } |
118 | 122 |
119 SetUpSymbol(); | 123 SetUpSymbol(); |
120 | 124 |
121 | 125 |
122 function ExtendObject() { | 126 function ExtendObject() { |
123 %CheckIsBootstrapping(); | 127 %CheckIsBootstrapping(); |
124 | 128 |
125 InstallFunctions($Object, DONT_ENUM, $Array( | 129 InstallFunctions($Object, DONT_ENUM, $Array( |
126 "getOwnPropertySymbols", ObjectGetOwnPropertySymbols | 130 "getOwnPropertySymbols", ObjectGetOwnPropertySymbols |
127 )); | 131 )); |
128 } | 132 } |
129 | 133 |
130 ExtendObject(); | 134 ExtendObject(); |
OLD | NEW |