Merge cvs-trunk-mirror to mozilla-central. Automated merge, no manual conflict resolution necessary.
This commit is contained in:
@@ -1606,18 +1606,8 @@ InitSprintStack(JSContext *cx, SprintStack *ss, JSPrinter *jp, uintN depth)
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* If nb is non-negative, decompile nb bytecodes starting at pc. Otherwise
|
||||
* the decompiler starts at pc and continues until it reaches an opcode for
|
||||
* which decompiling would result in the stack depth equaling -(nb + 1).
|
||||
*
|
||||
* The nextop parameter is either JSOP_NOP or the "next" opcode in order of
|
||||
* abstract interpretation (not necessarily physically next in a bytecode
|
||||
* vector). So nextop is JSOP_POP for the last operand in a comma expression,
|
||||
* or JSOP_AND for the right operand of &&.
|
||||
*/
|
||||
static jsbytecode *
|
||||
Decompile(SprintStack *ss, jsbytecode *pc, intN nb, JSOp nextop)
|
||||
static JS_INLINE jsbytecode *
|
||||
DecompileBytecode(SprintStack *ss, jsbytecode *pc, intN nb, JSOp nextop)
|
||||
{
|
||||
JSContext *cx;
|
||||
JSPrinter *jp, *jp2;
|
||||
@@ -1724,7 +1714,6 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb, JSOp nextop)
|
||||
JS_END_MACRO
|
||||
|
||||
cx = ss->sprinter.context;
|
||||
JS_CHECK_RECURSION(cx, return NULL);
|
||||
|
||||
jp = ss->printer;
|
||||
startpc = pc;
|
||||
@@ -1830,9 +1819,9 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb, JSOp nextop)
|
||||
: JSOP_GETELEM);
|
||||
} else {
|
||||
/*
|
||||
* Zero mode means precisely that op is uncategorized
|
||||
* for our purposes, so we must write per-op special
|
||||
* case code here.
|
||||
* Unknown mode (including mode 0) means that op is
|
||||
* uncategorized for our purposes, so we must write
|
||||
* per-op special case code here.
|
||||
*/
|
||||
switch (op) {
|
||||
case JSOP_ENUMELEM:
|
||||
@@ -1854,6 +1843,12 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb, JSOp nextop)
|
||||
op = JSOP_GETLOCAL;
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* NB: JSOP_GETTHISPROP can't happen here, as
|
||||
* there is no way (yet, watch out for proposed
|
||||
* ES4/JS2 strict mode) for this to be null or
|
||||
* undefined at runtime.
|
||||
*/
|
||||
LOCAL_ASSERT(0);
|
||||
}
|
||||
}
|
||||
@@ -4551,6 +4546,46 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb, JSOp nextop)
|
||||
return pc;
|
||||
}
|
||||
|
||||
/*
|
||||
* If nb is non-negative, decompile nb bytecodes starting at pc. Otherwise
|
||||
* the decompiler starts at pc and continues until it reaches an opcode for
|
||||
* which decompiling would result in the stack depth equaling -(nb + 1).
|
||||
*
|
||||
* The nextop parameter is either JSOP_NOP or the "next" opcode in order of
|
||||
* abstract interpretation (not necessarily physically next in a bytecode
|
||||
* vector). So nextop is JSOP_POP for the last operand in a comma expression,
|
||||
* or JSOP_AND for the right operand of &&.
|
||||
*/
|
||||
static jsbytecode *
|
||||
Decompile(SprintStack *ss, jsbytecode *pc, intN nb, JSOp nextop)
|
||||
{
|
||||
JSContext *cx;
|
||||
JSPrinter *jp;
|
||||
jsbytecode *oldcode, *oldmain, *code;
|
||||
|
||||
cx = ss->sprinter.context;
|
||||
JS_CHECK_RECURSION(cx, return NULL);
|
||||
|
||||
jp = ss->printer;
|
||||
oldcode = jp->script->code;
|
||||
oldmain = jp->script->main;
|
||||
code = js_UntrapScriptCode(cx, jp->script);
|
||||
if (code != oldcode) {
|
||||
jp->script->code = code;
|
||||
jp->script->main = code + (oldmain - jp->script->code);
|
||||
pc = code + (pc - oldcode);
|
||||
}
|
||||
|
||||
pc = DecompileBytecode(ss, pc, nb, nextop);
|
||||
|
||||
if (code != oldcode) {
|
||||
JS_free(cx, jp->script->code);
|
||||
jp->script->code = oldcode;
|
||||
jp->script->main = oldmain;
|
||||
}
|
||||
return (pc ? pc - code + oldcode : NULL);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
DecompileCode(JSPrinter *jp, JSScript *script, jsbytecode *pc, uintN len,
|
||||
uintN pcdepth)
|
||||
|
||||
Reference in New Issue
Block a user