| 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; | |
| 6 var $getExistingHash; | |
| 7 | |
| 8 (function(global, utils) { | 5 (function(global, utils) { |
| 9 "use strict"; | 6 "use strict"; |
| 10 | 7 |
| 11 %CheckIsBootstrapping(); | 8 %CheckIsBootstrapping(); |
| 12 | 9 |
| 13 // ------------------------------------------------------------------- | 10 // ------------------------------------------------------------------- |
| 14 // Imports | 11 // Imports |
| 15 | 12 |
| 16 var GlobalMap = global.Map; | 13 var GlobalMap = global.Map; |
| 17 var GlobalObject = global.Object; | 14 var GlobalObject = global.Object; |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 utils.InstallGetter(GlobalMap.prototype, "size", MapGetSize); | 452 utils.InstallGetter(GlobalMap.prototype, "size", MapGetSize); |
| 456 utils.InstallFunctions(GlobalMap.prototype, DONT_ENUM, [ | 453 utils.InstallFunctions(GlobalMap.prototype, DONT_ENUM, [ |
| 457 "get", MapGet, | 454 "get", MapGet, |
| 458 "set", MapSet, | 455 "set", MapSet, |
| 459 "has", MapHas, | 456 "has", MapHas, |
| 460 "delete", MapDelete, | 457 "delete", MapDelete, |
| 461 "clear", MapClearJS, | 458 "clear", MapClearJS, |
| 462 "forEach", MapForEach | 459 "forEach", MapForEach |
| 463 ]); | 460 ]); |
| 464 | 461 |
| 465 // Expose to the global scope. | |
| 466 $getHash = GetHash; | |
| 467 $getExistingHash = GetExistingHash; | |
| 468 | |
| 469 function MapFromArray(array) { | 462 function MapFromArray(array) { |
| 470 var map = new GlobalMap; | 463 var map = new GlobalMap; |
| 471 var length = array.length; | 464 var length = array.length; |
| 472 for (var i = 0; i < length; i += 2) { | 465 for (var i = 0; i < length; i += 2) { |
| 473 var key = array[i]; | 466 var key = array[i]; |
| 474 var value = array[i + 1]; | 467 var value = array[i + 1]; |
| 475 %_Call(MapSet, map, key, value); | 468 %_Call(MapSet, map, key, value); |
| 476 } | 469 } |
| 477 return map; | 470 return map; |
| 478 }; | 471 }; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 494 "map_set", MapSet, | 487 "map_set", MapSet, |
| 495 "map_has", MapHas, | 488 "map_has", MapHas, |
| 496 "map_delete", MapDelete, | 489 "map_delete", MapDelete, |
| 497 "set_add", SetAdd, | 490 "set_add", SetAdd, |
| 498 "set_has", SetHas, | 491 "set_has", SetHas, |
| 499 "set_delete", SetDelete, | 492 "set_delete", SetDelete, |
| 500 "map_from_array", MapFromArray, | 493 "map_from_array", MapFromArray, |
| 501 "set_from_array",SetFromArray, | 494 "set_from_array",SetFromArray, |
| 502 ]); | 495 ]); |
| 503 | 496 |
| 497 utils.Export(function(to) { |
| 498 to.GetExistingHash = GetExistingHash; |
| 499 to.GetHash = GetHash; |
| 500 }); |
| 501 |
| 504 }) | 502 }) |
| OLD | NEW |