Bug 1142282 part 1. Remove the parent argument of NewNativeObjectWithGivenProto. r=waldo

This commit is contained in:
Boris Zbarsky 2015-03-11 22:33:59 -04:00
Родитель d0524b1a9e
Коммит 2fd882441b
7 изменённых файлов: 18 добавлений и 23 удалений

Просмотреть файл

@ -1806,8 +1806,7 @@ js::DeepCloneObjectLiteral(JSContext *cx, HandleNativeObject obj, NewObjectKind
RootedObject proto(cx, group->proto().toObject());
obj->assertParentIs(cx->global());
clone = NewNativeObjectWithGivenProto(cx, &PlainObject::class_, proto,
NullPtr(), kind,
newKind);
kind, newKind);
}
// Allocate the same number of slots.

Просмотреть файл

@ -452,7 +452,7 @@ Debugger::getScriptFrameWithIter(JSContext *cx, AbstractFramePtr frame,
/* Create and populate the Debugger.Frame object. */
RootedObject proto(cx, &object->getReservedSlot(JSSLOT_DEBUG_FRAME_PROTO).toObject());
RootedNativeObject frameobj(cx, NewNativeObjectWithGivenProto(cx, &DebuggerFrame_class,
proto, NullPtr()));
proto));
if (!frameobj)
return false;
@ -771,7 +771,7 @@ Debugger::wrapEnvironment(JSContext *cx, Handle<Env*> env, MutableHandleValue rv
} else {
/* Create a new Debugger.Environment for env. */
RootedObject proto(cx, &object->getReservedSlot(JSSLOT_DEBUG_ENV_PROTO).toObject());
envobj = NewNativeObjectWithGivenProto(cx, &DebuggerEnv_class, proto, NullPtr(),
envobj = NewNativeObjectWithGivenProto(cx, &DebuggerEnv_class, proto,
TenuredObject);
if (!envobj)
return false;
@ -814,7 +814,7 @@ Debugger::wrapDebuggeeValue(JSContext *cx, MutableHandleValue vp)
/* Create a new Debugger.Object for obj. */
RootedObject proto(cx, &object->getReservedSlot(JSSLOT_DEBUG_OBJECT_PROTO).toObject());
NativeObject *dobj =
NewNativeObjectWithGivenProto(cx, &DebuggerObject_class, proto, NullPtr(),
NewNativeObjectWithGivenProto(cx, &DebuggerObject_class, proto,
TenuredObject);
if (!dobj)
return false;
@ -2917,8 +2917,7 @@ Debugger::construct(JSContext *cx, unsigned argc, Value *vp)
* Debugger.{Frame,Object,Script,Memory}.prototype in reserved slots. The
* rest of the reserved slots are for hooks; they default to undefined.
*/
RootedNativeObject obj(cx, NewNativeObjectWithGivenProto(cx, &Debugger::jsclass, proto,
NullPtr()));
RootedNativeObject obj(cx, NewNativeObjectWithGivenProto(cx, &Debugger::jsclass, proto));
if (!obj)
return false;
for (unsigned slot = JSSLOT_DEBUG_PROTO_START; slot < JSSLOT_DEBUG_PROTO_STOP; slot++)
@ -4160,7 +4159,7 @@ Debugger::newDebuggerScript(JSContext *cx, HandleScript script)
RootedObject proto(cx, &object->getReservedSlot(JSSLOT_DEBUG_SCRIPT_PROTO).toObject());
MOZ_ASSERT(proto);
NativeObject *scriptobj = NewNativeObjectWithGivenProto(cx, &DebuggerScript_class,
proto, NullPtr(), TenuredObject);
proto, TenuredObject);
if (!scriptobj)
return nullptr;
scriptobj->setReservedSlot(JSSLOT_DEBUGSCRIPT_OWNER, ObjectValue(*object));
@ -5182,7 +5181,7 @@ Debugger::newDebuggerSource(JSContext *cx, HandleScriptSource source)
RootedObject proto(cx, &object->getReservedSlot(JSSLOT_DEBUG_SOURCE_PROTO).toObject());
MOZ_ASSERT(proto);
NativeObject *sourceobj = NewNativeObjectWithGivenProto(cx, &DebuggerSource_class,
proto, NullPtr(), TenuredObject);
proto, TenuredObject);
if (!sourceobj)
return nullptr;
sourceobj->setReservedSlot(JSSLOT_DEBUGSOURCE_OWNER, ObjectValue(*object));
@ -5822,8 +5821,7 @@ DebuggerFrame_getArguments(JSContext *cx, unsigned argc, Value *vp)
RootedObject proto(cx, GlobalObject::getOrCreateArrayPrototype(cx, global));
if (!proto)
return false;
argsobj = NewNativeObjectWithGivenProto(cx, &DebuggerArguments_class, proto,
GlobalObject::upcast(global));
argsobj = NewNativeObjectWithGivenProto(cx, &DebuggerArguments_class, proto);
if (!argsobj)
return false;
SetReservedSlot(argsobj, JSSLOT_DEBUGARGUMENTS_FRAME, ObjectValue(*thisobj));

Просмотреть файл

@ -41,8 +41,7 @@ DebuggerMemory::create(JSContext *cx, Debugger *dbg)
{
Value memoryProtoValue = dbg->object->getReservedSlot(Debugger::JSSLOT_DEBUG_MEMORY_PROTO);
RootedObject memoryProto(cx, &memoryProtoValue.toObject());
RootedNativeObject memory(cx, NewNativeObjectWithGivenProto(cx, &class_, memoryProto,
NullPtr()));
RootedNativeObject memory(cx, NewNativeObjectWithGivenProto(cx, &class_, memoryProto));
if (!memory)
return nullptr;

Просмотреть файл

@ -35,13 +35,13 @@ GeneratorObject::create(JSContext *cx, AbstractFramePtr frame)
if (!proto)
return nullptr;
}
obj = NewNativeObjectWithGivenProto(cx, &StarGeneratorObject::class_, proto, global);
obj = NewNativeObjectWithGivenProto(cx, &StarGeneratorObject::class_, proto);
} else {
MOZ_ASSERT(frame.script()->isLegacyGenerator());
RootedObject proto(cx, GlobalObject::getOrCreateLegacyGeneratorObjectPrototype(cx, global));
if (!proto)
return nullptr;
obj = NewNativeObjectWithGivenProto(cx, &LegacyGeneratorObject::class_, proto, global);
obj = NewNativeObjectWithGivenProto(cx, &LegacyGeneratorObject::class_, proto);
}
if (!obj)
return nullptr;

Просмотреть файл

@ -442,7 +442,7 @@ CreateBlankProto(JSContext *cx, const Class *clasp, HandleObject proto, HandleOb
{
MOZ_ASSERT(clasp != &JSFunction::class_);
RootedNativeObject blankProto(cx, NewNativeObjectWithGivenProto(cx, clasp, proto, global,
RootedNativeObject blankProto(cx, NewNativeObjectWithGivenProto(cx, clasp, proto,
SingletonObject));
if (!blankProto || !blankProto->setDelegate(cx))
return nullptr;
@ -524,8 +524,7 @@ GlobalObject::getOrCreateDebuggers(JSContext *cx, Handle<GlobalObject*> global)
if (debuggers)
return debuggers;
NativeObject *obj = NewNativeObjectWithGivenProto(cx, &GlobalDebuggees_class, NullPtr(),
global);
NativeObject *obj = NewNativeObjectWithGivenProto(cx, &GlobalDebuggees_class, NullPtr());
if (!obj)
return nullptr;
debuggers = cx->new_<DebuggerVector>();

Просмотреть файл

@ -360,18 +360,18 @@ NewNativeObjectWithGivenTaggedProto(ExclusiveContext *cx, const Class *clasp,
inline NativeObject *
NewNativeObjectWithGivenProto(ExclusiveContext *cx, const Class *clasp,
HandleObject proto, HandleObject parent,
HandleObject proto,
gc::AllocKind allocKind, NewObjectKind newKind)
{
return MaybeNativeObject(NewObjectWithGivenProto(cx, clasp, proto, parent, allocKind, newKind));
return MaybeNativeObject(NewObjectWithGivenProto(cx, clasp, proto, NullPtr(), allocKind, newKind));
}
inline NativeObject *
NewNativeObjectWithGivenProto(ExclusiveContext *cx, const Class *clasp,
HandleObject proto, HandleObject parent,
HandleObject proto,
NewObjectKind newKind = GenericObject)
{
return MaybeNativeObject(NewObjectWithGivenProto(cx, clasp, proto, parent, newKind));
return MaybeNativeObject(NewObjectWithGivenProto(cx, clasp, proto, NullPtr(), newKind));
}
inline NativeObject *

Просмотреть файл

@ -308,7 +308,7 @@ const Class ForOfPIC::jsclass = {
js::ForOfPIC::createForOfPICObject(JSContext *cx, Handle<GlobalObject*> global)
{
assertSameCompartment(cx, global);
NativeObject *obj = NewNativeObjectWithGivenProto(cx, &ForOfPIC::jsclass, NullPtr(), global);
NativeObject *obj = NewNativeObjectWithGivenProto(cx, &ForOfPIC::jsclass, NullPtr());
if (!obj)
return nullptr;
ForOfPIC::Chain *chain = cx->new_<ForOfPIC::Chain>();