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

Side by Side Diff: src/js/collection.js

Issue 1456923003: [api] Remove deprecated and unused Set/Map::FromArray (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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/contexts.h ('k') | no next file » | 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 (function(global, utils) { 5 (function(global, utils) {
6 "use strict"; 6 "use strict";
7 7
8 %CheckIsBootstrapping(); 8 %CheckIsBootstrapping();
9 9
10 // ------------------------------------------------------------------- 10 // -------------------------------------------------------------------
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 utils.InstallGetter(GlobalMap.prototype, "size", MapGetSize); 454 utils.InstallGetter(GlobalMap.prototype, "size", MapGetSize);
455 utils.InstallFunctions(GlobalMap.prototype, DONT_ENUM, [ 455 utils.InstallFunctions(GlobalMap.prototype, DONT_ENUM, [
456 "get", MapGet, 456 "get", MapGet,
457 "set", MapSet, 457 "set", MapSet,
458 "has", MapHas, 458 "has", MapHas,
459 "delete", MapDelete, 459 "delete", MapDelete,
460 "clear", MapClearJS, 460 "clear", MapClearJS,
461 "forEach", MapForEach 461 "forEach", MapForEach
462 ]); 462 ]);
463 463
464 function MapFromArray(array) {
465 var map = new GlobalMap;
466 var length = array.length;
467 for (var i = 0; i < length; i += 2) {
468 var key = array[i];
469 var value = array[i + 1];
470 %_Call(MapSet, map, key, value);
471 }
472 return map;
473 };
474
475 function SetFromArray(array) {
476 var set = new GlobalSet;
477 var length = array.length;
478 for (var i = 0; i < length; ++i) {
479 %_Call(SetAdd, set, array[i]);
480 }
481 return set;
482 };
483
484 // ----------------------------------------------------------------------- 464 // -----------------------------------------------------------------------
485 // Exports 465 // Exports
486 466
487 %InstallToContext([ 467 %InstallToContext([
488 "map_get", MapGet, 468 "map_get", MapGet,
489 "map_set", MapSet, 469 "map_set", MapSet,
490 "map_has", MapHas, 470 "map_has", MapHas,
491 "map_delete", MapDelete, 471 "map_delete", MapDelete,
492 "set_add", SetAdd, 472 "set_add", SetAdd,
493 "set_has", SetHas, 473 "set_has", SetHas,
494 "set_delete", SetDelete, 474 "set_delete", SetDelete,
495 "map_from_array", MapFromArray,
496 "set_from_array",SetFromArray,
497 ]); 475 ]);
498 476
499 utils.Export(function(to) { 477 utils.Export(function(to) {
500 to.GetExistingHash = GetExistingHash; 478 to.GetExistingHash = GetExistingHash;
501 to.GetHash = GetHash; 479 to.GetHash = GetHash;
502 }); 480 });
503 481
504 }) 482 })
OLDNEW
« no previous file with comments | « src/contexts.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698