| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 %CheckIsBootstrapping(); | 96 %CheckIsBootstrapping(); |
| 97 | 97 |
| 98 %SetCode($Symbol, SymbolConstructor); | 98 %SetCode($Symbol, SymbolConstructor); |
| 99 %FunctionSetPrototype($Symbol, new $Object()); | 99 %FunctionSetPrototype($Symbol, new $Object()); |
| 100 | 100 |
| 101 InstallConstants($Symbol, $Array( | 101 InstallConstants($Symbol, $Array( |
| 102 // TODO(rossberg): expose when implemented. | 102 // TODO(rossberg): expose when implemented. |
| 103 // "hasInstance", symbolHasInstance, | 103 // "hasInstance", symbolHasInstance, |
| 104 // "isConcatSpreadable", symbolIsConcatSpreadable, | 104 // "isConcatSpreadable", symbolIsConcatSpreadable, |
| 105 // "isRegExp", symbolIsRegExp, | 105 // "isRegExp", symbolIsRegExp, |
| 106 "iterator", symbolIterator | 106 "iterator", symbolIterator, |
| 107 // "toStringTag", symbolToStringTag, | 107 "toStringTag", symbolToStringTag |
| 108 // "unscopables", symbolUnscopables // added in unscopables.js | 108 // "unscopables", symbolUnscopables // added in unscopables.js |
| 109 )); | 109 )); |
| 110 InstallFunctions($Symbol, DONT_ENUM, $Array( | 110 InstallFunctions($Symbol, DONT_ENUM, $Array( |
| 111 "for", SymbolFor, | 111 "for", SymbolFor, |
| 112 "keyFor", SymbolKeyFor | 112 "keyFor", SymbolKeyFor |
| 113 )); | 113 )); |
| 114 | 114 |
| 115 %AddNamedProperty($Symbol.prototype, "constructor", $Symbol, DONT_ENUM); | 115 %AddNamedProperty($Symbol.prototype, "constructor", $Symbol, DONT_ENUM); |
| 116 InstallFunctions($Symbol.prototype, DONT_ENUM, $Array( | 116 InstallFunctions($Symbol.prototype, DONT_ENUM, $Array( |
| 117 "toString", SymbolToString, | 117 "toString", SymbolToString, |
| 118 "valueOf", SymbolValueOf | 118 "valueOf", SymbolValueOf |
| 119 )); | 119 )); |
| 120 } | 120 } |
| 121 | 121 |
| 122 SetUpSymbol(); | 122 SetUpSymbol(); |
| 123 | 123 |
| 124 function addToStringTagProperty(obj, tag){ |
| 125 %AddNamedProperty(obj, symbolToStringTag, tag, DONT_ENUM | READ_ONLY); |
| 126 } |
| 127 |
| 128 function setUpToStringTags(){ |
| 129 addToStringTagProperty(global.Math, "Math"); |
| 130 addToStringTagProperty(global.JSON, "JSON"); |
| 131 addToStringTagProperty($Symbol.prototype, "Symbol"); |
| 132 addToStringTagProperty(global.Promise.prototype, "Promise"); |
| 133 addToStringTagProperty(global.WeakMap.prototype, "WeakMap"); |
| 134 addToStringTagProperty(global.WeakSet.prototype, "WeakSet"); |
| 135 addToStringTagProperty(global.ArrayBuffer.prototype, "ArrayBuffer"); |
| 136 addToStringTagProperty(global.DataView.prototype, "DataView"); |
| 137 } |
| 138 |
| 139 setUpToStringTags(); |
| 124 | 140 |
| 125 function ExtendObject() { | 141 function ExtendObject() { |
| 126 %CheckIsBootstrapping(); | 142 %CheckIsBootstrapping(); |
| 127 | 143 |
| 128 InstallFunctions($Object, DONT_ENUM, $Array( | 144 InstallFunctions($Object, DONT_ENUM, $Array( |
| 129 "getOwnPropertySymbols", ObjectGetOwnPropertySymbols | 145 "getOwnPropertySymbols", ObjectGetOwnPropertySymbols |
| 130 )); | 146 )); |
| 131 } | 147 } |
| 132 | 148 |
| 133 ExtendObject(); | 149 ExtendObject(); |
| OLD | NEW |