зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1131877 - Part 1: Rename TaggedProto taking NewObject methods; r=bhackett
--HG-- extra : rebase_source : e8d3201e374edb26eae43d7cdc6acf35d1d3adcf
This commit is contained in:
Родитель
2cd7434422
Коммит
b07c52de1f
|
@ -1229,9 +1229,9 @@ NewObjectCache::fillProto(EntryIndex entry, const Class *clasp, js::TaggedProto
|
|||
}
|
||||
|
||||
JSObject *
|
||||
js::NewObjectWithGivenProto(ExclusiveContext *cxArg, const js::Class *clasp,
|
||||
js::TaggedProto protoArg, HandleObject parentArg,
|
||||
gc::AllocKind allocKind, NewObjectKind newKind)
|
||||
js::NewObjectWithGivenTaggedProto(ExclusiveContext *cxArg, const Class *clasp,
|
||||
TaggedProto protoArg, HandleObject parentArg,
|
||||
gc::AllocKind allocKind, NewObjectKind newKind)
|
||||
{
|
||||
if (CanBeFinalizedInBackground(allocKind, clasp))
|
||||
allocKind = GetBackgroundAllocKind(allocKind);
|
||||
|
@ -1394,8 +1394,8 @@ js::NewObjectWithClassProtoCommon(ExclusiveContext *cxArg, const Class *clasp, J
|
|||
NewObjectKind newKind)
|
||||
{
|
||||
if (protoArg) {
|
||||
return NewObjectWithGivenProto(cxArg, clasp, TaggedProto(protoArg), maybeParent, allocKind,
|
||||
newKind);
|
||||
return NewObjectWithGivenTaggedProto(cxArg, clasp, TaggedProto(protoArg), maybeParent,
|
||||
allocKind, newKind);
|
||||
}
|
||||
|
||||
if (CanBeFinalizedInBackground(allocKind, clasp))
|
||||
|
@ -1598,8 +1598,8 @@ CreateThisForFunctionWithGroup(JSContext *cx, HandleObjectGroup group, JSObject
|
|||
|
||||
if (newKind == SingletonObject) {
|
||||
RootedObject parentRoot(cx, parent);
|
||||
return NewObjectWithGivenProto(cx, &PlainObject::class_, group->proto(), parentRoot,
|
||||
allocKind, newKind);
|
||||
return NewObjectWithGivenTaggedProto(cx, &PlainObject::class_, group->proto(), parentRoot,
|
||||
allocKind, newKind);
|
||||
}
|
||||
return NewObjectWithGroup<PlainObject>(cx, group, parent, allocKind, newKind);
|
||||
}
|
||||
|
@ -1786,7 +1786,7 @@ js::CloneObject(JSContext *cx, HandleObject obj, Handle<js::TaggedProto> proto,
|
|||
|
||||
RootedObject clone(cx);
|
||||
if (obj->isNative()) {
|
||||
clone = NewObjectWithGivenProto(cx, obj->getClass(), proto, parent);
|
||||
clone = NewObjectWithGivenTaggedProto(cx, obj->getClass(), proto, parent);
|
||||
if (!clone)
|
||||
return nullptr;
|
||||
|
||||
|
@ -1839,7 +1839,7 @@ js::DeepCloneObjectLiteral(JSContext *cx, HandleNativeObject obj, NewObjectKind
|
|||
return nullptr;
|
||||
RootedObject parent(cx, obj->getParent());
|
||||
clone = NewNativeObjectWithGivenProto(cx, &PlainObject::class_,
|
||||
TaggedProto(group->proto().toObject()),
|
||||
group->proto().toObject(),
|
||||
parent, kind, newKind);
|
||||
}
|
||||
|
||||
|
|
|
@ -474,31 +474,38 @@ class AutoPropDescVector : public AutoVectorRooter<PropDesc>
|
|||
* default to the prototype's global if the prototype is non-null.
|
||||
*/
|
||||
JSObject *
|
||||
NewObjectWithGivenProto(ExclusiveContext *cx, const Class *clasp, TaggedProto proto,
|
||||
HandleObject parent, gc::AllocKind allocKind, NewObjectKind newKind);
|
||||
NewObjectWithGivenTaggedProto(ExclusiveContext *cx, const Class *clasp, TaggedProto proto,
|
||||
HandleObject parent, gc::AllocKind allocKind, NewObjectKind newKind);
|
||||
|
||||
inline JSObject *
|
||||
NewObjectWithGivenProto(ExclusiveContext *cx, const Class *clasp, TaggedProto proto,
|
||||
HandleObject parent, NewObjectKind newKind = GenericObject)
|
||||
NewObjectWithGivenTaggedProto(ExclusiveContext *cx, const Class *clasp, TaggedProto proto,
|
||||
HandleObject parent, NewObjectKind newKind = GenericObject)
|
||||
{
|
||||
gc::AllocKind allocKind = gc::GetGCObjectKind(clasp);
|
||||
return NewObjectWithGivenProto(cx, clasp, proto, parent, allocKind, newKind);
|
||||
return NewObjectWithGivenTaggedProto(cx, clasp, proto, parent, allocKind, newKind);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T *
|
||||
NewObjectWithGivenTaggedProto(ExclusiveContext *cx, TaggedProto proto, HandleObject parent,
|
||||
NewObjectKind newKind = GenericObject)
|
||||
{
|
||||
JSObject *obj = NewObjectWithGivenTaggedProto(cx, &T::class_, proto, parent, newKind);
|
||||
return obj ? &obj->as<T>() : nullptr;
|
||||
}
|
||||
|
||||
inline JSObject *
|
||||
NewObjectWithGivenProto(ExclusiveContext *cx, const Class *clasp, JSObject *proto,
|
||||
HandleObject parent, gc::AllocKind allocKind, NewObjectKind newKind)
|
||||
{
|
||||
return NewObjectWithGivenTaggedProto(cx, clasp, TaggedProto(proto), parent, allocKind, newKind);
|
||||
}
|
||||
|
||||
inline JSObject *
|
||||
NewObjectWithGivenProto(ExclusiveContext *cx, const Class *clasp, JSObject *proto,
|
||||
HandleObject parent, NewObjectKind newKind = GenericObject)
|
||||
{
|
||||
return NewObjectWithGivenProto(cx, clasp, TaggedProto(proto), parent, newKind);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T *
|
||||
NewObjectWithGivenProto(ExclusiveContext *cx, TaggedProto proto, HandleObject parent,
|
||||
NewObjectKind newKind = GenericObject)
|
||||
{
|
||||
JSObject *obj = NewObjectWithGivenProto(cx, &T::class_, proto, parent, newKind);
|
||||
return obj ? &obj->as<T>() : nullptr;
|
||||
return NewObjectWithGivenTaggedProto(cx, clasp, TaggedProto(proto), parent, newKind);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
@ -506,7 +513,7 @@ inline T *
|
|||
NewObjectWithGivenProto(ExclusiveContext *cx, JSObject *proto, HandleObject parent,
|
||||
NewObjectKind newKind = GenericObject)
|
||||
{
|
||||
return NewObjectWithGivenProto<T>(cx, TaggedProto(proto), parent, newKind);
|
||||
return NewObjectWithGivenTaggedProto<T>(cx, TaggedProto(proto), parent, newKind);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
@ -514,8 +521,8 @@ inline T *
|
|||
NewObjectWithGivenProto(ExclusiveContext *cx, JSObject *proto, HandleObject parent,
|
||||
gc::AllocKind allocKind, NewObjectKind newKind = GenericObject)
|
||||
{
|
||||
JSObject *obj = NewObjectWithGivenProto(cx, &T::class_, TaggedProto(proto), parent, allocKind,
|
||||
newKind);
|
||||
JSObject *obj = NewObjectWithGivenTaggedProto(cx, &T::class_, TaggedProto(proto), parent,
|
||||
allocKind, newKind);
|
||||
return obj ? &obj->as<T>() : nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -345,19 +345,28 @@ CopyInitializerObject(JSContext *cx, HandlePlainObject baseobj, NewObjectKind ne
|
|||
}
|
||||
|
||||
inline NativeObject *
|
||||
NewNativeObjectWithGivenProto(ExclusiveContext *cx, const Class *clasp,
|
||||
TaggedProto proto, HandleObject parent,
|
||||
gc::AllocKind allocKind, NewObjectKind newKind)
|
||||
NewNativeObjectWithGivenTaggedProto(ExclusiveContext *cx, const Class *clasp,
|
||||
TaggedProto proto, HandleObject parent,
|
||||
gc::AllocKind allocKind, NewObjectKind newKind)
|
||||
{
|
||||
return MaybeNativeObject(NewObjectWithGivenProto(cx, clasp, proto, parent, allocKind, newKind));
|
||||
return MaybeNativeObject(NewObjectWithGivenTaggedProto(cx, clasp, proto, parent, allocKind,
|
||||
newKind));
|
||||
}
|
||||
|
||||
inline NativeObject *
|
||||
NewNativeObjectWithGivenTaggedProto(ExclusiveContext *cx, const Class *clasp,
|
||||
TaggedProto proto, HandleObject parent,
|
||||
NewObjectKind newKind = GenericObject)
|
||||
{
|
||||
return MaybeNativeObject(NewObjectWithGivenTaggedProto(cx, clasp, proto, parent, newKind));
|
||||
}
|
||||
|
||||
inline NativeObject *
|
||||
NewNativeObjectWithGivenProto(ExclusiveContext *cx, const Class *clasp,
|
||||
TaggedProto proto, HandleObject parent,
|
||||
NewObjectKind newKind = GenericObject)
|
||||
JSObject *proto, HandleObject parent,
|
||||
gc::AllocKind allocKind, NewObjectKind newKind)
|
||||
{
|
||||
return MaybeNativeObject(NewObjectWithGivenProto(cx, clasp, proto, parent, newKind));
|
||||
return MaybeNativeObject(NewObjectWithGivenProto(cx, clasp, proto, parent, allocKind, newKind));
|
||||
}
|
||||
|
||||
inline NativeObject *
|
||||
|
|
|
@ -50,7 +50,8 @@ ProxyObject::New(JSContext *cx, const BaseProxyHandler *handler, HandleValue pri
|
|||
|
||||
// Note: this will initialize the object's |data| to strange values, but we
|
||||
// will immediately overwrite those below.
|
||||
RootedObject obj(cx, NewObjectWithGivenProto(cx, clasp, proto, parent, allocKind, newKind));
|
||||
RootedObject obj(cx, NewObjectWithGivenTaggedProto(cx, clasp, proto, parent, allocKind,
|
||||
newKind));
|
||||
if (!obj) {
|
||||
js_free(values);
|
||||
return nullptr;
|
||||
|
|
|
@ -1257,7 +1257,7 @@ CloneObject(JSContext *cx, HandleNativeObject selfHostedObject)
|
|||
clone = NewDenseEmptyArray(cx, nullptr, TenuredObject);
|
||||
} else {
|
||||
MOZ_ASSERT(selfHostedObject->isNative());
|
||||
clone = NewObjectWithGivenProto(cx, selfHostedObject->getClass(), TaggedProto(nullptr), cx->global(),
|
||||
clone = NewObjectWithGivenProto(cx, selfHostedObject->getClass(), nullptr, cx->global(),
|
||||
selfHostedObject->asTenured().getAllocKind(),
|
||||
SingletonObject);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче