diff --git a/mozilla/js/ref/js.c b/mozilla/js/ref/js.c index 76f56953c8e..862632023ff 100644 --- a/mozilla/js/ref/js.c +++ b/mozilla/js/ref/js.c @@ -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: diff --git a/mozilla/js/ref/jsemit.c b/mozilla/js/ref/jsemit.c index b7f49902922..4e413a73e73 100644 --- a/mozilla/js/ref/jsemit.c +++ b/mozilla/js/ref/jsemit.c @@ -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 */ diff --git a/mozilla/js/ref/jsemit.h b/mozilla/js/ref/jsemit.h index 1d5056beb81..1843e382d62 100644 --- a/mozilla/js/ref/jsemit.h +++ b/mozilla/js/ref/jsemit.h @@ -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 */ diff --git a/mozilla/js/ref/jsopcode.c b/mozilla/js/ref/jsopcode.c index 41d42a9d388..df96c82d94e 100644 --- a/mozilla/js/ref/jsopcode.c +++ b/mozilla/js/ref/jsopcode.c @@ -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;