Enable IonMonkey in the browser, and introduce an about:config option to pref it off (bug 745390, r=dmandelin).

This commit is contained in:
David Anderson 2012-04-19 15:02:47 -07:00
parent 78902a1629
commit af925c357c
8 changed files with 24 additions and 3 deletions

View File

@ -929,6 +929,7 @@ static const char js_pccounts_content_str[] = JS_OPTIONS_DOT_STR "pccounts.con
static const char js_pccounts_chrome_str[] = JS_OPTIONS_DOT_STR "pccounts.chrome";
static const char js_jit_hardening_str[] = JS_OPTIONS_DOT_STR "jit_hardening";
static const char js_memlog_option_str[] = JS_OPTIONS_DOT_STR "mem.log";
static const char js_ion_content_str[] = JS_OPTIONS_DOT_STR "ion.content";
int
nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
@ -964,6 +965,7 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
bool useMethodJITAlways = Preferences::GetBool(js_methodjit_always_str);
bool useTypeInference = !chromeWindow && contentWindow && Preferences::GetBool(js_typeinfer_str);
bool useHardening = Preferences::GetBool(js_jit_hardening_str);
bool useIon = Preferences::GetBool(js_ion_content_str);
nsCOMPtr<nsIXULRuntime> xr = do_GetService(XULRUNTIME_SERVICE_CONTRACTID);
if (xr) {
bool safeMode = false;
@ -974,6 +976,7 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
useTypeInference = false;
useMethodJITAlways = true;
useHardening = false;
useIon = false;
}
}
@ -997,6 +1000,11 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
else
newDefaultJSOptions &= ~JSOPTION_TYPE_INFERENCE;
if (useIon)
newDefaultJSOptions |= JSOPTION_ION;
else
newDefaultJSOptions &= ~JSOPTION_ION;
#ifdef DEBUG
// In debug builds, warnings are enabled in chrome context if
// javascript.options.strict.debug is true

View File

@ -182,6 +182,7 @@ enum {
PREF_typeinference,
PREF_jit_hardening,
PREF_mem_max,
PREF_ion,
#ifdef JS_GC_ZEAL
PREF_gczeal,
@ -200,7 +201,8 @@ const char* gPrefsToWatch[] = {
JS_OPTIONS_DOT_STR "methodjit_always",
JS_OPTIONS_DOT_STR "typeinference",
JS_OPTIONS_DOT_STR "jit_hardening",
JS_OPTIONS_DOT_STR "mem.max"
JS_OPTIONS_DOT_STR "mem.max",
JS_OPTIONS_DOT_STR "ion.content"
#ifdef JS_GC_ZEAL
, PREF_WORKERS_GCZEAL
@ -247,6 +249,9 @@ PrefCallback(const char* aPrefName, void* aClosure)
if (Preferences::GetBool(gPrefsToWatch[PREF_typeinference])) {
newOptions |= JSOPTION_TYPE_INFERENCE;
}
if (Preferences::GetBool(gPrefsToWatch[PREF_ion])) {
newOptions |= JSOPTION_ION;
}
RuntimeService::SetDefaultJSContextOptions(newOptions);
rts->UpdateAllWorkerJSContextOptions();

View File

@ -224,7 +224,8 @@ function optionsInit() {
xml: true,
relimit: true,
methodjit: true,
methodjit_always: true
methodjit_always: true,
ion: true
};
// record initial values to support resetting

View File

@ -649,7 +649,8 @@ function optionsClear() {
var optionName = optionNames[i];
if (optionName &&
optionName != "methodjit" &&
optionName != "methodjit_always")
optionName != "methodjit_always" &&
optionName != "ion")
{
options(optionName);
}

View File

@ -29,6 +29,7 @@ user_pref("extensions.checkUpdateSecurity", false);
user_pref("browser.EULA.override", true);
user_pref("javascript.options.methodjit.chrome", true);
user_pref("javascript.options.methodjit.content", true);
user_pref("javascript.options.ion.content", true);
user_pref("javascript.options.methodjit_always", false);
user_pref("javascript.options.strict", false);
user_pref("javascript.options.werror", false);

View File

@ -360,6 +360,9 @@ interface nsIXPCComponents_Utils : nsISupports
[implicit_jscontext]
attribute boolean methodjit_always;
[implicit_jscontext]
attribute boolean ion;
[implicit_jscontext]
void setGCZeal(in long zeal);
};

View File

@ -4022,6 +4022,7 @@ GENERATE_JSOPTION_GETTER_SETTER(Xml, JSOPTION_XML)
GENERATE_JSOPTION_GETTER_SETTER(Relimit, JSOPTION_RELIMIT)
GENERATE_JSOPTION_GETTER_SETTER(Methodjit, JSOPTION_METHODJIT)
GENERATE_JSOPTION_GETTER_SETTER(Methodjit_always, JSOPTION_METHODJIT_ALWAYS)
GENERATE_JSOPTION_GETTER_SETTER(Ion, JSOPTION_ION);
#undef GENERATE_JSOPTION_GETTER_SETTER

View File

@ -662,6 +662,7 @@ pref("javascript.options.strict.debug", true);
#endif
pref("javascript.options.relimit", true);
pref("javascript.options.methodjit.content", true);
pref("javascript.options.ion.content", true);
pref("javascript.options.methodjit.chrome", true);
pref("javascript.options.pccounts.content", false);
pref("javascript.options.pccounts.chrome", false);