Bug 791611 (part 2) - Remove unnecessary |script| arg to TypeCompartment::newTypeObject(). r=sfink.

--HG--
extra : rebase_source : 793ff656d8e5e12988a1fb77b80fb7f7271118f2
This commit is contained in:
Nicholas Nethercote 2012-09-18 21:04:07 -07:00
Родитель 2a2cfa4032
Коммит 12f3d3e0cd
3 изменённых файлов: 12 добавлений и 18 удалений

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

@ -2063,12 +2063,10 @@ TypeCompartment::init(JSContext *cx)
}
TypeObject *
TypeCompartment::newTypeObject(JSContext *cx, JSScript *script,
JSProtoKey key, HandleObject proto, bool unknown,
bool isDOM)
TypeCompartment::newTypeObject(JSContext *cx, JSProtoKey key, HandleObject proto,
bool unknown, bool isDOM)
{
JS_ASSERT_IF(script, cx->compartment == script->compartment());
JS_ASSERT_IF(proto, cx->compartment == proto->compartment());
JS_ASSERT_IF(proto, cx->compartment == proto->compartment());
TypeObject *object = gc::NewGCThing<TypeObject>(cx, gc::FINALIZE_TYPE_OBJECT, sizeof(TypeObject));
if (!object)
@ -2221,7 +2219,7 @@ TypeCompartment::addAllocationSiteTypeObject(JSContext *cx, AllocationSiteKey ke
return NULL;
RootedScript keyScript(cx, key.script);
res = newTypeObject(cx, key.script, key.kind, proto);
res = newTypeObject(cx, key.kind, proto);
if (!res) {
cx->compartment->types.setPendingNukeTypes(cx);
return NULL;
@ -2855,7 +2853,7 @@ TypeCompartment::fixArrayType(JSContext *cx, HandleObject obj)
Rooted<Type> origType(cx, type);
/* Make a new type to use for future arrays with the same elements. */
RootedObject objProto(cx, obj->getProto());
Rooted<TypeObject*> objType(cx, newTypeObject(cx, NULL, JSProto_Array, objProto));
Rooted<TypeObject*> objType(cx, newTypeObject(cx, JSProto_Array, objProto));
if (!objType) {
cx->compartment->types.setPendingNukeTypes(cx);
return;
@ -2985,7 +2983,7 @@ TypeCompartment::fixObjectType(JSContext *cx, HandleObject obj)
} else {
/* Make a new type to use for the object and similar future ones. */
RootedObject objProto(cx, obj->getProto());
TypeObject *objType = newTypeObject(cx, NULL, JSProto_Object, objProto);
TypeObject *objType = newTypeObject(cx, JSProto_Object, objProto);
if (!objType || !objType->addDefiniteProperties(cx, obj)) {
cx->compartment->types.setPendingNukeTypes(cx);
return;
@ -5517,8 +5515,7 @@ JSFunction::setTypeForScriptedFunction(JSContext *cx, HandleFunction fun, bool s
*/
} else {
RootedObject funProto(cx, fun->getProto());
TypeObject *type = cx->compartment->types.newTypeObject(cx, fun->script(),
JSProto_Function, funProto);
TypeObject *type = cx->compartment->types.newTypeObject(cx, JSProto_Function, funProto);
if (!type)
return false;
@ -5653,7 +5650,7 @@ JSObject::makeLazyType(JSContext *cx)
RootedObject self(cx, this);
JSProtoKey key = JSCLASS_CACHED_PROTO_KEY(getClass());
RootedObject proto(cx, getProto());
TypeObject *type = cx->compartment->types.newTypeObject(cx, NULL, key, proto);
TypeObject *type = cx->compartment->types.newTypeObject(cx, key, proto);
AutoAssertNoGC nogc;
if (!type) {
if (cx->typeInferenceEnabled())
@ -5800,8 +5797,7 @@ JSObject::getNewType(JSContext *cx, JSFunction *fun_, bool isDOM)
bool markUnknown = self->lastProperty()->hasObjectFlag(BaseShape::NEW_TYPE_UNKNOWN);
RootedTypeObject type(cx);
type = cx->compartment->types.newTypeObject(cx, NULL, JSProto_Object, self,
markUnknown, isDOM);
type = cx->compartment->types.newTypeObject(cx, JSProto_Object, self, markUnknown, isDOM);
if (!type)
return NULL;
@ -5868,8 +5864,7 @@ JSCompartment::getLazyType(JSContext *cx, HandleObject proto)
return type;
}
TypeObject *type = cx->compartment->types.newTypeObject(cx, NULL,
JSProto_Object, proto, false);
TypeObject *type = cx->compartment->types.newTypeObject(cx, JSProto_Object, proto, false);
if (!type)
return NULL;

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

@ -1255,8 +1255,7 @@ struct TypeCompartment
* or JSProto_Object to indicate a type whose class is unknown (not just
* js_ObjectClass).
*/
TypeObject *newTypeObject(JSContext *cx, JSScript *script,
JSProtoKey kind, HandleObject proto,
TypeObject *newTypeObject(JSContext *cx, JSProtoKey kind, HandleObject proto,
bool unknown = false, bool isDOM = false);
/* Get or make an object for an allocation site, and add to the allocation site table. */

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

@ -1693,7 +1693,7 @@ JSCompartment::getEmptyType(JSContext *cx)
if (!emptyTypeObject) {
JS::RootedObject nullproto(cx, NULL);
emptyTypeObject = types.newTypeObject(cx, NULL, JSProto_Object, nullproto, true);
emptyTypeObject = types.newTypeObject(cx, JSProto_Object, nullproto, true);
}
return emptyTypeObject;
}