зеркало из https://github.com/mozilla/gecko-dev.git
Fix exception bytecodes to use script->main (18926, r=jband@netscape.com).
This commit is contained in:
Родитель
3086df2ec9
Коммит
19d94f3391
12
js/src/js.c
12
js/src/js.c
|
@ -772,7 +772,7 @@ LineToPC(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
pc = JS_LineNumberToPC(cx, script, lineno);
|
||||
if (!pc)
|
||||
return JS_FALSE;
|
||||
*rval = INT_TO_JSVAL(pc - script->code);
|
||||
*rval = INT_TO_JSVAL(PTRDIFF(pc, script->code, jsbytecode));
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
@ -811,7 +811,8 @@ SrcNotes(JSContext *cx, JSScript *script)
|
|||
delta = SN_DELTA(sn);
|
||||
offset += delta;
|
||||
fprintf(gOutFile, "%3u: %5u [%4u] %-8s",
|
||||
sn - notes, offset, delta, js_SrcNoteName[SN_TYPE(sn)]);
|
||||
PTRDIFF(sn, notes, jssrcnote), offset, delta,
|
||||
js_SrcNoteName[SN_TYPE(sn)]);
|
||||
type = SN_TYPE(sn);
|
||||
switch (type) {
|
||||
case SRC_SETLINE:
|
||||
|
@ -988,8 +989,9 @@ DisassWithSrc(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval
|
|||
}
|
||||
}
|
||||
|
||||
len = js_Disassemble1(cx, script, pc, pc - script->code,
|
||||
JS_TRUE, stdout);
|
||||
len = js_Disassemble1(cx, script, pc,
|
||||
PTRDIFF(pc, script->code, jsbytecode),
|
||||
JS_TRUE, stdout);
|
||||
if (!len)
|
||||
return JS_FALSE;
|
||||
pc += len;
|
||||
|
@ -1670,7 +1672,7 @@ my_ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report)
|
|||
report->linebuf,
|
||||
(n > 0 && report->linebuf[n-1] == '\n') ? "" : "\n",
|
||||
prefix);
|
||||
n = report->tokenptr - report->linebuf;
|
||||
n = PTRDIFF(report->tokenptr, report->linebuf, char);
|
||||
for (i = j = 0; i < n; i++) {
|
||||
if (report->linebuf[i] == '\t') {
|
||||
for (k = (j + 8) & ~7; j < k; j++) {
|
||||
|
|
|
@ -1106,8 +1106,9 @@ js_Interpret(JSContext *cx, jsval *result)
|
|||
intN nuses, n;
|
||||
|
||||
fprintf(tracefp, "%4u: ", js_PCToLineNumber(script, pc));
|
||||
js_Disassemble1(cx, script, pc, pc - script->code, JS_FALSE,
|
||||
tracefp);
|
||||
js_Disassemble1(cx, script, pc,
|
||||
PTRDIFF(pc, script->code, jsbytecode), JS_FALSE,
|
||||
tracefp);
|
||||
nuses = cs->nuses;
|
||||
if (nuses) {
|
||||
fp->sp = sp - nuses;
|
||||
|
@ -2853,7 +2854,7 @@ js_Interpret(JSContext *cx, jsval *result)
|
|||
case JSOP_GOSUB:
|
||||
len = GET_JUMP_OFFSET(pc);
|
||||
JS_ASSERT(js_CodeSpec[JSOP_GOSUB].length == 3);
|
||||
i = pc - script->code + 3;
|
||||
i = PTRDIFF(pc, script->main, jsbytecode) + 3;
|
||||
PUSH(INT_TO_JSVAL(i));
|
||||
break;
|
||||
|
||||
|
@ -2861,7 +2862,7 @@ js_Interpret(JSContext *cx, jsval *result)
|
|||
rval = POP();
|
||||
JS_ASSERT(JSVAL_IS_INT(rval));
|
||||
i = JSVAL_TO_INT(rval);
|
||||
pc = script->code + i;
|
||||
pc = script->main + i;
|
||||
len = 0;
|
||||
break;
|
||||
|
||||
|
@ -3008,11 +3009,11 @@ out:
|
|||
*/
|
||||
tn = script->trynotes;
|
||||
if (tn) {
|
||||
offset = PTRDIFF(pc, script->code, jsbytecode);
|
||||
offset = PTRDIFF(pc, script->main, jsbytecode);
|
||||
while (JS_UPTRDIFF(offset, tn->start) >= (jsuword)tn->length)
|
||||
tn++;
|
||||
if (tn->catchStart) {
|
||||
pc = script->code + tn->catchStart;
|
||||
pc = script->main + tn->catchStart;
|
||||
len = 0;
|
||||
cx->throwing = JS_FALSE; /* caught */
|
||||
ok = JS_TRUE;
|
||||
|
|
|
@ -114,7 +114,9 @@ js_Disassemble(JSContext *cx, JSScript *script, JSBool lines, FILE *fp)
|
|||
while (pc < end) {
|
||||
if (pc == script->main)
|
||||
fputs("main:\n", fp);
|
||||
len = js_Disassemble1(cx, script, pc, pc - script->code, lines, fp);
|
||||
len = js_Disassemble1(cx, script, pc,
|
||||
PTRDIFF(pc, script->code, jsbytecode),
|
||||
lines, fp);
|
||||
if (!len)
|
||||
return;
|
||||
pc += len;
|
||||
|
|
Загрузка…
Ссылка в новой задаче