| 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 (function(global, utils) { | 5 (function(global, utils) { |
| 6 | 6 |
| 7 "use strict"; | 7 "use strict"; |
| 8 | 8 |
| 9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 if (!IS_NULL_OR_UNDEFINED(iterable)) { | 26 if (!IS_NULL_OR_UNDEFINED(iterable)) { |
| 27 var adder = this.set; | 27 var adder = this.set; |
| 28 if (!IS_CALLABLE(adder)) { | 28 if (!IS_CALLABLE(adder)) { |
| 29 throw MakeTypeError(kPropertyNotFunction, 'set', this); | 29 throw MakeTypeError(kPropertyNotFunction, 'set', this); |
| 30 } | 30 } |
| 31 for (var nextItem of iterable) { | 31 for (var nextItem of iterable) { |
| 32 if (!IS_SPEC_OBJECT(nextItem)) { | 32 if (!IS_SPEC_OBJECT(nextItem)) { |
| 33 throw MakeTypeError(kIteratorValueNotAnObject, nextItem); | 33 throw MakeTypeError(kIteratorValueNotAnObject, nextItem); |
| 34 } | 34 } |
| 35 %_CallFunction(this, nextItem[0], nextItem[1], adder); | 35 %_Call(adder, this, nextItem[0], nextItem[1]); |
| 36 } | 36 } |
| 37 } | 37 } |
| 38 } | 38 } |
| 39 | 39 |
| 40 | 40 |
| 41 function WeakMapGet(key) { | 41 function WeakMapGet(key) { |
| 42 if (!IS_WEAKMAP(this)) { | 42 if (!IS_WEAKMAP(this)) { |
| 43 throw MakeTypeError(kIncompatibleMethodReceiver, | 43 throw MakeTypeError(kIncompatibleMethodReceiver, |
| 44 'WeakMap.prototype.get', this); | 44 'WeakMap.prototype.get', this); |
| 45 } | 45 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 } | 111 } |
| 112 | 112 |
| 113 %WeakCollectionInitialize(this); | 113 %WeakCollectionInitialize(this); |
| 114 | 114 |
| 115 if (!IS_NULL_OR_UNDEFINED(iterable)) { | 115 if (!IS_NULL_OR_UNDEFINED(iterable)) { |
| 116 var adder = this.add; | 116 var adder = this.add; |
| 117 if (!IS_CALLABLE(adder)) { | 117 if (!IS_CALLABLE(adder)) { |
| 118 throw MakeTypeError(kPropertyNotFunction, 'add', this); | 118 throw MakeTypeError(kPropertyNotFunction, 'add', this); |
| 119 } | 119 } |
| 120 for (var value of iterable) { | 120 for (var value of iterable) { |
| 121 %_CallFunction(this, value, adder); | 121 %_Call(adder, this, value); |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 | 125 |
| 126 | 126 |
| 127 function WeakSetAdd(value) { | 127 function WeakSetAdd(value) { |
| 128 if (!IS_WEAKSET(this)) { | 128 if (!IS_WEAKSET(this)) { |
| 129 throw MakeTypeError(kIncompatibleMethodReceiver, | 129 throw MakeTypeError(kIncompatibleMethodReceiver, |
| 130 'WeakSet.prototype.add', this); | 130 'WeakSet.prototype.add', this); |
| 131 } | 131 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 DONT_ENUM | READ_ONLY); | 169 DONT_ENUM | READ_ONLY); |
| 170 | 170 |
| 171 // Set up the non-enumerable functions on the WeakSet prototype object. | 171 // Set up the non-enumerable functions on the WeakSet prototype object. |
| 172 utils.InstallFunctions(GlobalWeakSet.prototype, DONT_ENUM, [ | 172 utils.InstallFunctions(GlobalWeakSet.prototype, DONT_ENUM, [ |
| 173 "add", WeakSetAdd, | 173 "add", WeakSetAdd, |
| 174 "has", WeakSetHas, | 174 "has", WeakSetHas, |
| 175 "delete", WeakSetDelete | 175 "delete", WeakSetDelete |
| 176 ]); | 176 ]); |
| 177 | 177 |
| 178 }) | 178 }) |
| OLD | NEW |