mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 21:28:55 +00:00
Bug 922168 - Remove use of JSContext in UseNewTypeForInitializer, r=jandem.
This commit is contained in:
parent
e2ce995d6f
commit
12cbfc2925
@ -1383,7 +1383,7 @@ BaselineCompiler::emit_JSOP_NEWARRAY()
|
||||
|
||||
uint32_t length = GET_UINT24(pc);
|
||||
RootedTypeObject type(cx);
|
||||
if (!types::UseNewTypeForInitializer(cx, script, pc, JSProto_Array)) {
|
||||
if (!types::UseNewTypeForInitializer(script, pc, JSProto_Array)) {
|
||||
type = types::TypeScript::InitObject(cx, script, pc, JSProto_Array);
|
||||
if (!type)
|
||||
return false;
|
||||
@ -1427,7 +1427,7 @@ BaselineCompiler::emit_JSOP_NEWOBJECT()
|
||||
frame.syncStack(0);
|
||||
|
||||
RootedTypeObject type(cx);
|
||||
if (!types::UseNewTypeForInitializer(cx, script, pc, JSProto_Object)) {
|
||||
if (!types::UseNewTypeForInitializer(script, pc, JSProto_Object)) {
|
||||
type = types::TypeScript::InitObject(cx, script, pc, JSProto_Object);
|
||||
if (!type)
|
||||
return false;
|
||||
@ -1463,7 +1463,7 @@ BaselineCompiler::emit_JSOP_NEWINIT()
|
||||
JSProtoKey key = JSProtoKey(GET_UINT8(pc));
|
||||
|
||||
RootedTypeObject type(cx);
|
||||
if (!types::UseNewTypeForInitializer(cx, script, pc, key)) {
|
||||
if (!types::UseNewTypeForInitializer(script, pc, key)) {
|
||||
type = types::TypeScript::InitObject(cx, script, pc, key);
|
||||
if (!type)
|
||||
return false;
|
||||
|
@ -5342,7 +5342,7 @@ IonBuilder::jsop_compare(JSOp op)
|
||||
JSObject *
|
||||
IonBuilder::getNewArrayTemplateObject(uint32_t count)
|
||||
{
|
||||
NewObjectKind newKind = types::UseNewTypeForInitializer(cx, script(), pc, JSProto_Array);
|
||||
NewObjectKind newKind = types::UseNewTypeForInitializer(script(), pc, JSProto_Array);
|
||||
|
||||
// Do not allocate template objects in the nursery.
|
||||
if (newKind == GenericObject)
|
||||
@ -5396,7 +5396,7 @@ IonBuilder::jsop_newobject(JSObject *baseObj)
|
||||
// Don't bake in the TypeObject for non-CNG scripts.
|
||||
JS_ASSERT(script()->compileAndGo);
|
||||
|
||||
NewObjectKind newKind = types::UseNewTypeForInitializer(cx, script(), pc, JSProto_Object);
|
||||
NewObjectKind newKind = types::UseNewTypeForInitializer(script(), pc, JSProto_Object);
|
||||
|
||||
// Do not allocate template objects in the nursery.
|
||||
if (newKind == GenericObject)
|
||||
|
@ -1417,7 +1417,7 @@ types::UseNewType(JSContext *cx, JSScript *script, jsbytecode *pc)
|
||||
}
|
||||
|
||||
NewObjectKind
|
||||
types::UseNewTypeForInitializer(JSContext *cx, JSScript *script, jsbytecode *pc, JSProtoKey key)
|
||||
types::UseNewTypeForInitializer(JSScript *script, jsbytecode *pc, JSProtoKey key)
|
||||
{
|
||||
/*
|
||||
* Objects created outside loops in global and eval scripts should have
|
||||
@ -1425,7 +1425,7 @@ types::UseNewTypeForInitializer(JSContext *cx, JSScript *script, jsbytecode *pc,
|
||||
* arrays, but not normal arrays.
|
||||
*/
|
||||
|
||||
if (!cx->typeInferenceEnabled() || (script->function() && !script->treatAsRunOnce))
|
||||
if (script->function() && !script->treatAsRunOnce)
|
||||
return GenericObject;
|
||||
|
||||
if (key != JSProto_Object && !(key >= JSProto_Int8Array && key <= JSProto_Uint8ClampedArray))
|
||||
@ -1458,9 +1458,9 @@ types::UseNewTypeForInitializer(JSContext *cx, JSScript *script, jsbytecode *pc,
|
||||
}
|
||||
|
||||
NewObjectKind
|
||||
types::UseNewTypeForInitializer(JSContext *cx, JSScript *script, jsbytecode *pc, const Class *clasp)
|
||||
types::UseNewTypeForInitializer(JSScript *script, jsbytecode *pc, const Class *clasp)
|
||||
{
|
||||
return UseNewTypeForInitializer(cx, script, pc, JSCLASS_CACHED_PROTO_KEY(clasp));
|
||||
return UseNewTypeForInitializer(script, pc, JSCLASS_CACHED_PROTO_KEY(clasp));
|
||||
}
|
||||
|
||||
static inline bool
|
||||
|
@ -759,15 +759,15 @@ struct AllocationSiteKey : public DefaultHasher<AllocationSiteKey> {
|
||||
|
||||
/* Whether to use a new type object for an initializer opcode at script/pc. */
|
||||
js::NewObjectKind
|
||||
UseNewTypeForInitializer(JSContext *cx, JSScript *script, jsbytecode *pc, JSProtoKey key);
|
||||
UseNewTypeForInitializer(JSScript *script, jsbytecode *pc, JSProtoKey key);
|
||||
|
||||
js::NewObjectKind
|
||||
UseNewTypeForInitializer(JSContext *cx, JSScript *script, jsbytecode *pc, const Class *clasp);
|
||||
UseNewTypeForInitializer(JSScript *script, jsbytecode *pc, const Class *clasp);
|
||||
|
||||
/* static */ inline TypeObject *
|
||||
TypeScript::InitObject(JSContext *cx, JSScript *script, jsbytecode *pc, JSProtoKey kind)
|
||||
{
|
||||
JS_ASSERT(!UseNewTypeForInitializer(cx, script, pc, kind));
|
||||
JS_ASSERT(!UseNewTypeForInitializer(script, pc, kind));
|
||||
|
||||
/* :XXX: Limit script->length so we don't need to check the offset up front? */
|
||||
uint32_t offset = pc - script->code;
|
||||
@ -799,7 +799,7 @@ SetInitializerObjectType(JSContext *cx, HandleScript script, jsbytecode *pc, Han
|
||||
|
||||
JSProtoKey key = JSCLASS_CACHED_PROTO_KEY(obj->getClass());
|
||||
JS_ASSERT(key != JSProto_Null);
|
||||
JS_ASSERT(kind == UseNewTypeForInitializer(cx, script, pc, key));
|
||||
JS_ASSERT(kind == UseNewTypeForInitializer(script, pc, key));
|
||||
|
||||
if (kind == SingletonObject) {
|
||||
JS_ASSERT(obj->hasSingletonType());
|
||||
|
@ -1471,7 +1471,7 @@ js::NewObjectScriptedCall(JSContext *cx, MutableHandleObject pobj)
|
||||
RootedScript script(cx, cx->currentScript(&pc));
|
||||
gc::AllocKind allocKind = NewObjectGCKind(&JSObject::class_);
|
||||
NewObjectKind newKind = script
|
||||
? UseNewTypeForInitializer(cx, script, pc, &JSObject::class_)
|
||||
? UseNewTypeForInitializer(script, pc, &JSObject::class_)
|
||||
: GenericObject;
|
||||
RootedObject obj(cx, NewBuiltinClassInstance(cx, &JSObject::class_, allocKind, newKind));
|
||||
if (!obj)
|
||||
|
@ -2906,11 +2906,11 @@ BEGIN_CASE(JSOP_NEWINIT)
|
||||
RootedObject &obj = rootObject0;
|
||||
NewObjectKind newKind;
|
||||
if (i == JSProto_Array) {
|
||||
newKind = UseNewTypeForInitializer(cx, script, regs.pc, &ArrayObject::class_);
|
||||
newKind = UseNewTypeForInitializer(script, regs.pc, &ArrayObject::class_);
|
||||
obj = NewDenseEmptyArray(cx, nullptr, newKind);
|
||||
} else {
|
||||
gc::AllocKind allocKind = GuessObjectGCKind(0);
|
||||
newKind = UseNewTypeForInitializer(cx, script, regs.pc, &JSObject::class_);
|
||||
newKind = UseNewTypeForInitializer(script, regs.pc, &JSObject::class_);
|
||||
obj = NewBuiltinClassInstance(cx, &JSObject::class_, allocKind, newKind);
|
||||
}
|
||||
if (!obj || !SetInitializerObjectType(cx, script, regs.pc, obj, newKind))
|
||||
@ -2925,7 +2925,7 @@ BEGIN_CASE(JSOP_NEWARRAY)
|
||||
{
|
||||
unsigned count = GET_UINT24(regs.pc);
|
||||
RootedObject &obj = rootObject0;
|
||||
NewObjectKind newKind = UseNewTypeForInitializer(cx, script, regs.pc, &ArrayObject::class_);
|
||||
NewObjectKind newKind = UseNewTypeForInitializer(script, regs.pc, &ArrayObject::class_);
|
||||
obj = NewDenseAllocatedArray(cx, count, nullptr, newKind);
|
||||
if (!obj || !SetInitializerObjectType(cx, script, regs.pc, obj, newKind))
|
||||
goto error;
|
||||
@ -2941,7 +2941,7 @@ BEGIN_CASE(JSOP_NEWOBJECT)
|
||||
baseobj = script->getObject(regs.pc);
|
||||
|
||||
RootedObject &obj = rootObject1;
|
||||
NewObjectKind newKind = UseNewTypeForInitializer(cx, script, regs.pc, baseobj->getClass());
|
||||
NewObjectKind newKind = UseNewTypeForInitializer(script, regs.pc, baseobj->getClass());
|
||||
obj = CopyInitializerObject(cx, baseobj, newKind);
|
||||
if (!obj || !SetInitializerObjectType(cx, script, regs.pc, obj, newKind))
|
||||
goto error;
|
||||
|
@ -1645,7 +1645,7 @@ class TypedArrayObjectTemplate : public TypedArrayObject
|
||||
jsbytecode *pc;
|
||||
RootedScript script(cx, cx->currentScript(&pc));
|
||||
NewObjectKind newKind = script
|
||||
? UseNewTypeForInitializer(cx, script, pc, fastClass())
|
||||
? UseNewTypeForInitializer(script, pc, fastClass())
|
||||
: GenericObject;
|
||||
RootedObject obj(cx, NewBuiltinClassInstance(cx, fastClass(), newKind));
|
||||
if (!obj)
|
||||
@ -2664,7 +2664,7 @@ DataViewNewObjectKind(JSContext *cx, uint32_t byteLength, JSObject *proto)
|
||||
JSScript *script = cx->currentScript(&pc);
|
||||
if (!script)
|
||||
return GenericObject;
|
||||
return types::UseNewTypeForInitializer(cx, script, pc, &DataViewObject::class_);
|
||||
return types::UseNewTypeForInitializer(script, pc, &DataViewObject::class_);
|
||||
}
|
||||
|
||||
inline DataViewObject *
|
||||
|
Loading…
x
Reference in New Issue
Block a user