Bug 1132282 - Part 1: Handlify more parent args to NewObject; r=sfink

This commit is contained in:
Terrence Cole 2015-02-13 11:36:40 -08:00
parent 0a9651ff60
commit 27f3559a46
5 changed files with 14 additions and 12 deletions

View File

@ -1170,7 +1170,7 @@ NewObjectGCKind(const js::Class *clasp)
}
static inline JSObject *
NewObject(ExclusiveContext *cx, ObjectGroup *groupArg, JSObject *parent, gc::AllocKind kind,
NewObject(ExclusiveContext *cx, ObjectGroup *groupArg, HandleObject parent, gc::AllocKind kind,
NewObjectKind newKind)
{
const Class *clasp = groupArg->clasp();
@ -1464,7 +1464,7 @@ js::NewObjectWithClassProtoCommon(ExclusiveContext *cxArg, const Class *clasp,
* avoid losing creation site information for objects made by scripted 'new'.
*/
JSObject *
js::NewObjectWithGroupCommon(JSContext *cx, HandleObjectGroup group, JSObject *parent,
js::NewObjectWithGroupCommon(JSContext *cx, HandleObjectGroup group, HandleObject parent,
gc::AllocKind allocKind, NewObjectKind newKind)
{
MOZ_ASSERT(parent);
@ -1488,7 +1488,7 @@ js::NewObjectWithGroupCommon(JSContext *cx, HandleObjectGroup group, JSObject *p
return obj;
} else {
obj = cache.newObjectFromHit<CanGC>(cx, entry, GetInitialHeap(newKind, group->clasp()));
parent = group->proto().toObject()->getParent();
MOZ_ASSERT(!obj);
}
}
}
@ -1540,7 +1540,7 @@ js::CreateThis(JSContext *cx, const Class *newclasp, HandleObject callee)
}
static inline JSObject *
CreateThisForFunctionWithGroup(JSContext *cx, HandleObjectGroup group, JSObject *parent,
CreateThisForFunctionWithGroup(JSContext *cx, HandleObjectGroup group, HandleObject parent,
NewObjectKind newKind)
{
if (group->maybeUnboxedLayout() && newKind != SingletonObject)
@ -1623,7 +1623,8 @@ js::CreateThisForFunctionWithProto(JSContext *cx, HandleObject callee, HandleObj
}
}
res = CreateThisForFunctionWithGroup(cx, group, callee->getParent(), newKind);
RootedObject parent(cx, callee->getParent());
res = CreateThisForFunctionWithGroup(cx, group, parent, newKind);
} else {
RootedObject parent(cx, callee->getParent());
gc::AllocKind allocKind = NewObjectGCKind(&PlainObject::class_);

View File

@ -622,12 +622,12 @@ bool
NewObjectScriptedCall(JSContext *cx, MutableHandleObject obj);
JSObject *
NewObjectWithGroupCommon(JSContext *cx, HandleObjectGroup group, JSObject *parent,
NewObjectWithGroupCommon(JSContext *cx, HandleObjectGroup group, HandleObject parent,
gc::AllocKind allocKind, NewObjectKind newKind);
template <typename T>
inline T *
NewObjectWithGroup(JSContext *cx, HandleObjectGroup group, JSObject *parent,
NewObjectWithGroup(JSContext *cx, HandleObjectGroup group, HandleObject parent,
gc::AllocKind allocKind, NewObjectKind newKind = GenericObject)
{
JSObject *obj = NewObjectWithGroupCommon(cx, group, parent, allocKind, newKind);
@ -636,7 +636,7 @@ NewObjectWithGroup(JSContext *cx, HandleObjectGroup group, JSObject *parent,
template <typename T>
inline T *
NewObjectWithGroup(JSContext *cx, HandleObjectGroup group, JSObject *parent,
NewObjectWithGroup(JSContext *cx, HandleObjectGroup group, HandleObject parent,
NewObjectKind newKind = GenericObject)
{
gc::AllocKind allocKind = gc::GetGCObjectKind(group->clasp());
@ -644,7 +644,7 @@ NewObjectWithGroup(JSContext *cx, HandleObjectGroup group, JSObject *parent,
}
JSObject *
NewReshapedObject(JSContext *cx, HandleObjectGroup group, JSObject *parent,
NewReshapedObject(JSContext *cx, HandleObjectGroup group, HandleObject parent,
gc::AllocKind allocKind, HandleShape shape,
NewObjectKind newKind = GenericObject);

View File

@ -67,7 +67,7 @@ RegExpObjectBuilder::getOrCreateClone(HandleObjectGroup group)
MOZ_ASSERT(!reobj_);
MOZ_ASSERT(group->clasp() == &RegExpObject::class_);
JSObject *parent = group->proto().toObject()->getParent();
RootedObject parent(cx, group->proto().toObject()->getParent());
// Note: RegExp objects are always allocated in the tenured heap. This is
// not strictly required, but simplifies embedding them in jitcode.

View File

@ -602,7 +602,7 @@ NativeObject::addPropertyInternal(ExclusiveContext *cx,
}
JSObject *
js::NewReshapedObject(JSContext *cx, HandleObjectGroup group, JSObject *parent,
js::NewReshapedObject(JSContext *cx, HandleObjectGroup group, HandleObject parent,
gc::AllocKind allocKind, HandleShape shape, NewObjectKind newKind)
{
RootedPlainObject res(cx, NewObjectWithGroup<PlainObject>(cx, group, parent, allocKind, newKind));

View File

@ -3297,7 +3297,8 @@ ChangeObjectFixedSlotCount(JSContext *cx, PlainObject *obj, gc::AllocKind allocK
// Make a clone of the object, with the new allocation kind.
RootedShape oldShape(cx, obj->lastProperty());
RootedObjectGroup group(cx, obj->group());
JSObject *clone = NewReshapedObject(cx, group, obj->getParent(), allocKind, oldShape);
RootedObject parent(cx, obj->getParent());
JSObject *clone = NewReshapedObject(cx, group, parent, allocKind, oldShape);
if (!clone)
return false;