OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 return %WeakCollectionDelete(this, key); | 78 return %WeakCollectionDelete(this, key); |
79 } | 79 } |
80 | 80 |
81 | 81 |
82 // ------------------------------------------------------------------- | 82 // ------------------------------------------------------------------- |
83 | 83 |
84 function SetUpWeakMap() { | 84 function SetUpWeakMap() { |
85 %CheckIsBootstrapping(); | 85 %CheckIsBootstrapping(); |
86 | 86 |
87 %SetCode($WeakMap, WeakMapConstructor); | 87 %SetCode($WeakMap, WeakMapConstructor); |
| 88 %FunctionSetLength($WeakMap, 0); |
88 %FunctionSetPrototype($WeakMap, new $Object()); | 89 %FunctionSetPrototype($WeakMap, new $Object()); |
89 %AddNamedProperty($WeakMap.prototype, "constructor", $WeakMap, DONT_ENUM); | 90 %AddNamedProperty($WeakMap.prototype, "constructor", $WeakMap, DONT_ENUM); |
90 %AddNamedProperty( | 91 %AddNamedProperty( |
91 $WeakMap.prototype, symbolToStringTag, "WeakMap", DONT_ENUM | READ_ONLY); | 92 $WeakMap.prototype, symbolToStringTag, "WeakMap", DONT_ENUM | READ_ONLY); |
92 | 93 |
93 // Set up the non-enumerable functions on the WeakMap prototype object. | 94 // Set up the non-enumerable functions on the WeakMap prototype object. |
94 InstallFunctions($WeakMap.prototype, DONT_ENUM, $Array( | 95 InstallFunctions($WeakMap.prototype, DONT_ENUM, $Array( |
95 "get", WeakMapGet, | 96 "get", WeakMapGet, |
96 "set", WeakMapSet, | 97 "set", WeakMapSet, |
97 "has", WeakMapHas, | 98 "has", WeakMapHas, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 return %WeakCollectionDelete(this, value); | 156 return %WeakCollectionDelete(this, value); |
156 } | 157 } |
157 | 158 |
158 | 159 |
159 // ------------------------------------------------------------------- | 160 // ------------------------------------------------------------------- |
160 | 161 |
161 function SetUpWeakSet() { | 162 function SetUpWeakSet() { |
162 %CheckIsBootstrapping(); | 163 %CheckIsBootstrapping(); |
163 | 164 |
164 %SetCode($WeakSet, WeakSetConstructor); | 165 %SetCode($WeakSet, WeakSetConstructor); |
| 166 %FunctionSetLength($WeakSet, 0); |
165 %FunctionSetPrototype($WeakSet, new $Object()); | 167 %FunctionSetPrototype($WeakSet, new $Object()); |
166 %AddNamedProperty($WeakSet.prototype, "constructor", $WeakSet, DONT_ENUM); | 168 %AddNamedProperty($WeakSet.prototype, "constructor", $WeakSet, DONT_ENUM); |
167 %AddNamedProperty( | 169 %AddNamedProperty( |
168 $WeakSet.prototype, symbolToStringTag, "WeakSet", DONT_ENUM | READ_ONLY); | 170 $WeakSet.prototype, symbolToStringTag, "WeakSet", DONT_ENUM | READ_ONLY); |
169 | 171 |
170 // Set up the non-enumerable functions on the WeakSet prototype object. | 172 // Set up the non-enumerable functions on the WeakSet prototype object. |
171 InstallFunctions($WeakSet.prototype, DONT_ENUM, $Array( | 173 InstallFunctions($WeakSet.prototype, DONT_ENUM, $Array( |
172 "add", WeakSetAdd, | 174 "add", WeakSetAdd, |
173 "has", WeakSetHas, | 175 "has", WeakSetHas, |
174 "delete", WeakSetDelete | 176 "delete", WeakSetDelete |
175 )); | 177 )); |
176 } | 178 } |
177 | 179 |
178 SetUpWeakSet(); | 180 SetUpWeakSet(); |
OLD | NEW |