From 12f3d3e0cdba1b33fb5c1d76252798fc506fdb9b Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 18 Sep 2012 21:04:07 -0700 Subject: [PATCH] Bug 791611 (part 2) - Remove unnecessary |script| arg to TypeCompartment::newTypeObject(). r=sfink. --HG-- extra : rebase_source : 793ff656d8e5e12988a1fb77b80fb7f7271118f2 --- js/src/jsinfer.cpp | 25 ++++++++++--------------- js/src/jsinfer.h | 3 +-- js/src/jsinferinlines.h | 2 +- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/js/src/jsinfer.cpp b/js/src/jsinfer.cpp index 5bfa6b26acdc..4c0d5772781d 100644 --- a/js/src/jsinfer.cpp +++ b/js/src/jsinfer.cpp @@ -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(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 origType(cx, type); /* Make a new type to use for future arrays with the same elements. */ RootedObject objProto(cx, obj->getProto()); - Rooted objType(cx, newTypeObject(cx, NULL, JSProto_Array, objProto)); + Rooted 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; diff --git a/js/src/jsinfer.h b/js/src/jsinfer.h index ef7598c6cf8d..4235fb78f9c1 100644 --- a/js/src/jsinfer.h +++ b/js/src/jsinfer.h @@ -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. */ diff --git a/js/src/jsinferinlines.h b/js/src/jsinferinlines.h index d59b32124fbf..c403b12d9405 100644 --- a/js/src/jsinferinlines.h +++ b/js/src/jsinferinlines.h @@ -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; }