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

Unified Diff: src/weakmap.js

Issue 7658008: Fix issue with prototype of WeakMap constructor. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added more regression tests. Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/harmony/weakmaps.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/weakmap.js
diff --git a/src/weakmap.js b/src/weakmap.js
index 15056c7f8226588fa99a0b827a047c8253f134ee..70210b98de2d110b7781284ae20bf954d0c86993 100644
--- a/src/weakmap.js
+++ b/src/weakmap.js
@@ -33,14 +33,13 @@ const $WeakMap = global.WeakMap;
// -------------------------------------------------------------------
-// Set the WeakMap function and constructor.
-%SetCode($WeakMap, function(x) {
+function WeakMapConstructor() {
if (%_IsConstructCall()) {
%WeakMapInitialize(this);
} else {
return new $WeakMap();
}
-});
+}
function WeakMapGet(key) {
@@ -82,6 +81,12 @@ function WeakMapDelete(key) {
// -------------------------------------------------------------------
function SetupWeakMap() {
+ // Setup the WeakMap constructor function.
+ %SetCode($WeakMap, WeakMapConstructor);
+
+ // Setup the WeakMap prototype object.
+ %FunctionSetPrototype($WeakMap, new $WeakMap());
+
// Setup the non-enumerable functions on the WeakMap prototype object.
InstallFunctionsOnHiddenPrototype($WeakMap.prototype, DONT_ENUM, $Array(
"get", WeakMapGet,
« no previous file with comments | « no previous file | test/mjsunit/harmony/weakmaps.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698