Bug 815044: Make js_DecompileScript, and js_DecompileFunction static to jsopcode.cpp. Delete js_DecompileFunctionBody; it is unused. r=jorendorff

This commit is contained in:
Jim Blandy 2012-11-26 16:47:59 -08:00
parent 3921e89df1
commit 19a6d304d6
2 changed files with 10 additions and 32 deletions

View File

@ -1417,6 +1417,8 @@ ReconstructPCStack(JSContext *cx, JSScript *script, jsbytecode *pc, jsbytecode *
#define FAILED_EXPRESSION_DECOMPILER ((char *) 1)
static JSBool DecompileFunction(JSPrinter *jp);
/*
* Decompile a part of expression up to the given pc. The function returns
* NULL on out-of-memory, or the FAILED_EXPRESSION_DECOMPILER sentinel when
@ -2980,7 +2982,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
jp->strict);
if (!jp2)
return NULL;
ok = js_DecompileFunction(jp2);
ok = DecompileFunction(jp2);
if (ok && !jp2->sprinter.empty())
js_puts(jp, jp2->sprinter.string());
js_DestroyPrinter(jp2);
@ -4937,7 +4939,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
bool strict = jp->script->strictModeCode;
str = js_DecompileToString(cx, "lambda", fun, 0,
false, grouped, strict,
js_DecompileFunction);
DecompileFunction);
if (!str)
return NULL;
}
@ -5629,8 +5631,8 @@ DecompileBody(JSPrinter *jp, JSScript *script, jsbytecode *pc)
return DecompileCode(jp, script, pc, end - pc, 0);
}
JSBool
js_DecompileScript(JSPrinter *jp, JSScript *script)
static JSBool
DecompileScript(JSPrinter *jp, JSScript *script)
{
return DecompileBody(jp, script, script->code);
}
@ -5656,24 +5658,8 @@ js_DecompileToString(JSContext *cx, const char *name, JSFunction *fun,
static const char native_code_str[] = "\t[native code]\n";
JSBool
js_DecompileFunctionBody(JSPrinter *jp)
{
JSScript *script;
JS_ASSERT(jp->fun);
JS_ASSERT(!jp->script);
if (jp->fun->isNative() || jp->fun->isSelfHostedBuiltin()) {
js_printf(jp, native_code_str);
return JS_TRUE;
}
script = jp->fun->nonLazyScript().unsafeGet();
return DecompileBody(jp, script, script->code);
}
JSBool
js_DecompileFunction(JSPrinter *jp)
static JSBool
DecompileFunction(JSPrinter *jp)
{
JSContext *cx = jp->sprinter.context;
@ -7075,10 +7061,10 @@ GetPCCountJSON(JSContext *cx, const ScriptAndCounts &sac, StringBuffer &buf)
jp->decompiledOpcodes = &decompiledOpcodes;
if (fun) {
if (!js_DecompileFunction(jp))
if (!DecompileFunction(jp))
return false;
} else {
if (!js_DecompileScript(jp, script))
if (!DecompileScript(jp, script))
return false;
}
JSString *str = js_GetPrinterOutput(jp);

View File

@ -296,14 +296,6 @@ StackDefs(JSScript *script, jsbytecode *pc);
/*
* Decompilers, for script, function, and expression pretty-printing.
*/
extern JSBool
js_DecompileScript(JSPrinter *jp, JSScript *script);
extern JSBool
js_DecompileFunctionBody(JSPrinter *jp);
extern JSBool
js_DecompileFunction(JSPrinter *jp);
/*
* Some C++ compilers treat the language linkage (extern "C" vs.