Reviewers: rossberg,

Message:
PTAL.

Description:
Fix parent of the WeakMap prototype.

[email protected]
BUG=v8:1565
TEST=mjsunit/harmony/weakmaps


Please review this at http://codereview.chromium.org/7890003/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/bootstrapper.cc
  M test/mjsunit/harmony/weakmaps.js


Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index f07e625ec01956ede51834e8616a1e4160e70c84..3ed334c1e208c73aba2bca03bcffa4ea981009b7 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1204,10 +1204,9 @@ void Genesis::InitializeExperimentalGlobal() {
   // TODO(mstarzinger): Move this into Genesis::InitializeGlobal once we no
// longer need to live behind a flag, so WeakMap gets added to the snapshot.
   if (FLAG_harmony_weakmaps) {  // -- W e a k M a p
-    Handle<JSObject> prototype =
-        factory()->NewJSObject(isolate()->object_function(), TENURED);
     InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize,
-                    prototype, Builtins::kIllegal, true);
+                    isolate_->initial_object_prototype(),
+                    Builtins::kIllegal, true);
   }
 }

Index: test/mjsunit/harmony/weakmaps.js
diff --git a/test/mjsunit/harmony/weakmaps.js b/test/mjsunit/harmony/weakmaps.js index e43f9167e641b72ca4e440d211fd85bee367e9a0..4e806cdf0ae691c96103527b512b167e4fcd1e78 100644
--- a/test/mjsunit/harmony/weakmaps.js
+++ b/test/mjsunit/harmony/weakmaps.js
@@ -157,6 +157,11 @@ var o = Object.create({}, { myValue: {
 assertEquals(10, o.myValue);


+// Regression test: The parent of the WeakMap prototype is supposed to be the
+// Object prototype.
+assertTrue(Object.getPrototypeOf(WeakMap.prototype) === Object.prototype)
+
+
 // Stress Test
 // There is a proposed stress-test available at the es-discuss mailing list
 // which cannot be reasonably automated.  Check it out by hand if you like:


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to