Browser prefs for enabling methodjit

This commit is contained in:
David Mandelin 2010-06-29 16:46:10 -07:00
parent b310ff63ee
commit e42840d083
3 changed files with 26 additions and 11 deletions

View File

@ -304,7 +304,8 @@ user_pref("accessibility.typeaheadfind.autostart", false);
user_pref("javascript.options.showInConsole", true);
user_pref("layout.debug.enable_data_xbl", true);
user_pref("browser.EULA.override", true);
user_pref("javascript.options.jit.content", true);
user_pref("javascript.options.jit.content", false);
user_pref("javascript.options.methodjit.content", true);
user_pref("gfx.color_management.force_srgb", true);
user_pref("network.manage-offline-status", false);
user_pref("test.mousescroll", true);

View File

@ -1285,8 +1285,10 @@ 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";
#endif
static const char js_jit_content_str[] = JS_OPTIONS_DOT_STR "jit.content";
static const char js_jit_chrome_str[] = JS_OPTIONS_DOT_STR "jit.chrome";
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";
static const char js_methodjit_content_str[] = JS_OPTIONS_DOT_STR "methodjit.content";
static const char js_methodjit_chrome_str[] = JS_OPTIONS_DOT_STR "methodjit.chrome";
int
nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
@ -1306,22 +1308,32 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
// XXX components be covered by the chrome pref instead of the content one?
nsCOMPtr<nsIDOMChromeWindow> chromeWindow(do_QueryInterface(global));
PRBool useJIT = nsContentUtils::GetBoolPref(chromeWindow ?
js_jit_chrome_str :
js_jit_content_str);
PRBool useTraceJIT = nsContentUtils::GetBoolPref(chromeWindow ?
js_tracejit_chrome_str :
js_tracejit_content_str);
PRBool useMethodJIT = nsContentUtils::GetBoolPref(chromeWindow ?
js_methodjit_chrome_str :
js_methodjit_content_str);
nsCOMPtr<nsIXULRuntime> xr = do_GetService(XULRUNTIME_SERVICE_CONTRACTID);
if (xr) {
PRBool safeMode = PR_FALSE;
xr->GetInSafeMode(&safeMode);
if (safeMode)
useJIT = PR_FALSE;
if (safeMode) {
useTraceJIT = PR_FALSE;
useMethodJIT = PR_FALSE;
}
}
if (useJIT)
if (useTraceJIT)
newDefaultJSOptions |= JSOPTION_JIT;
else
newDefaultJSOptions &= ~JSOPTION_JIT;
if (useMethodJIT)
newDefaultJSOptions |= JSOPTION_METHODJIT;
else
newDefaultJSOptions &= ~JSOPTION_METHODJIT;
#ifdef DEBUG
// In debug builds, warnings are enabled in chrome context if javascript.options.strict.debug is true
PRBool strictDebug = nsContentUtils::GetBoolPref(js_strict_debug_option_str);

View File

@ -559,8 +559,10 @@ pref("javascript.options.strict", false);
pref("javascript.options.strict.debug", true);
#endif
pref("javascript.options.relimit", true);
pref("javascript.options.jit.content", true);
pref("javascript.options.jit.chrome", true);
pref("javascript.options.tracejit.content", false);
pref("javascript.options.tracejit.chrome", false);
pref("javascript.options.methodjit.content", true);
pref("javascript.options.methodjit.chrome", false);
// This preference limits the memory usage of javascript.
// If you want to change these values for your device,
// please find Bug 417052 comment 17 and Bug 456721