Renamed SRC_COMMA to SRC_PCDELTA and fixed related comments.
git-svn-id: svn://10.0.0.236/trunk@9590 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -565,8 +565,8 @@ SrcNotes(JSContext *cx, JSFunction *fun )
|
||||
(uintN) js_GetSrcNoteOffset(sn, 1),
|
||||
(uintN) js_GetSrcNoteOffset(sn, 2));
|
||||
break;
|
||||
case SRC_COMMA:
|
||||
case SRC_PCBASE:
|
||||
case SRC_PCDELTA:
|
||||
printf(" offset %u", (uintN) js_GetSrcNoteOffset(sn, 0));
|
||||
break;
|
||||
case SRC_LABEL:
|
||||
|
||||
@@ -863,7 +863,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
}
|
||||
if (pn3->pn_type == TOK_DEFAULT)
|
||||
continue;
|
||||
caseNoteIndex = js_NewSrcNote2(cx, cg, SRC_COMMA, 0);
|
||||
caseNoteIndex = js_NewSrcNote2(cx, cg, SRC_PCDELTA, 0);
|
||||
if (caseNoteIndex < 0)
|
||||
return JS_FALSE;
|
||||
off = js_Emit3(cx, cg, JSOP_CASE, 0, 0);
|
||||
@@ -1548,7 +1548,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
if (!pn2->pn_next)
|
||||
break;
|
||||
off = tmp;
|
||||
noteIndex = js_NewSrcNote2(cx, cg, SRC_COMMA, 0);
|
||||
noteIndex = js_NewSrcNote2(cx, cg, SRC_PCDELTA, 0);
|
||||
if (noteIndex < 0 ||
|
||||
js_Emit1(cx, cg, JSOP_POP) < 0) {
|
||||
return JS_FALSE;
|
||||
@@ -1626,7 +1626,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
|
||||
case TOK_COMMA:
|
||||
/*
|
||||
* Emit SRC_COMMA notes on each JSOP_POP between comma operands.
|
||||
* Emit SRC_PCDELTA notes on each JSOP_POP between comma operands.
|
||||
* These notes help the decompiler bracket the bytecodes generated
|
||||
* from each sub-expression that follows a comma.
|
||||
*/
|
||||
@@ -1642,7 +1642,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
if (!pn2->pn_next)
|
||||
break;
|
||||
off = tmp;
|
||||
noteIndex = js_NewSrcNote2(cx, cg, SRC_COMMA, 0);
|
||||
noteIndex = js_NewSrcNote2(cx, cg, SRC_PCDELTA, 0);
|
||||
if (noteIndex < 0 ||
|
||||
js_Emit1(cx, cg, JSOP_POP) < 0) {
|
||||
return JS_FALSE;
|
||||
@@ -2016,7 +2016,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
|
||||
if (pn->pn_extra) {
|
||||
/* Emit a source note so we know to decompile an extra comma. */
|
||||
if (js_NewSrcNote(cx, cg, SRC_COMMA) < 0)
|
||||
if (js_NewSrcNote(cx, cg, SRC_PCDELTA) < 0)
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
@@ -2170,7 +2170,7 @@ JS_FRIEND_DATA(const char *) js_SrcNoteName[] = {
|
||||
"for",
|
||||
"continue",
|
||||
"var",
|
||||
"comma",
|
||||
"pcdelta",
|
||||
"assignop",
|
||||
"cond",
|
||||
"paren",
|
||||
@@ -2198,7 +2198,7 @@ uint8 js_SrcNoteArity[] = {
|
||||
3, /* SRC_FOR */
|
||||
0, /* SRC_CONTINUE */
|
||||
0, /* SRC_VAR */
|
||||
1, /* SRC_COMMA */
|
||||
1, /* SRC_PCDELTA */
|
||||
0, /* SRC_ASSIGNOP */
|
||||
0, /* SRC_COND */
|
||||
0, /* SRC_PAREN */
|
||||
|
||||
@@ -231,7 +231,8 @@ typedef enum JSSrcNoteType {
|
||||
SRC_FOR = 4, /* JSOP_NOP or JSOP_POP in for loop head */
|
||||
SRC_CONTINUE = 5, /* JSOP_GOTO is a continue, not a break */
|
||||
SRC_VAR = 6, /* JSOP_NAME/FORNAME with a var declaration */
|
||||
SRC_COMMA = 7, /* JSOP_POP representing a comma operator */
|
||||
SRC_PCDELTA = 7, /* offset from comma-operator to next POP,
|
||||
or from CONDSWITCH to first CASE opcode */
|
||||
SRC_ASSIGNOP = 8, /* += or another assign-op follows */
|
||||
SRC_COND = 9, /* JSOP_IFEQ is from conditional ?: operator */
|
||||
SRC_PAREN = 10, /* JSOP_NOP generated to mark user parens */
|
||||
|
||||
@@ -938,7 +938,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
|
||||
todo = -2;
|
||||
goto do_forloop;
|
||||
|
||||
case SRC_COMMA:
|
||||
case SRC_PCDELTA:
|
||||
/* Pop and save to avoid blowing stack depth budget. */
|
||||
lval = JS_strdup(cx, POP_STR());
|
||||
if (!lval)
|
||||
@@ -1681,7 +1681,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
|
||||
off2 = 0;
|
||||
} else {
|
||||
sn = js_GetSrcNote(jp->script, pc2);
|
||||
PR_ASSERT(sn && SN_TYPE(sn) == SRC_COMMA);
|
||||
PR_ASSERT(sn && SN_TYPE(sn) == SRC_PCDELTA);
|
||||
off2 = js_GetSrcNoteOffset(sn, 0);
|
||||
}
|
||||
}
|
||||
@@ -1704,7 +1704,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
|
||||
table[i].offset = caseOff + GET_JUMP_OFFSET(pc2);
|
||||
if (*pc2 == JSOP_CASE) {
|
||||
sn = js_GetSrcNote(jp->script, pc2);
|
||||
PR_ASSERT(sn && SN_TYPE(sn) == SRC_COMMA);
|
||||
PR_ASSERT(sn && SN_TYPE(sn) == SRC_PCDELTA);
|
||||
off2 = js_GetSrcNoteOffset(sn, 0);
|
||||
}
|
||||
}
|
||||
@@ -1860,7 +1860,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
|
||||
sn = js_GetSrcNote(jp->script, pc);
|
||||
todo = Sprint(&ss->sprinter, "%s%s%c",
|
||||
rval,
|
||||
(sn && SN_TYPE(sn) == SRC_COMMA) ? ", " : "",
|
||||
(sn && SN_TYPE(sn) == SRC_PCDELTA) ? ", " : "",
|
||||
/* [balance */
|
||||
(*rval == '{') ? '}' : ']');
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user