зеркало из https://github.com/mozilla/gecko-dev.git
Bug 956300 - Remove Class argument from functions that also take a TypeObject. r=bhackett
This commit is contained in:
Родитель
3de37a9393
Коммит
9b47c5d062
|
@ -1260,9 +1260,11 @@ NewObjectGCKind(const js::Class *clasp)
|
|||
}
|
||||
|
||||
static inline JSObject *
|
||||
NewObject(ExclusiveContext *cx, const Class *clasp, types::TypeObject *type_, JSObject *parent,
|
||||
gc::AllocKind kind, NewObjectKind newKind)
|
||||
NewObject(ExclusiveContext *cx, types::TypeObject *type_, JSObject *parent, gc::AllocKind kind,
|
||||
NewObjectKind newKind)
|
||||
{
|
||||
const Class *clasp = type_->clasp();
|
||||
|
||||
JS_ASSERT(clasp != &ArrayObject::class_);
|
||||
JS_ASSERT_IF(clasp == &JSFunction::class_,
|
||||
kind == JSFunction::FinalizeKind || kind == JSFunction::ExtendedFinalizeKind);
|
||||
|
@ -1365,7 +1367,7 @@ js::NewObjectWithGivenProto(ExclusiveContext *cxArg, const js::Class *clasp,
|
|||
if (!parent && proto.isObject())
|
||||
parent = proto.toObject()->getParent();
|
||||
|
||||
RootedObject obj(cxArg, NewObject(cxArg, clasp, type, parent, allocKind, newKind));
|
||||
RootedObject obj(cxArg, NewObject(cxArg, type, parent, allocKind, newKind));
|
||||
if (!obj)
|
||||
return nullptr;
|
||||
|
||||
|
@ -1428,7 +1430,7 @@ js::NewObjectWithClassProtoCommon(ExclusiveContext *cxArg,
|
|||
if (!type)
|
||||
return nullptr;
|
||||
|
||||
JSObject *obj = NewObject(cxArg, clasp, type, parent, allocKind, newKind);
|
||||
JSObject *obj = NewObject(cxArg, type, parent, allocKind, newKind);
|
||||
if (!obj)
|
||||
return nullptr;
|
||||
|
||||
|
@ -1462,19 +1464,19 @@ js::NewObjectWithType(JSContext *cx, HandleTypeObject type, JSObject *parent, gc
|
|||
newKind == GenericObject &&
|
||||
!cx->compartment()->hasObjectMetadataCallback())
|
||||
{
|
||||
if (cache.lookupType(type->clasp(), type, allocKind, &entry)) {
|
||||
if (cache.lookupType(type, allocKind, &entry)) {
|
||||
JSObject *obj = cache.newObjectFromHit(cx, entry, GetInitialHeap(newKind, type->clasp()));
|
||||
if (obj)
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
JSObject *obj = NewObject(cx, type->clasp(), type, parent, allocKind, newKind);
|
||||
JSObject *obj = NewObject(cx, type, parent, allocKind, newKind);
|
||||
if (!obj)
|
||||
return nullptr;
|
||||
|
||||
if (entry != -1 && !obj->hasDynamicSlots())
|
||||
cache.fillType(entry, type->clasp(), type, allocKind, obj);
|
||||
cache.fillType(entry, type, allocKind, obj);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
|
|
@ -340,10 +340,8 @@ class NewObjectCache
|
|||
inline bool lookupGlobal(const Class *clasp, js::GlobalObject *global, gc::AllocKind kind,
|
||||
EntryIndex *pentry);
|
||||
|
||||
bool lookupType(const Class *clasp, js::types::TypeObject *type, gc::AllocKind kind,
|
||||
EntryIndex *pentry)
|
||||
{
|
||||
return lookup(clasp, type, kind, pentry);
|
||||
bool lookupType(js::types::TypeObject *type, gc::AllocKind kind, EntryIndex *pentry) {
|
||||
return lookup(type->clasp(), type, kind, pentry);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -359,11 +357,11 @@ class NewObjectCache
|
|||
inline void fillGlobal(EntryIndex entry, const Class *clasp, js::GlobalObject *global,
|
||||
gc::AllocKind kind, JSObject *obj);
|
||||
|
||||
void fillType(EntryIndex entry, const Class *clasp, js::types::TypeObject *type, gc::AllocKind kind,
|
||||
void fillType(EntryIndex entry, js::types::TypeObject *type, gc::AllocKind kind,
|
||||
JSObject *obj)
|
||||
{
|
||||
JS_ASSERT(obj->type() == type);
|
||||
return fill(entry, clasp, type, kind, obj);
|
||||
return fill(entry, type->clasp(), type, kind, obj);
|
||||
}
|
||||
|
||||
/* Invalidate any entries which might produce an object with shape/proto. */
|
||||
|
|
|
@ -1658,7 +1658,7 @@ NewObjectCache::invalidateEntriesForShape(JSContext *cx, HandleShape shape, Hand
|
|||
PodZero(&entries[entry]);
|
||||
if (!proto->is<GlobalObject>() && lookupProto(clasp, proto, kind, &entry))
|
||||
PodZero(&entries[entry]);
|
||||
if (lookupType(clasp, type, kind, &entry))
|
||||
if (lookupType(type, kind, &entry))
|
||||
PodZero(&entries[entry]);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче