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 var $mapSet; |
| 8 var $mapHas; |
| 9 var $mapDelete; |
| 10 var $setAdd; |
| 11 var $setHas; |
| 12 var $setDelete; |
7 var $mapFromArray; | 13 var $mapFromArray; |
8 var $setFromArray; | 14 var $setFromArray; |
9 | 15 |
10 (function(global, utils) { | 16 (function(global, utils) { |
11 "use strict"; | 17 "use strict"; |
12 | 18 |
13 %CheckIsBootstrapping(); | 19 %CheckIsBootstrapping(); |
14 | 20 |
15 // ------------------------------------------------------------------- | 21 // ------------------------------------------------------------------- |
16 // Imports | 22 // Imports |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 "set", MapSet, | 480 "set", MapSet, |
475 "has", MapHas, | 481 "has", MapHas, |
476 "delete", MapDelete, | 482 "delete", MapDelete, |
477 "clear", MapClearJS, | 483 "clear", MapClearJS, |
478 "forEach", MapForEach | 484 "forEach", MapForEach |
479 ]); | 485 ]); |
480 | 486 |
481 // Expose to the global scope. | 487 // Expose to the global scope. |
482 $getHash = GetHash; | 488 $getHash = GetHash; |
483 $getExistingHash = GetExistingHash; | 489 $getExistingHash = GetExistingHash; |
| 490 $mapGet = MapGet; |
| 491 $mapSet = MapSet; |
| 492 $mapHas = MapHas; |
| 493 $mapDelete = MapDelete; |
| 494 $setAdd = SetAdd; |
| 495 $setHas = SetHas; |
| 496 $setDelete = SetDelete; |
484 | 497 |
485 $mapFromArray = function(array) { | 498 $mapFromArray = function(array) { |
486 var map = new GlobalMap; | 499 var map = new GlobalMap; |
487 var length = array.length; | 500 var length = array.length; |
488 for (var i = 0; i < length; i += 2) { | 501 for (var i = 0; i < length; i += 2) { |
489 var key = array[i]; | 502 var key = array[i]; |
490 var value = array[i + 1]; | 503 var value = array[i + 1]; |
491 %_CallFunction(map, key, value, MapSet); | 504 %_CallFunction(map, key, value, MapSet); |
492 } | 505 } |
493 return map; | 506 return map; |
494 }; | 507 }; |
495 | 508 |
496 $setFromArray = function(array) { | 509 $setFromArray = function(array) { |
497 var set = new GlobalSet; | 510 var set = new GlobalSet; |
498 var length = array.length; | 511 var length = array.length; |
499 for (var i = 0; i < length; ++i) { | 512 for (var i = 0; i < length; ++i) { |
500 %_CallFunction(set, array[i], SetAdd); | 513 %_CallFunction(set, array[i], SetAdd); |
501 } | 514 } |
502 return set; | 515 return set; |
503 }; | 516 }; |
504 | 517 |
505 }) | 518 }) |
OLD | NEW |