- GOSUB pushes the next pc after it, not its own pc (tradition!) and RETSUB

sets pc to the unbiased result of the pop.
- Use #if JS_HAS_EXCEPTIONS in the decompiler, fiddle similar cosmetic stuff.
This commit is contained in:
brendan%netscape.com 1998-09-10 20:42:26 +00:00
Родитель 1bc5e1fb65
Коммит 47030e2d0d
2 изменённых файлов: 10 добавлений и 4 удалений

Просмотреть файл

@ -1923,9 +1923,8 @@ js_Interpret(JSContext *cx, jsval *result)
if (!ok) {
cx->newborn[GCX_OBJECT] = NULL;
#if JS_HAS_EXCEPTIONS
if (cx->throwing) {
if (cx->throwing)
goto do_throw;
}
#endif
goto out;
}
@ -2631,14 +2630,17 @@ js_Interpret(JSContext *cx, jsval *result)
case JSOP_GOSUB:
len = GET_JUMP_OFFSET(pc);
PUSH(INT_TO_JSVAL(pc - script->code));
PR_ASSERT(js_CodeSpec[JSOP_GOSUB].length == 3);
i = pc - script->code + 3;
PUSH(INT_TO_JSVAL(i));
CHECK_BRANCH(len);
break;
case JSOP_RETSUB:
rval = POP();
PR_ASSERT(JSVAL_IS_INT(rval));
pc = script->code + JSVAL_TO_INT(rval) + 3 /* JSR */;
i = JSVAL_TO_INT(rval);
pc = script->code + i;
len = 0;
CHECK_BRANCH(-1);
break;

Просмотреть файл

@ -917,6 +917,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
todo = Sprint(&ss->sprinter, "");
break;
#if JS_HAS_EXCEPTIONS
case JSOP_GOSUB:
case JSOP_RETSUB:
case JSOP_SETSP:
@ -928,6 +929,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
if (sn && SN_TYPE(sn) == SRC_HIDDEN)
todo = -2;
break;
#endif /* JS_HAS_EXCEPTIONS */
case JSOP_POP:
case JSOP_POPV:
@ -1009,6 +1011,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
todo = -2;
break;
#if JS_HAS_EXCEPTIONS
case JSOP_THROW:
sn = js_GetSrcNote(jp->script, pc);
todo = -2;
@ -1017,6 +1020,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
rval = POP_STR();
js_printf(jp, "\t%s %s;\n", cs->name, rval);
break;
#endif /* JS_HAS_EXCEPTIONS */
case JSOP_GOTO:
sn = js_GetSrcNote(jp->script, pc);