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

Unified Diff: src/collection.js

Issue 1067903004: Simplify collections.js now that it's wrapped in an IIFE (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/templates.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/collection.js
diff --git a/src/collection.js b/src/collection.js
index 537dbd69cbb5ecb1ef0905d05f6636484cbce88b..928670c3ae39c6c99e3baaee220ff3f8b2dfdf7d 100644
--- a/src/collection.js
+++ b/src/collection.js
@@ -12,13 +12,10 @@ var $Set = global.Set;
var $Map = global.Map;
-// Used by harmony-templates.js
-var $MapGet;
-var $MapSet;
-
-
(function() {
+%CheckIsBootstrapping();
+
function HashToEntry(table, hash, numBuckets) {
var bucket = ORDERED_HASH_TABLE_HASH_TO_BUCKET(hash, numBuckets);
@@ -238,31 +235,23 @@ function SetForEach(f, receiver) {
}
-// -------------------------------------------------------------------
+%SetCode($Set, SetConstructor);
+%FunctionSetPrototype($Set, new $Object());
+%AddNamedProperty($Set.prototype, "constructor", $Set, DONT_ENUM);
+%AddNamedProperty(
+ $Set.prototype, symbolToStringTag, "Set", DONT_ENUM | READ_ONLY);
-function SetUpSet() {
- %CheckIsBootstrapping();
-
- %SetCode($Set, SetConstructor);
- %FunctionSetPrototype($Set, new $Object());
- %AddNamedProperty($Set.prototype, "constructor", $Set, DONT_ENUM);
- %AddNamedProperty(
- $Set.prototype, symbolToStringTag, "Set", DONT_ENUM | READ_ONLY);
-
- %FunctionSetLength(SetForEach, 1);
-
- // Set up the non-enumerable functions on the Set prototype object.
- InstallGetter($Set.prototype, "size", SetGetSize);
- InstallFunctions($Set.prototype, DONT_ENUM, $Array(
- "add", SetAdd,
- "has", SetHas,
- "delete", SetDelete,
- "clear", SetClearJS,
- "forEach", SetForEach
- ));
-}
+%FunctionSetLength(SetForEach, 1);
-SetUpSet();
+// Set up the non-enumerable functions on the Set prototype object.
+InstallGetter($Set.prototype, "size", SetGetSize);
+InstallFunctions($Set.prototype, DONT_ENUM, $Array(
+ "add", SetAdd,
+ "has", SetHas,
+ "delete", SetDelete,
+ "clear", SetClearJS,
+ "forEach", SetForEach
+));
// -------------------------------------------------------------------
@@ -434,34 +423,23 @@ function MapForEach(f, receiver) {
}
-// -------------------------------------------------------------------
-
-function SetUpMap() {
- %CheckIsBootstrapping();
-
- %SetCode($Map, MapConstructor);
- %FunctionSetPrototype($Map, new $Object());
- %AddNamedProperty($Map.prototype, "constructor", $Map, DONT_ENUM);
- %AddNamedProperty(
- $Map.prototype, symbolToStringTag, "Map", DONT_ENUM | READ_ONLY);
-
- %FunctionSetLength(MapForEach, 1);
-
- // Set up the non-enumerable functions on the Map prototype object.
- InstallGetter($Map.prototype, "size", MapGetSize);
- InstallFunctions($Map.prototype, DONT_ENUM, $Array(
- "get", MapGet,
- "set", MapSet,
- "has", MapHas,
- "delete", MapDelete,
- "clear", MapClearJS,
- "forEach", MapForEach
- ));
-
- $MapGet = MapGet;
- $MapSet = MapSet;
-}
-
-SetUpMap();
+%SetCode($Map, MapConstructor);
+%FunctionSetPrototype($Map, new $Object());
+%AddNamedProperty($Map.prototype, "constructor", $Map, DONT_ENUM);
+%AddNamedProperty(
+ $Map.prototype, symbolToStringTag, "Map", DONT_ENUM | READ_ONLY);
+
+%FunctionSetLength(MapForEach, 1);
+
+// Set up the non-enumerable functions on the Map prototype object.
+InstallGetter($Map.prototype, "size", MapGetSize);
+InstallFunctions($Map.prototype, DONT_ENUM, $Array(
+ "get", MapGet,
+ "set", MapSet,
+ "has", MapHas,
+ "delete", MapDelete,
+ "clear", MapClearJS,
+ "forEach", MapForEach
+));
})();
« no previous file with comments | « no previous file | src/templates.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698