Revision: 14229
Author:   rossb...@chromium.org
Date:     Thu Apr 11 05:27:55 2013
Log:      Fix set-up of intrinsic's 'constructor' properties

Looks so easy...

R=mstarzin...@chromium.org
BUG=229445

Review URL: https://codereview.chromium.org/13880007
http://code.google.com/p/v8/source/detail?r=14229

Modified:
 /branches/bleeding_edge/src/factory.cc
 /branches/bleeding_edge/src/v8natives.js
 /branches/bleeding_edge/test/mjsunit/harmony/symbols.js

=======================================
--- /branches/bleeding_edge/src/factory.cc      Fri Mar 15 05:06:53 2013
+++ /branches/bleeding_edge/src/factory.cc      Thu Apr 11 05:27:55 2013
@@ -874,14 +874,7 @@
     initial_map->set_constructor(*function);
   }

-  // Set function.prototype and give the prototype a constructor
-  // property that refers to the function.
   SetPrototypeProperty(function, prototype);
-  // Currently safe because it is only invoked from Genesis.
-  CHECK_NOT_EMPTY_HANDLE(isolate(),
-                         JSObject::SetLocalPropertyIgnoreAttributes(
-                             prototype, constructor_string(),
-                             function, DONT_ENUM));
   return function;
 }

=======================================
--- /branches/bleeding_edge/src/v8natives.js    Thu Apr 11 05:15:25 2013
+++ /branches/bleeding_edge/src/v8natives.js    Thu Apr 11 05:27:55 2013
@@ -1356,12 +1356,13 @@
 function SetUpObject() {
   %CheckIsBootstrapping();

-  $Object.prototype.constructor = $Object;
   %SetCode($Object, ObjectConstructor);
   %FunctionSetName(ObjectPoisonProto, "__proto__");
   %FunctionRemovePrototype(ObjectPoisonProto);
   %SetExpectedNumberOfProperties($Object, 4);

+  %SetProperty($Object.prototype, "constructor", $Object, DONT_ENUM);
+
   // Set up non-enumerable functions on the Object.prototype object.
   InstallFunctions($Object.prototype, DONT_ENUM, $Array(
     "toString", ObjectToString,
@@ -1788,8 +1789,8 @@
 function SetUpFunction() {
   %CheckIsBootstrapping();

-  $Function.prototype.constructor = $Function;
   %SetCode($Function, NewFunction);
+  %SetProperty($Function.prototype, "constructor", $Function, DONT_ENUM);

   InstallFunctions($Function.prototype, DONT_ENUM, $Array(
     "bind", FunctionBind,
=======================================
--- /branches/bleeding_edge/test/mjsunit/harmony/symbols.js Wed Apr 3 10:06:22 2013 +++ /branches/bleeding_edge/test/mjsunit/harmony/symbols.js Thu Apr 11 05:27:55 2013
@@ -82,6 +82,23 @@
 TestPrototype()


+function TestConstructor() {
+  assertFalse(Object === Symbol.prototype.constructor)
+  assertFalse(Symbol === Object.prototype.constructor)
+  assertSame(Symbol, Symbol.prototype.constructor)
+  assertSame(Symbol, Symbol().__proto__.constructor)
+  assertSame(Symbol, Symbol(Symbol()).__proto__.constructor)
+  assertSame(Symbol, (new Symbol).__proto__.constructor)
+  assertSame(Symbol, (new Symbol()).__proto__.constructor)
+  assertSame(Symbol, (new Symbol(Symbol())).__proto__.constructor)
+  assertSame(Symbol, Object(Symbol()).__proto__.constructor)
+  for (var i in symbols) {
+    assertSame(Symbol, symbols[i].__proto__.constructor)
+  }
+}
+TestConstructor()
+
+
 function TestName() {
   for (var i in symbols) {
     var name = symbols[i].name

--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to