mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 722121 - Remove JSOP_DEFFUN_FC, because it can never be generated. r=jorendorff
--HG-- extra : rebase_source : 75d2fd13bfa2b706bbc6f82493b5bd23d241e8ce
This commit is contained in:
parent
cff574d67b
commit
c0a49d053b
@ -5138,8 +5138,9 @@ EmitFunc(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
||||
return false;
|
||||
if (pn->pn_cookie.isFree()) {
|
||||
bce->switchToProlog();
|
||||
JSOp op = fun->isFlatClosure() ? JSOP_DEFFUN_FC : JSOP_DEFFUN;
|
||||
if (!EmitFunctionOp(cx, op, index, bce))
|
||||
MOZ_ASSERT(!fun->isFlatClosure(),
|
||||
"global functions can't have upvars, so they are never flat");
|
||||
if (!EmitFunctionOp(cx, JSOP_DEFFUN, index, bce))
|
||||
return false;
|
||||
bce->switchToMain();
|
||||
}
|
||||
|
@ -570,15 +570,20 @@ SetFunctionKinds(FunctionBox *funbox, uint32_t *tcflags, bool isDirectEval)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Top-level functions, and (extension) functions not at top level
|
||||
* which are also not directly within other functions, aren't
|
||||
* flattened.
|
||||
*/
|
||||
if (fn->isOp(JSOP_DEFFUN))
|
||||
canFlatten = false;
|
||||
|
||||
if (!hasUpvars) {
|
||||
/* No lexical dependencies => null closure, for best performance. */
|
||||
fun->setKind(JSFUN_NULL_CLOSURE);
|
||||
} else if (canFlatten) {
|
||||
fun->setKind(JSFUN_FLAT_CLOSURE);
|
||||
switch (fn->getOp()) {
|
||||
case JSOP_DEFFUN:
|
||||
fn->setOp(JSOP_DEFFUN_FC);
|
||||
break;
|
||||
case JSOP_DEFLOCALFUN:
|
||||
fn->setOp(JSOP_DEFLOCALFUN_FC);
|
||||
break;
|
||||
|
@ -3822,7 +3822,6 @@ ScriptAnalysis::analyzeTypesBytecode(JSContext *cx, unsigned offset,
|
||||
case JSOP_LAMBDA:
|
||||
case JSOP_LAMBDA_FC:
|
||||
case JSOP_DEFFUN:
|
||||
case JSOP_DEFFUN_FC:
|
||||
case JSOP_DEFLOCALFUN:
|
||||
case JSOP_DEFLOCALFUN_FC: {
|
||||
unsigned off = (op == JSOP_DEFLOCALFUN || op == JSOP_DEFLOCALFUN_FC) ? SLOTNO_LEN : 0;
|
||||
|
@ -1744,6 +1744,7 @@ ADD_EMPTY_CASE(JSOP_UNUSED13)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED14)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED15)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED16)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED17)
|
||||
ADD_EMPTY_CASE(JSOP_CONDSWITCH)
|
||||
ADD_EMPTY_CASE(JSOP_TRY)
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
@ -3268,35 +3269,6 @@ BEGIN_CASE(JSOP_DEFFUN)
|
||||
}
|
||||
END_CASE(JSOP_DEFFUN)
|
||||
|
||||
BEGIN_CASE(JSOP_DEFFUN_FC)
|
||||
{
|
||||
JSFunction *fun = script->getFunction(GET_UINT32_INDEX(regs.pc));
|
||||
|
||||
JSObject *obj = js_NewFlatClosure(cx, fun);
|
||||
if (!obj)
|
||||
goto error;
|
||||
|
||||
Value rval = ObjectValue(*obj);
|
||||
|
||||
uintN attrs = regs.fp()->isEvalFrame()
|
||||
? JSPROP_ENUMERATE
|
||||
: JSPROP_ENUMERATE | JSPROP_PERMANENT;
|
||||
|
||||
JSObject &parent = regs.fp()->varObj();
|
||||
|
||||
PropertyName *name = fun->atom->asPropertyName();
|
||||
if (!CheckRedeclaration(cx, &parent, name, attrs))
|
||||
goto error;
|
||||
|
||||
if ((attrs == JSPROP_ENUMERATE)
|
||||
? !parent.setProperty(cx, name, &rval, script->strictModeCode)
|
||||
: !parent.defineProperty(cx, name, rval, JS_PropertyStub, JS_StrictPropertyStub, attrs))
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
END_CASE(JSOP_DEFFUN_FC)
|
||||
|
||||
BEGIN_CASE(JSOP_DEFLOCALFUN)
|
||||
{
|
||||
/*
|
||||
|
@ -5133,11 +5133,9 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
|
||||
}
|
||||
|
||||
case JSOP_DEFFUN:
|
||||
case JSOP_DEFFUN_FC:
|
||||
fun = jp->script->getFunction(GET_UINT32_INDEX(pc));
|
||||
todo = -2;
|
||||
goto do_function;
|
||||
break;
|
||||
|
||||
case JSOP_HOLE:
|
||||
todo = SprintPut(&ss->sprinter, "", 0);
|
||||
|
@ -552,10 +552,11 @@ OPDEF(JSOP_LENGTH, 217, "length", NULL, 3, 1, 1, 18, JOF_ATOM|J
|
||||
*/
|
||||
OPDEF(JSOP_HOLE, 218, "hole", NULL, 1, 0, 1, 0, JOF_BYTE)
|
||||
|
||||
OPDEF(JSOP_UNUSED17, 219,"unused17", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
|
||||
/*
|
||||
* Variants of JSOP_{DEF{,LOCAL}FUN,LAMBDA} optimized for the flat closure case.
|
||||
* Variants of JSOP_{DEFLOCALFUN,LAMBDA} optimized for the flat closure case.
|
||||
*/
|
||||
OPDEF(JSOP_DEFFUN_FC, 219,"deffun_fc", NULL, 5, 0, 0, 0, JOF_OBJECT|JOF_DECLARING)
|
||||
OPDEF(JSOP_DEFLOCALFUN_FC,220,"deflocalfun_fc",NULL, 7, 0, 0, 0, JOF_SLOTOBJECT|JOF_DECLARING|JOF_TMPSLOT)
|
||||
OPDEF(JSOP_LAMBDA_FC, 221,"lambda_fc", NULL, 5, 0, 1, 19, JOF_OBJECT)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user