| 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 var $getHash; | 5 var $getHash; |
| 6 var $getExistingHash; | 6 var $getExistingHash; |
| 7 | 7 |
| 8 (function(global, utils) { | 8 (function(global, utils) { |
| 9 "use strict"; | 9 "use strict"; |
| 10 | 10 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 function SetConstructor(iterable) { | 127 function SetConstructor(iterable) { |
| 128 if (!%_IsConstructCall()) { | 128 if (!%_IsConstructCall()) { |
| 129 throw MakeTypeError(kConstructorNotFunction, "Set"); | 129 throw MakeTypeError(kConstructorNotFunction, "Set"); |
| 130 } | 130 } |
| 131 | 131 |
| 132 %_SetInitialize(this); | 132 %_SetInitialize(this); |
| 133 | 133 |
| 134 if (!IS_NULL_OR_UNDEFINED(iterable)) { | 134 if (!IS_NULL_OR_UNDEFINED(iterable)) { |
| 135 var adder = this.add; | 135 var adder = this.add; |
| 136 if (!IS_SPEC_FUNCTION(adder)) { | 136 if (!IS_CALLABLE(adder)) { |
| 137 throw MakeTypeError(kPropertyNotFunction, 'add', this); | 137 throw MakeTypeError(kPropertyNotFunction, 'add', this); |
| 138 } | 138 } |
| 139 | 139 |
| 140 for (var value of iterable) { | 140 for (var value of iterable) { |
| 141 %_CallFunction(this, value, adder); | 141 %_CallFunction(this, value, adder); |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 } | 144 } |
| 145 | 145 |
| 146 | 146 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 %_SetClear(this); | 237 %_SetClear(this); |
| 238 } | 238 } |
| 239 | 239 |
| 240 | 240 |
| 241 function SetForEach(f, receiver) { | 241 function SetForEach(f, receiver) { |
| 242 if (!IS_SET(this)) { | 242 if (!IS_SET(this)) { |
| 243 throw MakeTypeError(kIncompatibleMethodReceiver, | 243 throw MakeTypeError(kIncompatibleMethodReceiver, |
| 244 'Set.prototype.forEach', this); | 244 'Set.prototype.forEach', this); |
| 245 } | 245 } |
| 246 | 246 |
| 247 if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f); | 247 if (!IS_CALLABLE(f)) throw MakeTypeError(kCalledNonCallable, f); |
| 248 var needs_wrapper = false; | 248 var needs_wrapper = false; |
| 249 if (IS_NULL(receiver)) { | 249 if (IS_NULL(receiver)) { |
| 250 if (%IsSloppyModeFunction(f)) receiver = UNDEFINED; | 250 if (%IsSloppyModeFunction(f)) receiver = UNDEFINED; |
| 251 } else if (!IS_UNDEFINED(receiver)) { | 251 } else if (!IS_UNDEFINED(receiver)) { |
| 252 needs_wrapper = SHOULD_CREATE_WRAPPER(f, receiver); | 252 needs_wrapper = SHOULD_CREATE_WRAPPER(f, receiver); |
| 253 } | 253 } |
| 254 | 254 |
| 255 var iterator = new SetIterator(this, ITERATOR_KIND_VALUES); | 255 var iterator = new SetIterator(this, ITERATOR_KIND_VALUES); |
| 256 var key; | 256 var key; |
| 257 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(f); | 257 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(f); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 | 291 |
| 292 function MapConstructor(iterable) { | 292 function MapConstructor(iterable) { |
| 293 if (!%_IsConstructCall()) { | 293 if (!%_IsConstructCall()) { |
| 294 throw MakeTypeError(kConstructorNotFunction, "Map"); | 294 throw MakeTypeError(kConstructorNotFunction, "Map"); |
| 295 } | 295 } |
| 296 | 296 |
| 297 %_MapInitialize(this); | 297 %_MapInitialize(this); |
| 298 | 298 |
| 299 if (!IS_NULL_OR_UNDEFINED(iterable)) { | 299 if (!IS_NULL_OR_UNDEFINED(iterable)) { |
| 300 var adder = this.set; | 300 var adder = this.set; |
| 301 if (!IS_SPEC_FUNCTION(adder)) { | 301 if (!IS_CALLABLE(adder)) { |
| 302 throw MakeTypeError(kPropertyNotFunction, 'set', this); | 302 throw MakeTypeError(kPropertyNotFunction, 'set', this); |
| 303 } | 303 } |
| 304 | 304 |
| 305 for (var nextItem of iterable) { | 305 for (var nextItem of iterable) { |
| 306 if (!IS_SPEC_OBJECT(nextItem)) { | 306 if (!IS_SPEC_OBJECT(nextItem)) { |
| 307 throw MakeTypeError(kIteratorValueNotAnObject, nextItem); | 307 throw MakeTypeError(kIteratorValueNotAnObject, nextItem); |
| 308 } | 308 } |
| 309 %_CallFunction(this, nextItem[0], nextItem[1], adder); | 309 %_CallFunction(this, nextItem[0], nextItem[1], adder); |
| 310 } | 310 } |
| 311 } | 311 } |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 %_MapClear(this); | 428 %_MapClear(this); |
| 429 } | 429 } |
| 430 | 430 |
| 431 | 431 |
| 432 function MapForEach(f, receiver) { | 432 function MapForEach(f, receiver) { |
| 433 if (!IS_MAP(this)) { | 433 if (!IS_MAP(this)) { |
| 434 throw MakeTypeError(kIncompatibleMethodReceiver, | 434 throw MakeTypeError(kIncompatibleMethodReceiver, |
| 435 'Map.prototype.forEach', this); | 435 'Map.prototype.forEach', this); |
| 436 } | 436 } |
| 437 | 437 |
| 438 if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f); | 438 if (!IS_CALLABLE(f)) throw MakeTypeError(kCalledNonCallable, f); |
| 439 var needs_wrapper = false; | 439 var needs_wrapper = false; |
| 440 if (IS_NULL(receiver)) { | 440 if (IS_NULL(receiver)) { |
| 441 if (%IsSloppyModeFunction(f)) receiver = UNDEFINED; | 441 if (%IsSloppyModeFunction(f)) receiver = UNDEFINED; |
| 442 } else if (!IS_UNDEFINED(receiver)) { | 442 } else if (!IS_UNDEFINED(receiver)) { |
| 443 needs_wrapper = SHOULD_CREATE_WRAPPER(f, receiver); | 443 needs_wrapper = SHOULD_CREATE_WRAPPER(f, receiver); |
| 444 } | 444 } |
| 445 | 445 |
| 446 var iterator = new MapIterator(this, ITERATOR_KIND_ENTRIES); | 446 var iterator = new MapIterator(this, ITERATOR_KIND_ENTRIES); |
| 447 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(f); | 447 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(f); |
| 448 var value_array = [UNDEFINED, UNDEFINED]; | 448 var value_array = [UNDEFINED, UNDEFINED]; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 "map_has", MapHas, | 508 "map_has", MapHas, |
| 509 "map_delete", MapDelete, | 509 "map_delete", MapDelete, |
| 510 "set_add", SetAdd, | 510 "set_add", SetAdd, |
| 511 "set_has", SetHas, | 511 "set_has", SetHas, |
| 512 "set_delete", SetDelete, | 512 "set_delete", SetDelete, |
| 513 "map_from_array", MapFromArray, | 513 "map_from_array", MapFromArray, |
| 514 "set_from_array",SetFromArray, | 514 "set_from_array",SetFromArray, |
| 515 ]); | 515 ]); |
| 516 | 516 |
| 517 }) | 517 }) |
| OLD | NEW |