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 $mapFromArray; | |
6 var $setFromArray; | |
7 | |
5 (function(global, shared, exports) { | 8 (function(global, shared, exports) { |
6 | 9 |
7 "use strict"; | 10 "use strict"; |
8 | 11 |
9 %CheckIsBootstrapping(); | 12 %CheckIsBootstrapping(); |
10 | 13 |
11 var GlobalMap = global.Map; | 14 var GlobalMap = global.Map; |
12 var GlobalObject = global.Object; | 15 var GlobalObject = global.Object; |
13 var GlobalSet = global.Set; | 16 var GlobalSet = global.Set; |
14 | 17 |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
430 $installGetter(GlobalMap.prototype, "size", MapGetSize); | 433 $installGetter(GlobalMap.prototype, "size", MapGetSize); |
431 $installFunctions(GlobalMap.prototype, DONT_ENUM, [ | 434 $installFunctions(GlobalMap.prototype, DONT_ENUM, [ |
432 "get", MapGet, | 435 "get", MapGet, |
433 "set", MapSet, | 436 "set", MapSet, |
434 "has", MapHas, | 437 "has", MapHas, |
435 "delete", MapDelete, | 438 "delete", MapDelete, |
436 "clear", MapClearJS, | 439 "clear", MapClearJS, |
437 "forEach", MapForEach | 440 "forEach", MapForEach |
438 ]); | 441 ]); |
439 | 442 |
443 $mapFromArray = function(array) { | |
444 var map = new GlobalMap; | |
445 var length = array.length; | |
446 for (var i = 0; i < length; ++i) { | |
447 var entry = array[i]; | |
448 %_CallFunction(map, entry[0], entry[1], MapSet); | |
449 } | |
450 return map; | |
451 } | |
arv (Not doing code reviews)
2015/05/26 16:37:40
;
adamk
2015/05/26 17:27:45
Done.
| |
452 | |
453 $setFromArray = function(array) { | |
454 var set = new GlobalSet; | |
455 var length = array.length; | |
456 for (var i = 0; i < length; ++i) { | |
457 %_CallFunction(set, array[i], SetAdd); | |
458 } | |
459 return set; | |
460 } | |
arv (Not doing code reviews)
2015/05/26 16:37:40
;
adamk
2015/05/26 17:27:45
Done.
| |
461 | |
440 }) | 462 }) |
OLD | NEW |