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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 function SetUpWeakMap() { | 84 function SetUpWeakMap() { |
85 %CheckIsBootstrapping(); | 85 %CheckIsBootstrapping(); |
86 | 86 |
87 %SetCode($WeakMap, WeakMapConstructor); | 87 %SetCode($WeakMap, WeakMapConstructor); |
88 %FunctionSetPrototype($WeakMap, new $Object()); | 88 %FunctionSetPrototype($WeakMap, new $Object()); |
89 %AddNamedProperty($WeakMap.prototype, "constructor", $WeakMap, DONT_ENUM); | 89 %AddNamedProperty($WeakMap.prototype, "constructor", $WeakMap, DONT_ENUM); |
90 %AddNamedProperty( | 90 %AddNamedProperty( |
91 $WeakMap.prototype, symbolToStringTag, "WeakMap", DONT_ENUM | READ_ONLY); | 91 $WeakMap.prototype, symbolToStringTag, "WeakMap", DONT_ENUM | READ_ONLY); |
92 | 92 |
93 // Set up the non-enumerable functions on the WeakMap prototype object. | 93 // Set up the non-enumerable functions on the WeakMap prototype object. |
94 InstallFunctions($WeakMap.prototype, DONT_ENUM, $Array( | 94 InstallFunctions($WeakMap.prototype, DONT_ENUM, [ |
95 "get", WeakMapGet, | 95 "get", WeakMapGet, |
96 "set", WeakMapSet, | 96 "set", WeakMapSet, |
97 "has", WeakMapHas, | 97 "has", WeakMapHas, |
98 "delete", WeakMapDelete | 98 "delete", WeakMapDelete |
99 )); | 99 ]); |
100 } | 100 } |
101 | 101 |
102 SetUpWeakMap(); | 102 SetUpWeakMap(); |
103 | 103 |
104 | 104 |
105 // ------------------------------------------------------------------- | 105 // ------------------------------------------------------------------- |
106 // Harmony WeakSet | 106 // Harmony WeakSet |
107 | 107 |
108 function WeakSetConstructor(iterable) { | 108 function WeakSetConstructor(iterable) { |
109 if (!%_IsConstructCall()) { | 109 if (!%_IsConstructCall()) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 function SetUpWeakSet() { | 161 function SetUpWeakSet() { |
162 %CheckIsBootstrapping(); | 162 %CheckIsBootstrapping(); |
163 | 163 |
164 %SetCode($WeakSet, WeakSetConstructor); | 164 %SetCode($WeakSet, WeakSetConstructor); |
165 %FunctionSetPrototype($WeakSet, new $Object()); | 165 %FunctionSetPrototype($WeakSet, new $Object()); |
166 %AddNamedProperty($WeakSet.prototype, "constructor", $WeakSet, DONT_ENUM); | 166 %AddNamedProperty($WeakSet.prototype, "constructor", $WeakSet, DONT_ENUM); |
167 %AddNamedProperty( | 167 %AddNamedProperty( |
168 $WeakSet.prototype, symbolToStringTag, "WeakSet", DONT_ENUM | READ_ONLY); | 168 $WeakSet.prototype, symbolToStringTag, "WeakSet", DONT_ENUM | READ_ONLY); |
169 | 169 |
170 // Set up the non-enumerable functions on the WeakSet prototype object. | 170 // Set up the non-enumerable functions on the WeakSet prototype object. |
171 InstallFunctions($WeakSet.prototype, DONT_ENUM, $Array( | 171 InstallFunctions($WeakSet.prototype, DONT_ENUM, [ |
172 "add", WeakSetAdd, | 172 "add", WeakSetAdd, |
173 "has", WeakSetHas, | 173 "has", WeakSetHas, |
174 "delete", WeakSetDelete | 174 "delete", WeakSetDelete |
175 )); | 175 ]); |
176 } | 176 } |
177 | 177 |
178 SetUpWeakSet(); | 178 SetUpWeakSet(); |
OLD | NEW |