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;
}
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,
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,
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