mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-07 04:05:49 +00:00
Bug 772328 - add and use IsArgOp and IsLocalOp (r=ejpbruel)
--HG-- extra : rebase_source : ce6464d39bd7f8e273d6ec7df1f4a447a22f98b1
This commit is contained in:
parent
cc03ccf529
commit
deb9094cdb
@ -278,8 +278,8 @@ frontend::Emit3(JSContext *cx, BytecodeEmitter *bce, JSOp op, jsbytecode op1,
|
||||
jsbytecode op2)
|
||||
{
|
||||
/* These should filter through EmitVarOp. */
|
||||
JS_ASSERT(JOF_OPTYPE(op) != JOF_QARG);
|
||||
JS_ASSERT(JOF_OPTYPE(op) != JOF_LOCAL);
|
||||
JS_ASSERT(!IsArgOp(op));
|
||||
JS_ASSERT(!IsLocalOp(op));
|
||||
|
||||
ptrdiff_t offset = EmitCheck(cx, bce, 3);
|
||||
|
||||
@ -917,11 +917,11 @@ EmitAliasedVarOp(JSContext *cx, JSOp op, ParseNode *pn, BytecodeEmitter *bce)
|
||||
}
|
||||
|
||||
ScopeCoordinate sc;
|
||||
if (JOF_OPTYPE(pn->getOp()) == JOF_QARG) {
|
||||
if (IsArgOp(pn->getOp())) {
|
||||
sc.hops = skippedScopes + ClonedBlockDepth(bceOfDef);
|
||||
sc.slot = bceOfDef->sc->bindings.formalIndexToSlot(pn->pn_cookie.slot());
|
||||
} else {
|
||||
JS_ASSERT(JOF_OPTYPE(pn->getOp()) == JOF_LOCAL || pn->isKind(PNK_FUNCTION));
|
||||
JS_ASSERT(IsLocalOp(pn->getOp()) || pn->isKind(PNK_FUNCTION));
|
||||
unsigned local = pn->pn_cookie.slot();
|
||||
if (local < bceOfDef->sc->bindings.numVars()) {
|
||||
sc.hops = skippedScopes + ClonedBlockDepth(bceOfDef);
|
||||
@ -946,7 +946,7 @@ static bool
|
||||
EmitVarOp(JSContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce)
|
||||
{
|
||||
JS_ASSERT(pn->isKind(PNK_FUNCTION) || pn->isKind(PNK_NAME));
|
||||
JS_ASSERT_IF(pn->isKind(PNK_NAME), JOF_OPTYPE(op) == JOF_QARG || JOF_OPTYPE(op) == JOF_LOCAL);
|
||||
JS_ASSERT_IF(pn->isKind(PNK_NAME), IsArgOp(op) || IsLocalOp(op));
|
||||
JS_ASSERT(!pn->pn_cookie.isFree());
|
||||
|
||||
if (!bce->isAliasedName(pn)) {
|
||||
@ -970,7 +970,7 @@ static bool
|
||||
EmitVarIncDec(JSContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce)
|
||||
{
|
||||
JS_ASSERT(pn->isKind(PNK_NAME));
|
||||
JS_ASSERT(JOF_OPTYPE(op) == JOF_QARG || JOF_OPTYPE(op) == JOF_LOCAL);
|
||||
JS_ASSERT(IsArgOp(op) || IsLocalOp(op));
|
||||
JS_ASSERT(js_CodeSpec[op].format & (JOF_INC | JOF_DEC));
|
||||
JS_ASSERT(!pn->pn_cookie.isFree());
|
||||
|
||||
@ -2697,7 +2697,7 @@ MaybeEmitVarDecl(JSContext *cx, BytecodeEmitter *bce, JSOp prologOp, ParseNode *
|
||||
}
|
||||
|
||||
if (bce->sc->inFunction() &&
|
||||
JOF_OPTYPE(pn->getOp()) == JOF_LOCAL &&
|
||||
IsLocalOp(pn->getOp()) &&
|
||||
!pn->isLet() &&
|
||||
bce->shouldNoteClosedName(pn))
|
||||
{
|
||||
@ -6130,7 +6130,7 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
||||
continue;
|
||||
if (!BindNameToSlot(cx, bce, pn2))
|
||||
return false;
|
||||
if (JOF_OPTYPE(pn2->getOp()) == JOF_QARG && bce->shouldNoteClosedName(pn2)) {
|
||||
if (IsArgOp(pn2->getOp()) && bce->shouldNoteClosedName(pn2)) {
|
||||
if (!bce->noteClosedArg(pn2))
|
||||
return false;
|
||||
}
|
||||
|
@ -486,6 +486,18 @@ FlowsIntoNext(JSOp op)
|
||||
op != JSOP_GOTO && op != JSOP_RETSUB;
|
||||
}
|
||||
|
||||
inline bool
|
||||
IsArgOp(JSOp op)
|
||||
{
|
||||
return JOF_OPTYPE(op) == JOF_QARG;
|
||||
}
|
||||
|
||||
inline bool
|
||||
IsLocalOp(JSOp op)
|
||||
{
|
||||
return JOF_OPTYPE(op) == JOF_LOCAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Counts accumulated for a single opcode in a script. The counts tracked vary
|
||||
* between opcodes, and this structure ensures that counts are accessed in a
|
||||
|
Loading…
Reference in New Issue
Block a user