| 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 |
| 11 var $WeakMap = global.WeakMap; | 11 var $WeakMap = global.WeakMap; |
| 12 var $WeakSet = global.WeakSet; | 12 var $WeakSet = global.WeakSet; |
| 13 | 13 |
| 14 | 14 |
| 15 // ------------------------------------------------------------------- | 15 // ------------------------------------------------------------------- |
| 16 // Harmony WeakMap | 16 // Harmony WeakMap |
| 17 | 17 |
| 18 function WeakMapConstructor(iterable) { | 18 function WeakMapConstructor(iterable) { |
| 19 if (!%_IsConstructCall()) { | 19 if (!%_IsConstructCall()) { |
| 20 throw MakeTypeError('constructor_not_function', ['WeakMap']); | 20 throw MakeTypeError('constructor_not_function', ['WeakMap']); |
| 21 } | 21 } |
| 22 | 22 |
| 23 var iter, adder; | 23 var iter, adder; |
| 24 | 24 |
| 25 if (!IS_NULL_OR_UNDEFINED(iterable)) { | 25 if (!IS_NULL_OR_UNDEFINED(iterable)) { |
| 26 iter = GetIterator(ToObject(iterable)); | 26 iter = GetIterator(iterable); |
| 27 adder = this.set; | 27 adder = this.set; |
| 28 if (!IS_SPEC_FUNCTION(adder)) { | 28 if (!IS_SPEC_FUNCTION(adder)) { |
| 29 throw MakeTypeError('property_not_function', ['set', this]); | 29 throw MakeTypeError('property_not_function', ['set', this]); |
| 30 } | 30 } |
| 31 } | 31 } |
| 32 | 32 |
| 33 %WeakCollectionInitialize(this); | 33 %WeakCollectionInitialize(this); |
| 34 | 34 |
| 35 if (IS_UNDEFINED(iter)) return; | 35 if (IS_UNDEFINED(iter)) return; |
| 36 | 36 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 // Harmony WeakSet | 123 // Harmony WeakSet |
| 124 | 124 |
| 125 function WeakSetConstructor(iterable) { | 125 function WeakSetConstructor(iterable) { |
| 126 if (!%_IsConstructCall()) { | 126 if (!%_IsConstructCall()) { |
| 127 throw MakeTypeError('constructor_not_function', ['WeakSet']); | 127 throw MakeTypeError('constructor_not_function', ['WeakSet']); |
| 128 } | 128 } |
| 129 | 129 |
| 130 var iter, adder; | 130 var iter, adder; |
| 131 | 131 |
| 132 if (!IS_NULL_OR_UNDEFINED(iterable)) { | 132 if (!IS_NULL_OR_UNDEFINED(iterable)) { |
| 133 iter = GetIterator(ToObject(iterable)); | 133 iter = GetIterator(iterable); |
| 134 adder = this.add; | 134 adder = this.add; |
| 135 if (!IS_SPEC_FUNCTION(adder)) { | 135 if (!IS_SPEC_FUNCTION(adder)) { |
| 136 throw MakeTypeError('property_not_function', ['add', this]); | 136 throw MakeTypeError('property_not_function', ['add', this]); |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 | 139 |
| 140 %WeakCollectionInitialize(this); | 140 %WeakCollectionInitialize(this); |
| 141 | 141 |
| 142 if (IS_UNDEFINED(iter)) return; | 142 if (IS_UNDEFINED(iter)) return; |
| 143 | 143 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 200 |
| 201 // Set up the non-enumerable functions on the WeakSet prototype object. | 201 // Set up the non-enumerable functions on the WeakSet prototype object. |
| 202 InstallFunctions($WeakSet.prototype, DONT_ENUM, $Array( | 202 InstallFunctions($WeakSet.prototype, DONT_ENUM, $Array( |
| 203 "add", WeakSetAdd, | 203 "add", WeakSetAdd, |
| 204 "has", WeakSetHas, | 204 "has", WeakSetHas, |
| 205 "delete", WeakSetDelete | 205 "delete", WeakSetDelete |
| 206 )); | 206 )); |
| 207 } | 207 } |
| 208 | 208 |
| 209 SetUpWeakSet(); | 209 SetUpWeakSet(); |
| OLD | NEW |