Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/collection.js

Issue 1293493003: Do not export natives to runtime via js builtins object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/bootstrapper.cc ('k') | src/date.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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;
13 var $mapFromArray;
14 var $setFromArray;
15 7
16 (function(global, utils) { 8 (function(global, utils) {
17 "use strict"; 9 "use strict";
18 10
19 %CheckIsBootstrapping(); 11 %CheckIsBootstrapping();
20 12
21 // ------------------------------------------------------------------- 13 // -------------------------------------------------------------------
22 // Imports 14 // Imports
23 15
24 var GlobalMap = global.Map; 16 var GlobalMap = global.Map;
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 "set", MapSet, 472 "set", MapSet,
481 "has", MapHas, 473 "has", MapHas,
482 "delete", MapDelete, 474 "delete", MapDelete,
483 "clear", MapClearJS, 475 "clear", MapClearJS,
484 "forEach", MapForEach 476 "forEach", MapForEach
485 ]); 477 ]);
486 478
487 // Expose to the global scope. 479 // Expose to the global scope.
488 $getHash = GetHash; 480 $getHash = GetHash;
489 $getExistingHash = GetExistingHash; 481 $getExistingHash = GetExistingHash;
490 $mapGet = MapGet;
491 $mapSet = MapSet;
492 $mapHas = MapHas;
493 $mapDelete = MapDelete;
494 $setAdd = SetAdd;
495 $setHas = SetHas;
496 $setDelete = SetDelete;
497 482
498 $mapFromArray = function(array) { 483 function MapFromArray(array) {
499 var map = new GlobalMap; 484 var map = new GlobalMap;
500 var length = array.length; 485 var length = array.length;
501 for (var i = 0; i < length; i += 2) { 486 for (var i = 0; i < length; i += 2) {
502 var key = array[i]; 487 var key = array[i];
503 var value = array[i + 1]; 488 var value = array[i + 1];
504 %_CallFunction(map, key, value, MapSet); 489 %_CallFunction(map, key, value, MapSet);
505 } 490 }
506 return map; 491 return map;
507 }; 492 };
508 493
509 $setFromArray = function(array) { 494 function SetFromArray(array) {
510 var set = new GlobalSet; 495 var set = new GlobalSet;
511 var length = array.length; 496 var length = array.length;
512 for (var i = 0; i < length; ++i) { 497 for (var i = 0; i < length; ++i) {
513 %_CallFunction(set, array[i], SetAdd); 498 %_CallFunction(set, array[i], SetAdd);
514 } 499 }
515 return set; 500 return set;
516 }; 501 };
517 502
503 // -----------------------------------------------------------------------
504 // Exports
505
506 utils.ExportToRuntime(function(to) {
507 to.MapGet = MapGet;
508 to.MapSet = MapSet;
509 to.MapHas = MapHas;
510 to.MapDelete = MapDelete;
511 to.SetAdd = SetAdd;
512 to.SetHas = SetHas;
513 to.SetDelete = SetDelete;
514 to.MapFromArray = MapFromArray;
515 to.SetFromArray = SetFromArray;
516 });
517
518 }) 518 })
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/date.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698