Bug 753101 - Re-enable gc-zeal in the shell; r=billm

GCZeal got disabled by accident in Bug 742570.  This patch re-enables it using
the environment and removes the depricated help option.

--HG--
extra : rebase_source : c2553c3f325afbbe1234fbf8fe59c47df936b8b2
This commit is contained in:
Terrence Cole 2012-05-08 17:33:58 -07:00
parent f55ed956b4
commit af0c9c9b0f
2 changed files with 15 additions and 11 deletions

View File

@ -6573,13 +6573,22 @@ JS_AbortIfWrongThread(JSRuntime *rt)
JS_PUBLIC_API(void)
JS_SetGCZeal(JSContext *cx, uint8_t zeal, uint32_t frequency)
{
#ifdef JS_GC_ZEAL
const char *env = getenv("JS_GC_ZEAL");
if (env) {
if (0 == strcmp(env, "help")) {
printf("Format: JS_GC_ZEAL=N[,F]\n"
"N indicates \"zealousness\":\n"
" 0: no additional GCs\n"
" 1: additional GCs at common danger points\n"
" 2: GC every F allocations (default: 100)\n"
" 3: GC when the window paints (browser only)\n"
" 4: Verify write barriers between instructions\n"
" 5: Verify write barriers between paints\n");
}
const char *p = strchr(env, ',');
zeal = atoi(env);
frequency = 1;
frequency = p ? atoi(p + 1) : JS_DEFAULT_ZEAL_FREQ;
}
#endif
bool schedule = zeal >= js::gc::ZealAllocValue;
cx->runtime->gcZeal_ = zeal;

View File

@ -4942,14 +4942,6 @@ main(int argc, char **argv, char **envp)
|| !op.addBoolOption('O', "print-alloc", "Print the number of allocations at exit")
#endif
|| !op.addBoolOption('U', "utf8", "C strings passed to the JSAPI are UTF-8 encoded")
#ifdef JS_GC_ZEAL
|| !op.addStringOption('Z', "gc-zeal", "N[,F[,C]]",
"N indicates \"zealousness\":\n"
" 0: no additional GCs\n"
" 1: additional GCs at common danger points\n"
" 2: GC every F allocations (default: 100)\n"
"If C is 1, compartmental GCs are performed; otherwise, full")
#endif
|| !op.addOptionalStringArg("script", "A script to execute (after all options)")
|| !op.addOptionalMultiStringArg("scriptArgs",
"String arguments to bind as |arguments| in the "
@ -5017,6 +5009,9 @@ main(int argc, char **argv, char **envp)
JS_SetGCParameter(rt, JSGC_MODE, JSGC_MODE_INCREMENTAL);
JS_SetGCParameterForThread(cx, JSGC_MAX_CODE_CACHE_BYTES, 16 * 1024 * 1024);
#ifdef JS_GC_ZEAL
JS_SetGCZeal(cx, 0, 0);
#endif
/* Must be done before creating the global object */
if (op.getBoolOption('D'))