Bug 838813 part 8 - Remove SRC_LABEL and SRC_LABELBRACE. r=njn.

--HG--
extra : rebase_source : 4d6e2c9c541e9021f28c1d689af5f074fa5b4b46
This commit is contained in:
Jason Orendorff 2013-02-08 17:20:03 -06:00
parent e71356e4f5
commit 8a32dcd7b5
3 changed files with 2 additions and 29 deletions

View File

@ -5317,8 +5317,7 @@ EmitLabel(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
{
/*
* Emit a JSOP_LABEL instruction. The argument is the offset to the statement
* following the labeled statement. This op has either a SRC_LABEL or
* SRC_LABELBRACE source note for the decompiler.
* following the labeled statement.
*/
JSAtom *atom = pn->pn_atom;
@ -5326,16 +5325,6 @@ EmitLabel(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
if (!bce->makeAtomIndex(atom, &index))
return false;
ParseNode *pn2 = pn->expr();
SrcNoteType noteType = (pn2->isKind(PNK_STATEMENTLIST) ||
(pn2->isKind(PNK_LEXICALSCOPE) &&
pn2->expr()->isKind(PNK_STATEMENTLIST)))
? SRC_LABELBRACE
: SRC_LABEL;
ptrdiff_t noteIndex = NewSrcNote2(cx, bce, noteType, ptrdiff_t(index));
if (noteIndex < 0)
return false;
ptrdiff_t top = EmitJump(cx, bce, JSOP_LABEL, 0);
if (top < 0)
return false;
@ -5344,20 +5333,13 @@ EmitLabel(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
StmtInfoBCE stmtInfo(cx);
PushStatementBCE(bce, &stmtInfo, STMT_LABEL, bce->offset());
stmtInfo.label = atom;
if (!EmitTree(cx, bce, pn2))
if (!EmitTree(cx, bce, pn->expr()))
return false;
if (!PopStatementBCE(cx, bce))
return false;
/* Patch the JSOP_LABEL offset. */
SetJumpOffsetAt(bce, top);
/* If the statement was compound, emit a note for the end brace. */
if (noteType == SRC_LABELBRACE) {
if (NewSrcNote(cx, bce, SRC_ENDBRACE) < 0 || Emit1(cx, bce, JSOP_NOP) < 0)
return false;
}
return true;
}

View File

@ -279,8 +279,6 @@ enum SrcNoteType {
SRC_ASSIGNOP = 8, /* += or another assign-op follows */
SRC_COND = 9, /* JSOP_IFEQ is from conditional ?: operator */
SRC_HIDDEN = 11, /* opcode shouldn't be decompiled */
SRC_LABEL = 13, /* JSOP_LABEL for label: with atomid immediate */
SRC_LABELBRACE = 14, /* JSOP_LABEL for label: {...} begin brace */
SRC_ENDBRACE = 15, /* JSOP_NOP for label: {...} end brace */
SRC_BREAK2LABEL = 16, /* JSOP_GOTO for 'break label' with atomid */
SRC_CONT2LABEL = 17, /* JSOP_GOTO for 'continue label' with atomid */

View File

@ -1718,11 +1718,6 @@ SrcNotes(JSContext *cx, HandleScript script, Sprinter *sp)
offset += delta;
SrcNoteType type = (SrcNoteType) SN_TYPE(sn);
const char *name = js_SrcNoteSpec[type].name;
if (type == SRC_LABEL) {
/* Check if the source note is for a switch case. */
if (switchTableStart <= offset && offset < switchTableEnd)
name = "case";
}
Sprint(sp, "%3u: %4u %5u [%4u] %-8s", unsigned(sn - notes), lineno, offset, delta, name);
switch (type) {
case SRC_COLSPAN:
@ -1754,8 +1749,6 @@ SrcNotes(JSContext *cx, HandleScript script, Sprinter *sp)
case SRC_PCDELTA:
Sprint(sp, " offset %u", unsigned(js_GetSrcNoteOffset(sn, 0)));
break;
case SRC_LABEL:
case SRC_LABELBRACE:
case SRC_BREAK2LABEL:
case SRC_CONT2LABEL: {
uint32_t index = js_GetSrcNoteOffset(sn, 0);