[Bug 424693] using jsop_lineno to speedup pc->lineno mapping needed for eval. r=shaver a1.9b5=beltzner

This commit is contained in:
igor@mir2.org 2008-03-24 10:00:01 -07:00
parent 94ce9766fc
commit 95ffa3c835
5 changed files with 16 additions and 5 deletions

View File

@ -5924,6 +5924,8 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
argc = pn->pn_count - 1;
if (js_Emit3(cx, cg, PN_OP(pn), ARGC_HI(argc), ARGC_LO(argc)) < 0)
return JS_FALSE;
if (PN_OP(pn) == JSOP_EVAL)
EMIT_UINT16_IMM_OP(JSOP_LINENO, pn->pn_pos.begin.lineno);
break;
}

View File

@ -2764,6 +2764,10 @@ interrupt:
EMPTY_CASE(JSOP_GROUP)
/* EMPTY_CASE is not used here as JSOP_LINENO_LENGTH == 3. */
BEGIN_CASE(JSOP_LINENO)
END_CASE(JSOP_LINENO)
BEGIN_CASE(JSOP_PUSH)
PUSH_OPND(JSVAL_VOID);
END_CASE(JSOP_PUSH)

View File

@ -1147,8 +1147,13 @@ js_ComputeFilename(JSContext *cx, JSStackFrame *caller,
return principals->codebase;
}
*linenop = js_PCToLineNumber(cx, caller->script,
caller->regs ? caller->regs->pc : NULL);
if (caller->regs && *caller->regs->pc == JSOP_EVAL) {
JS_ASSERT(caller->regs->pc[JSOP_EVAL_LENGTH] == JSOP_LINENO);
*linenop = GET_UINT16(caller->regs->pc + JSOP_EVAL_LENGTH);
} else {
*linenop = js_PCToLineNumber(cx, caller->script,
caller->regs ? caller->regs->pc : NULL);
}
return caller->script->filename;
}

View File

@ -265,8 +265,8 @@ OPDEF(JSOP_RETSUB, 115,"retsub", NULL, 1, 0, 0, 0, JOF_BYTE)
/* More exception handling ops. */
OPDEF(JSOP_EXCEPTION, 116,"exception", NULL, 1, 0, 1, 0, JOF_BYTE)
/* Unused, formerly JSOP_GLOBALTHIS. */
OPDEF(JSOP_UNUSED117, 117,"unused117", NULL, 1, 0, 0, 0, JOF_BYTE)
/* Embedded lineno to speedup pc->line mapping. */
OPDEF(JSOP_LINENO, 117,"lineno", NULL, 3, 0, 0, 0, JOF_UINT16)
/*
* ECMA-compliant switch statement ops.

View File

@ -202,7 +202,7 @@ JS_XDRFindClassById(JSXDRState *xdr, uint32 id);
* before deserialization of bytecode. If the saved version does not match
* the current version, abort deserialization and invalidate the file.
*/
#define JSXDR_BYTECODE_VERSION (0xb973c0de - 21)
#define JSXDR_BYTECODE_VERSION (0xb973c0de - 22)
/*
* Library-private functions.