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

Unified Diff: src/js/weak-collection.js

Issue 1404943002: Use import/export for more functions (instead of js builtins object). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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 | « src/js/v8natives.js ('k') | src/third_party/fdlibm/fdlibm.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/weak-collection.js
diff --git a/src/js/weak-collection.js b/src/js/weak-collection.js
index 1c60a2f47a695b19f69b2ea4fc2c1a1486b9002e..f729cb3d6f861c80b9b0a368c4b1b11294c24ec9 100644
--- a/src/js/weak-collection.js
+++ b/src/js/weak-collection.js
@@ -8,11 +8,21 @@
%CheckIsBootstrapping();
+// -------------------------------------------------------------------
+// Imports
+
+var GetExistingHash;
+var GetHash;
var GlobalObject = global.Object;
var GlobalWeakMap = global.WeakMap;
var GlobalWeakSet = global.WeakSet;
var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
+utils.Import(function(from) {
+ GetExistingHash = from.GetExistingHash;
+ GetHash = from.GetHash;
+});
+
// -------------------------------------------------------------------
// Harmony WeakMap
@@ -44,7 +54,7 @@ function WeakMapGet(key) {
'WeakMap.prototype.get', this);
}
if (!IS_SPEC_OBJECT(key)) return UNDEFINED;
- var hash = $getExistingHash(key);
+ var hash = GetExistingHash(key);
if (IS_UNDEFINED(hash)) return UNDEFINED;
return %WeakCollectionGet(this, key, hash);
}
@@ -56,7 +66,7 @@ function WeakMapSet(key, value) {
'WeakMap.prototype.set', this);
}
if (!IS_SPEC_OBJECT(key)) throw MakeTypeError(kInvalidWeakMapKey);
- return %WeakCollectionSet(this, key, value, $getHash(key));
+ return %WeakCollectionSet(this, key, value, GetHash(key));
}
@@ -66,7 +76,7 @@ function WeakMapHas(key) {
'WeakMap.prototype.has', this);
}
if (!IS_SPEC_OBJECT(key)) return false;
- var hash = $getExistingHash(key);
+ var hash = GetExistingHash(key);
if (IS_UNDEFINED(hash)) return false;
return %WeakCollectionHas(this, key, hash);
}
@@ -78,7 +88,7 @@ function WeakMapDelete(key) {
'WeakMap.prototype.delete', this);
}
if (!IS_SPEC_OBJECT(key)) return false;
- var hash = $getExistingHash(key);
+ var hash = GetExistingHash(key);
if (IS_UNDEFINED(hash)) return false;
return %WeakCollectionDelete(this, key, hash);
}
@@ -130,7 +140,7 @@ function WeakSetAdd(value) {
'WeakSet.prototype.add', this);
}
if (!IS_SPEC_OBJECT(value)) throw MakeTypeError(kInvalidWeakSetValue);
- return %WeakCollectionSet(this, value, true, $getHash(value));
+ return %WeakCollectionSet(this, value, true, GetHash(value));
}
@@ -140,7 +150,7 @@ function WeakSetHas(value) {
'WeakSet.prototype.has', this);
}
if (!IS_SPEC_OBJECT(value)) return false;
- var hash = $getExistingHash(value);
+ var hash = GetExistingHash(value);
if (IS_UNDEFINED(hash)) return false;
return %WeakCollectionHas(this, value, hash);
}
@@ -152,7 +162,7 @@ function WeakSetDelete(value) {
'WeakSet.prototype.delete', this);
}
if (!IS_SPEC_OBJECT(value)) return false;
- var hash = $getExistingHash(value);
+ var hash = GetExistingHash(value);
if (IS_UNDEFINED(hash)) return false;
return %WeakCollectionDelete(this, value, hash);
}
« no previous file with comments | « src/js/v8natives.js ('k') | src/third_party/fdlibm/fdlibm.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698