Backed out changeset 723a2622ad4a: tracemonkey tinderbox build failures

This commit is contained in:
David Mandelin 2009-10-27 17:46:09 -07:00
Родитель 749b3b1a03
Коммит b3bb439766
3 изменённых файлов: 56 добавлений и 53 удалений

Просмотреть файл

@ -4902,8 +4902,7 @@ JS_DecompileScript(JSContext *cx, JSScript *script, const char *name,
CHECK_REQUEST(cx); CHECK_REQUEST(cx);
jp = JS_NEW_PRINTER(cx, name, NULL, jp = JS_NEW_PRINTER(cx, name, NULL,
indent & ~JS_DONT_PRETTY_PRINT, indent & ~JS_DONT_PRETTY_PRINT,
!(indent & JS_DONT_PRETTY_PRINT), !(indent & JS_DONT_PRETTY_PRINT));
false);
if (!jp) if (!jp)
return NULL; return NULL;
if (js_DecompileScript(jp, script)) if (js_DecompileScript(jp, script))
@ -4917,21 +4916,41 @@ JS_DecompileScript(JSContext *cx, JSScript *script, const char *name,
JS_PUBLIC_API(JSString *) JS_PUBLIC_API(JSString *)
JS_DecompileFunction(JSContext *cx, JSFunction *fun, uintN indent) JS_DecompileFunction(JSContext *cx, JSFunction *fun, uintN indent)
{ {
JSPrinter *jp;
JSString *str;
CHECK_REQUEST(cx); CHECK_REQUEST(cx);
return js_DecompileToString(cx, "JS_DecompileFunction", fun, jp = JS_NEW_PRINTER(cx, "JS_DecompileFunction", fun,
indent & ~JS_DONT_PRETTY_PRINT, indent & ~JS_DONT_PRETTY_PRINT,
!(indent & JS_DONT_PRETTY_PRINT), !(indent & JS_DONT_PRETTY_PRINT));
false, js_DecompileFunction); 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_PUBLIC_API(JSString *)
JS_DecompileFunctionBody(JSContext *cx, JSFunction *fun, uintN indent) JS_DecompileFunctionBody(JSContext *cx, JSFunction *fun, uintN indent)
{ {
JSPrinter *jp;
JSString *str;
CHECK_REQUEST(cx); CHECK_REQUEST(cx);
return js_DecompileToString(cx, "JS_DecompileFunctionBody", fun, jp = JS_NEW_PRINTER(cx, "JS_DecompileFunctionBody", fun,
indent & ~JS_DONT_PRETTY_PRINT, indent & ~JS_DONT_PRETTY_PRINT,
!(indent & JS_DONT_PRETTY_PRINT), !(indent & JS_DONT_PRETTY_PRINT));
false, js_DecompileFunctionBody); if (!jp)
return NULL;
if (js_DecompileFunctionBody(jp))
str = js_GetPrinterOutput(jp);
else
str = NULL;
js_DestroyPrinter(jp);
return str;
} }
JS_PUBLIC_API(JSBool) JS_PUBLIC_API(JSBool)

Просмотреть файл

@ -733,9 +733,17 @@ struct JSPrinter {
jsuword *localNames; /* argument and variable names */ 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 * JSPrinter *
JS_NEW_PRINTER(JSContext *cx, const char *name, JSFunction *fun, JS_NEW_PRINTER(JSContext *cx, const char *name, JSFunction *fun,
uintN indent, bool pretty, bool grouped) uintN indent, JSBool pretty)
{ {
JSPrinter *jp; JSPrinter *jp;
@ -744,9 +752,9 @@ JS_NEW_PRINTER(JSContext *cx, const char *name, JSFunction *fun,
return NULL; return NULL;
INIT_SPRINTER(cx, &jp->sprinter, &jp->pool, 0); INIT_SPRINTER(cx, &jp->sprinter, &jp->pool, 0);
JS_INIT_ARENA_POOL(&jp->pool, name, 256, 1, &cx->scriptStackQuota); 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->pretty = pretty;
jp->grouped = grouped; jp->grouped = (indent & JS_IN_GROUP_CONTEXT) != 0;
jp->script = NULL; jp->script = NULL;
jp->dvgfence = NULL; jp->dvgfence = NULL;
jp->pcstack = NULL; jp->pcstack = NULL;
@ -2244,7 +2252,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb, JSOp nextop)
do_function: do_function:
js_puts(jp, "\n"); js_puts(jp, "\n");
jp2 = JS_NEW_PRINTER(cx, "nested_function", fun, jp2 = JS_NEW_PRINTER(cx, "nested_function", fun,
jp->indent, jp->pretty, jp->grouped); jp->indent, jp->pretty);
if (!jp2) if (!jp2)
return NULL; return NULL;
ok = js_DecompileFunction(jp2); ok = js_DecompileFunction(jp2);
@ -4137,16 +4145,17 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb, JSOp nextop)
LOAD_FUNCTION(0); LOAD_FUNCTION(0);
{ {
uintN indent = JS_DONT_PRETTY_PRINT;
/* /*
* Always parenthesize expression closures. We can't force * Always parenthesize expression closures. We can't force
* saveop to a low-precedence op to arrange for auto-magic * saveop to a low-precedence op to arrange for auto-magic
* parenthesization without confusing getter/setter code * parenthesization without confusing getter/setter code
* that checks for JSOP_LAMBDA. * that checks for JSOP_LAMBDA.
*/ */
bool grouped = !(fun->flags & JSFUN_EXPR_CLOSURE); if (!(fun->flags & JSFUN_EXPR_CLOSURE))
str = js_DecompileToString(cx, "lambda", fun, 0, indent |= JS_IN_GROUP_CONTEXT;
false, grouped, str = JS_DecompileFunction(cx, fun, indent);
js_DecompileFunction);
if (!str) if (!str)
return NULL; return NULL;
} }
@ -4900,28 +4909,9 @@ js_DecompileScript(JSPrinter *jp, JSScript *script)
return DecompileCode(jp, script, script->code, (uintN)script->length, 0); 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"; static const char native_code_str[] = "\t[native code]\n";
bool JSBool
js_DecompileFunctionBody(JSPrinter *jp) js_DecompileFunctionBody(JSPrinter *jp)
{ {
JSScript *script; JSScript *script;
@ -4937,7 +4927,7 @@ js_DecompileFunctionBody(JSPrinter *jp)
return DecompileCode(jp, script, script->code, (uintN)script->length, 0); return DecompileCode(jp, script, script->code, (uintN)script->length, 0);
} }
bool JSBool
js_DecompileFunction(JSPrinter *jp) js_DecompileFunction(JSPrinter *jp)
{ {
JSFunction *fun; JSFunction *fun;
@ -5306,8 +5296,7 @@ DecompileExpression(JSContext *cx, JSScript *script, JSFunction *fun,
} }
name = NULL; name = NULL;
jp = JS_NEW_PRINTER(cx, "js_DecompileValueGenerator", fun, 0, jp = JS_NEW_PRINTER(cx, "js_DecompileValueGenerator", fun, 0, JS_FALSE);
false, false);
if (jp) { if (jp) {
jp->dvgfence = end; jp->dvgfence = end;
jp->pcstack = pcstack; jp->pcstack = pcstack;

Просмотреть файл

@ -276,16 +276,16 @@ js_QuoteString(JSContext *cx, JSString *str, jschar quote);
*/ */
#ifdef JS_ARENAMETER #ifdef JS_ARENAMETER
# define JS_NEW_PRINTER(cx, name, fun, indent, pretty, grouped) \ # define JS_NEW_PRINTER(cx, name, fun, indent, pretty) \
js_NewPrinter(cx, name, fun, indent, pretty, grouped) js_NewPrinter(cx, name, fun, indent, pretty)
#else #else
# define JS_NEW_PRINTER(cx, name, fun, indent, pretty, grouped) \ # define JS_NEW_PRINTER(cx, name, fun, indent, pretty) \
js_NewPrinter(cx, fun, indent, pretty, grouped) js_NewPrinter(cx, fun, indent, pretty)
#endif #endif
extern JSPrinter * extern JSPrinter *
JS_NEW_PRINTER(JSContext *cx, const char *name, JSFunction *fun, JS_NEW_PRINTER(JSContext *cx, const char *name, JSFunction *fun,
uintN indent, bool pretty, bool grouped); uintN indent, JSBool pretty);
extern void extern void
js_DestroyPrinter(JSPrinter *jp); js_DestroyPrinter(JSPrinter *jp);
@ -421,17 +421,12 @@ js_Disassemble1(JSContext *cx, JSScript *script, jsbytecode *pc, uintN loc,
extern JSBool extern JSBool
js_DecompileScript(JSPrinter *jp, JSScript *script); js_DecompileScript(JSPrinter *jp, JSScript *script);
extern bool extern JSBool
js_DecompileFunctionBody(JSPrinter *jp); js_DecompileFunctionBody(JSPrinter *jp);
extern bool extern JSBool
js_DecompileFunction(JSPrinter *jp); 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 * 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 * C-string containing it. Fall back on v's string conversion (fallback) if we