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 "use strict"; | 6 "use strict"; |
7 | 7 |
8 %CheckIsBootstrapping(); | 8 %CheckIsBootstrapping(); |
9 | 9 |
10 // ------------------------------------------------------------------- | 10 // ------------------------------------------------------------------- |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_CALLABLE(f)) throw MakeTypeError(kCalledNonCallable, f); | 247 if (!IS_CALLABLE(f)) throw MakeTypeError(kCalledNonCallable, f); |
248 | 248 |
249 var iterator = new SetIterator(this, ITERATOR_KIND_VALUES); | 249 var iterator = new SetIterator(this, ITERATOR_KIND_VALUES); |
250 var key; | 250 var key; |
251 var stepping = DEBUG_IS_STEPPING(f); | |
252 var value_array = [UNDEFINED]; | 251 var value_array = [UNDEFINED]; |
253 while (%SetIteratorNext(iterator, value_array)) { | 252 while (%SetIteratorNext(iterator, value_array)) { |
254 if (stepping) %DebugPrepareStepInIfStepping(f); | |
255 key = value_array[0]; | 253 key = value_array[0]; |
256 %_Call(f, receiver, key, key, this); | 254 %_Call(f, receiver, key, key, this); |
257 } | 255 } |
258 } | 256 } |
259 | 257 |
260 // ------------------------------------------------------------------- | 258 // ------------------------------------------------------------------- |
261 | 259 |
262 %SetCode(GlobalSet, SetConstructor); | 260 %SetCode(GlobalSet, SetConstructor); |
263 %FunctionSetLength(GlobalSet, 0); | 261 %FunctionSetLength(GlobalSet, 0); |
264 %FunctionSetPrototype(GlobalSet, new GlobalObject()); | 262 %FunctionSetPrototype(GlobalSet, new GlobalObject()); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 | 422 |
425 function MapForEach(f, receiver) { | 423 function MapForEach(f, receiver) { |
426 if (!IS_MAP(this)) { | 424 if (!IS_MAP(this)) { |
427 throw MakeTypeError(kIncompatibleMethodReceiver, | 425 throw MakeTypeError(kIncompatibleMethodReceiver, |
428 'Map.prototype.forEach', this); | 426 'Map.prototype.forEach', this); |
429 } | 427 } |
430 | 428 |
431 if (!IS_CALLABLE(f)) throw MakeTypeError(kCalledNonCallable, f); | 429 if (!IS_CALLABLE(f)) throw MakeTypeError(kCalledNonCallable, f); |
432 | 430 |
433 var iterator = new MapIterator(this, ITERATOR_KIND_ENTRIES); | 431 var iterator = new MapIterator(this, ITERATOR_KIND_ENTRIES); |
434 var stepping = DEBUG_IS_STEPPING(f); | |
435 var value_array = [UNDEFINED, UNDEFINED]; | 432 var value_array = [UNDEFINED, UNDEFINED]; |
436 while (%MapIteratorNext(iterator, value_array)) { | 433 while (%MapIteratorNext(iterator, value_array)) { |
437 if (stepping) %DebugPrepareStepInIfStepping(f); | |
438 %_Call(f, receiver, value_array[1], value_array[0], this); | 434 %_Call(f, receiver, value_array[1], value_array[0], this); |
439 } | 435 } |
440 } | 436 } |
441 | 437 |
442 // ------------------------------------------------------------------- | 438 // ------------------------------------------------------------------- |
443 | 439 |
444 %SetCode(GlobalMap, MapConstructor); | 440 %SetCode(GlobalMap, MapConstructor); |
445 %FunctionSetLength(GlobalMap, 0); | 441 %FunctionSetLength(GlobalMap, 0); |
446 %FunctionSetPrototype(GlobalMap, new GlobalObject()); | 442 %FunctionSetPrototype(GlobalMap, new GlobalObject()); |
447 %AddNamedProperty(GlobalMap.prototype, "constructor", GlobalMap, DONT_ENUM); | 443 %AddNamedProperty(GlobalMap.prototype, "constructor", GlobalMap, DONT_ENUM); |
(...skipping 25 matching lines...) Expand all Loading... |
473 "set_has", SetHas, | 469 "set_has", SetHas, |
474 "set_delete", SetDelete, | 470 "set_delete", SetDelete, |
475 ]); | 471 ]); |
476 | 472 |
477 utils.Export(function(to) { | 473 utils.Export(function(to) { |
478 to.GetExistingHash = GetExistingHash; | 474 to.GetExistingHash = GetExistingHash; |
479 to.GetHash = GetHash; | 475 to.GetHash = GetHash; |
480 }); | 476 }); |
481 | 477 |
482 }) | 478 }) |
OLD | NEW |