mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-13 10:25:01 +00:00
Use persistent type sets for initializer opcodes, bug 714600. r=dvander
This commit is contained in:
parent
cb01e05f33
commit
81b6aa3645
@ -4765,6 +4765,7 @@ EmitNewInit(JSContext *cx, BytecodeEmitter *bce, JSProtoKey key, ParseNode *pn,
|
||||
{
|
||||
if (Emit3(cx, bce, JSOP_NEWINIT, (jsbytecode) key, 0) < 0)
|
||||
return false;
|
||||
CheckTypeSet(cx, bce, JSOP_NEWINIT);
|
||||
#if JS_HAS_SHARP_VARS
|
||||
if (bce->hasSharps()) {
|
||||
if (pn->pn_count != 0)
|
||||
@ -6977,6 +6978,7 @@ EmitArray(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, jsint sharpnum)
|
||||
ptrdiff_t off = EmitN(cx, bce, JSOP_NEWARRAY, 3);
|
||||
if (off < 0)
|
||||
return false;
|
||||
CheckTypeSet(cx, bce, JSOP_NEWARRAY);
|
||||
jsbytecode *pc = bce->code(off);
|
||||
SET_UINT24(pc, pn->pn_count);
|
||||
}
|
||||
|
@ -3896,14 +3896,16 @@ ScriptAnalysis::analyzeTypesBytecode(JSContext *cx, unsigned offset,
|
||||
case JSOP_NEWARRAY:
|
||||
case JSOP_NEWOBJECT: {
|
||||
TypeObject *initializer = GetInitializerType(cx, script, pc);
|
||||
TypeSet *types = script->analysis()->bytecodeTypes(pc);
|
||||
if (script->hasGlobal()) {
|
||||
if (!initializer)
|
||||
return false;
|
||||
pushed[0].addType(cx, Type::ObjectType(initializer));
|
||||
types->addType(cx, Type::ObjectType(initializer));
|
||||
} else {
|
||||
JS_ASSERT(!initializer);
|
||||
pushed[0].addType(cx, Type::UnknownType());
|
||||
types->addType(cx, Type::UnknownType());
|
||||
}
|
||||
types->addSubset(cx, &pushed[0]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -251,9 +251,9 @@ OPDEF(JSOP_UINT16, 88, "uint16", NULL, 3, 0, 1, 16, JOF_UINT16
|
||||
* shape, which can be set at the start and slots then filled in directly.
|
||||
* NEWINIT has an extra byte so it can be exchanged with NEWOBJECT during emit.
|
||||
*/
|
||||
OPDEF(JSOP_NEWINIT, 89, "newinit", NULL, 3, 0, 1, 19, JOF_UINT8)
|
||||
OPDEF(JSOP_NEWARRAY, 90, "newarray", NULL, 4, 0, 1, 19, JOF_UINT24)
|
||||
OPDEF(JSOP_NEWOBJECT, 91, "newobject", NULL, 3, 0, 1, 19, JOF_OBJECT)
|
||||
OPDEF(JSOP_NEWINIT, 89, "newinit", NULL, 3, 0, 1, 19, JOF_UINT8|JOF_TYPESET)
|
||||
OPDEF(JSOP_NEWARRAY, 90, "newarray", NULL, 4, 0, 1, 19, JOF_UINT24|JOF_TYPESET)
|
||||
OPDEF(JSOP_NEWOBJECT, 91, "newobject", NULL, 3, 0, 1, 19, JOF_OBJECT|JOF_TYPESET)
|
||||
OPDEF(JSOP_ENDINIT, 92, "endinit", NULL, 1, 0, 0, 19, JOF_BYTE)
|
||||
OPDEF(JSOP_INITPROP, 93, "initprop", NULL, 3, 2, 1, 3, JOF_ATOM|JOF_PROP|JOF_SET|JOF_DETECTING)
|
||||
OPDEF(JSOP_INITELEM, 94, "initelem", NULL, 1, 3, 1, 3, JOF_BYTE|JOF_ELEM|JOF_SET|JOF_DETECTING)
|
||||
|
Loading…
Reference in New Issue
Block a user