зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 723a2622ad4a: tracemonkey tinderbox build failures
This commit is contained in:
Родитель
749b3b1a03
Коммит
b3bb439766
|
@ -4902,8 +4902,7 @@ JS_DecompileScript(JSContext *cx, JSScript *script, const char *name,
|
|||
CHECK_REQUEST(cx);
|
||||
jp = JS_NEW_PRINTER(cx, name, NULL,
|
||||
indent & ~JS_DONT_PRETTY_PRINT,
|
||||
!(indent & JS_DONT_PRETTY_PRINT),
|
||||
false);
|
||||
!(indent & JS_DONT_PRETTY_PRINT));
|
||||
if (!jp)
|
||||
return NULL;
|
||||
if (js_DecompileScript(jp, script))
|
||||
|
@ -4917,21 +4916,41 @@ JS_DecompileScript(JSContext *cx, JSScript *script, const char *name,
|
|||
JS_PUBLIC_API(JSString *)
|
||||
JS_DecompileFunction(JSContext *cx, JSFunction *fun, uintN indent)
|
||||
{
|
||||
JSPrinter *jp;
|
||||
JSString *str;
|
||||
|
||||
CHECK_REQUEST(cx);
|
||||
return js_DecompileToString(cx, "JS_DecompileFunction", fun,
|
||||
indent & ~JS_DONT_PRETTY_PRINT,
|
||||
!(indent & JS_DONT_PRETTY_PRINT),
|
||||
false, js_DecompileFunction);
|
||||
jp = JS_NEW_PRINTER(cx, "JS_DecompileFunction", fun,
|
||||
indent & ~JS_DONT_PRETTY_PRINT,
|
||||
!(indent & JS_DONT_PRETTY_PRINT));
|
||||
if (!jp)
|
||||
return NULL;
|
||||
if (js_DecompileFunction(jp))
|
||||
str = js_GetPrinterOutput(jp);
|
||||
else
|
||||
str = NULL;
|
||||
js_DestroyPrinter(jp);
|
||||
return str;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSString *)
|
||||
JS_DecompileFunctionBody(JSContext *cx, JSFunction *fun, uintN indent)
|
||||
{
|
||||
JSPrinter *jp;
|
||||
JSString *str;
|
||||
|
||||
CHECK_REQUEST(cx);
|
||||
return js_DecompileToString(cx, "JS_DecompileFunctionBody", fun,
|
||||
indent & ~JS_DONT_PRETTY_PRINT,
|
||||
!(indent & JS_DONT_PRETTY_PRINT),
|
||||
false, js_DecompileFunctionBody);
|
||||
jp = JS_NEW_PRINTER(cx, "JS_DecompileFunctionBody", fun,
|
||||
indent & ~JS_DONT_PRETTY_PRINT,
|
||||
!(indent & JS_DONT_PRETTY_PRINT));
|
||||
if (!jp)
|
||||
return NULL;
|
||||
if (js_DecompileFunctionBody(jp))
|
||||
str = js_GetPrinterOutput(jp);
|
||||
else
|
||||
str = NULL;
|
||||
js_DestroyPrinter(jp);
|
||||
return str;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
|
|
|
@ -733,9 +733,17 @@ struct JSPrinter {
|
|||
jsuword *localNames; /* argument and variable names */
|
||||
};
|
||||
|
||||
/*
|
||||
* Hack another flag, a la JS_DONT_PRETTY_PRINT, into uintN indent parameters
|
||||
* to functions such as js_DecompileFunction and js_NewPrinter. This time, as
|
||||
* opposed to JS_DONT_PRETTY_PRINT back in the dark ages, we can assume that a
|
||||
* uintN is at least 32 bits.
|
||||
*/
|
||||
#define JS_IN_GROUP_CONTEXT 0x10000
|
||||
|
||||
JSPrinter *
|
||||
JS_NEW_PRINTER(JSContext *cx, const char *name, JSFunction *fun,
|
||||
uintN indent, bool pretty, bool grouped)
|
||||
uintN indent, JSBool pretty)
|
||||
{
|
||||
JSPrinter *jp;
|
||||
|
||||
|
@ -744,9 +752,9 @@ JS_NEW_PRINTER(JSContext *cx, const char *name, JSFunction *fun,
|
|||
return NULL;
|
||||
INIT_SPRINTER(cx, &jp->sprinter, &jp->pool, 0);
|
||||
JS_INIT_ARENA_POOL(&jp->pool, name, 256, 1, &cx->scriptStackQuota);
|
||||
jp->indent = indent;
|
||||
jp->indent = indent & ~JS_IN_GROUP_CONTEXT;
|
||||
jp->pretty = pretty;
|
||||
jp->grouped = grouped;
|
||||
jp->grouped = (indent & JS_IN_GROUP_CONTEXT) != 0;
|
||||
jp->script = NULL;
|
||||
jp->dvgfence = NULL;
|
||||
jp->pcstack = NULL;
|
||||
|
@ -2244,7 +2252,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb, JSOp nextop)
|
|||
do_function:
|
||||
js_puts(jp, "\n");
|
||||
jp2 = JS_NEW_PRINTER(cx, "nested_function", fun,
|
||||
jp->indent, jp->pretty, jp->grouped);
|
||||
jp->indent, jp->pretty);
|
||||
if (!jp2)
|
||||
return NULL;
|
||||
ok = js_DecompileFunction(jp2);
|
||||
|
@ -4137,16 +4145,17 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb, JSOp nextop)
|
|||
|
||||
LOAD_FUNCTION(0);
|
||||
{
|
||||
uintN indent = JS_DONT_PRETTY_PRINT;
|
||||
|
||||
/*
|
||||
* Always parenthesize expression closures. We can't force
|
||||
* saveop to a low-precedence op to arrange for auto-magic
|
||||
* parenthesization without confusing getter/setter code
|
||||
* that checks for JSOP_LAMBDA.
|
||||
*/
|
||||
bool grouped = !(fun->flags & JSFUN_EXPR_CLOSURE);
|
||||
str = js_DecompileToString(cx, "lambda", fun, 0,
|
||||
false, grouped,
|
||||
js_DecompileFunction);
|
||||
if (!(fun->flags & JSFUN_EXPR_CLOSURE))
|
||||
indent |= JS_IN_GROUP_CONTEXT;
|
||||
str = JS_DecompileFunction(cx, fun, indent);
|
||||
if (!str)
|
||||
return NULL;
|
||||
}
|
||||
|
@ -4900,28 +4909,9 @@ js_DecompileScript(JSPrinter *jp, JSScript *script)
|
|||
return DecompileCode(jp, script, script->code, (uintN)script->length, 0);
|
||||
}
|
||||
|
||||
JSString *
|
||||
js_DecompileToString(JSContext *cx, const char *name, JSFunction *fun,
|
||||
uintN indent, bool pretty, bool grouped,
|
||||
bool (*decompiler)(JSPrinter *jp))
|
||||
{
|
||||
JSPrinter *jp;
|
||||
JSString *str;
|
||||
|
||||
jp = JS_NEW_PRINTER(cx, name, fun, indent, pretty, grouped);
|
||||
if (!jp)
|
||||
return NULL;
|
||||
if (decompiler(jp))
|
||||
str = js_GetPrinterOutput(jp);
|
||||
else
|
||||
str = NULL;
|
||||
js_DestroyPrinter(jp);
|
||||
return str;
|
||||
}
|
||||
|
||||
static const char native_code_str[] = "\t[native code]\n";
|
||||
|
||||
bool
|
||||
JSBool
|
||||
js_DecompileFunctionBody(JSPrinter *jp)
|
||||
{
|
||||
JSScript *script;
|
||||
|
@ -4937,7 +4927,7 @@ js_DecompileFunctionBody(JSPrinter *jp)
|
|||
return DecompileCode(jp, script, script->code, (uintN)script->length, 0);
|
||||
}
|
||||
|
||||
bool
|
||||
JSBool
|
||||
js_DecompileFunction(JSPrinter *jp)
|
||||
{
|
||||
JSFunction *fun;
|
||||
|
@ -5306,8 +5296,7 @@ DecompileExpression(JSContext *cx, JSScript *script, JSFunction *fun,
|
|||
}
|
||||
|
||||
name = NULL;
|
||||
jp = JS_NEW_PRINTER(cx, "js_DecompileValueGenerator", fun, 0,
|
||||
false, false);
|
||||
jp = JS_NEW_PRINTER(cx, "js_DecompileValueGenerator", fun, 0, JS_FALSE);
|
||||
if (jp) {
|
||||
jp->dvgfence = end;
|
||||
jp->pcstack = pcstack;
|
||||
|
|
|
@ -276,16 +276,16 @@ js_QuoteString(JSContext *cx, JSString *str, jschar quote);
|
|||
*/
|
||||
|
||||
#ifdef JS_ARENAMETER
|
||||
# define JS_NEW_PRINTER(cx, name, fun, indent, pretty, grouped) \
|
||||
js_NewPrinter(cx, name, fun, indent, pretty, grouped)
|
||||
# define JS_NEW_PRINTER(cx, name, fun, indent, pretty) \
|
||||
js_NewPrinter(cx, name, fun, indent, pretty)
|
||||
#else
|
||||
# define JS_NEW_PRINTER(cx, name, fun, indent, pretty, grouped) \
|
||||
js_NewPrinter(cx, fun, indent, pretty, grouped)
|
||||
# define JS_NEW_PRINTER(cx, name, fun, indent, pretty) \
|
||||
js_NewPrinter(cx, fun, indent, pretty)
|
||||
#endif
|
||||
|
||||
extern JSPrinter *
|
||||
JS_NEW_PRINTER(JSContext *cx, const char *name, JSFunction *fun,
|
||||
uintN indent, bool pretty, bool grouped);
|
||||
uintN indent, JSBool pretty);
|
||||
|
||||
extern void
|
||||
js_DestroyPrinter(JSPrinter *jp);
|
||||
|
@ -421,17 +421,12 @@ js_Disassemble1(JSContext *cx, JSScript *script, jsbytecode *pc, uintN loc,
|
|||
extern JSBool
|
||||
js_DecompileScript(JSPrinter *jp, JSScript *script);
|
||||
|
||||
extern bool
|
||||
extern JSBool
|
||||
js_DecompileFunctionBody(JSPrinter *jp);
|
||||
|
||||
extern bool
|
||||
extern JSBool
|
||||
js_DecompileFunction(JSPrinter *jp);
|
||||
|
||||
extern JSString *
|
||||
js_DecompileToString(JSContext *cx, const char *name, JSFunction *fun,
|
||||
uintN indent, bool pretty, bool grouped,
|
||||
bool (*decompiler)(JSPrinter *jp));
|
||||
|
||||
/*
|
||||
* Find the source expression that resulted in v, and return a newly allocated
|
||||
* C-string containing it. Fall back on v's string conversion (fallback) if we
|
||||
|
|
Загрузка…
Ссылка в новой задаче