Bug 661690. Add preferences for gczeal frequency and whether the gczeal gc should be a per-compartment gc. r=wmccloskey

This commit is contained in:
Wes Kocher 2011-07-21 17:31:36 -04:00
Родитель 4f571c208d
Коммит 2f7dd9228d
1 изменённых файлов: 6 добавлений и 2 удалений

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

@ -908,7 +908,9 @@ static const char js_strict_debug_option_str[] = JS_OPTIONS_DOT_STR "strict.debu
static const char js_werror_option_str[] = JS_OPTIONS_DOT_STR "werror";
static const char js_relimit_option_str[]= JS_OPTIONS_DOT_STR "relimit";
#ifdef JS_GC_ZEAL
static const char js_zeal_option_str[] = JS_OPTIONS_DOT_STR "gczeal";
static const char js_zeal_option_str[] = JS_OPTIONS_DOT_STR "gczeal";
static const char js_zeal_frequency_str[] = JS_OPTIONS_DOT_STR "gczeal.frequency";
static const char js_zeal_compartment_str[] = JS_OPTIONS_DOT_STR "gczeal.compartment_gc";
#endif
static const char js_tracejit_content_str[] = JS_OPTIONS_DOT_STR "tracejit.content";
static const char js_tracejit_chrome_str[] = JS_OPTIONS_DOT_STR "tracejit.chrome";
@ -1012,8 +1014,10 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
#ifdef JS_GC_ZEAL
PRInt32 zeal = Preferences::GetInt(js_zeal_option_str, -1);
PRInt32 frequency = Preferences::GetInt(js_zeal_frequency_str, JS_DEFAULT_ZEAL_FREQ);
PRBool compartment = Preferences::GetBool(js_zeal_compartment_str, JS_FALSE);
if (zeal >= 0)
::JS_SetGCZeal(context->mContext, (PRUint8)zeal, JS_DEFAULT_ZEAL_FREQ, JS_FALSE);
::JS_SetGCZeal(context->mContext, (PRUint8)zeal, frequency, compartment);
#endif
return 0;