Skip to content

Commit

Permalink
Add preferences to enable/disable the JITs
Browse files Browse the repository at this point in the history
When creating a runtime (script.rs), we check prefs and then enable or
disable the JITs (Baseline and Ion).
  • Loading branch information
Stjepan Glavina committed Apr 4, 2016
1 parent f2b48d2 commit 3ad7119
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 11 additions & 1 deletion components/script/script_thread.rs
Expand Up @@ -57,7 +57,7 @@ use js::jsapi::{DisableIncrementalGC, JS_AddExtraGCRootsTracer, JS_SetWrapObject
use js::jsapi::{GCDescription, GCProgress, JSGCInvocationKind, SetGCSliceCallback};
use js::jsapi::{JSAutoRequest, JSGCStatus, JS_GetRuntime, JS_SetGCCallback, SetDOMCallbacks};
use js::jsapi::{JSContext, JSRuntime, JSTracer};
use js::jsapi::{JSObject, SetPreserveWrapperCallback};
use js::jsapi::{JSObject, RuntimeOptionsRef, SetPreserveWrapperCallback};
use js::jsval::UndefinedValue;
use js::rust::Runtime;
use layout_interface::{ReflowQueryType};
Expand Down Expand Up @@ -108,6 +108,7 @@ use task_source::user_interaction::UserInteractionTaskSource;
use time::{Tm, now};
use url::Url;
use util::opts;
use util::prefs::get_pref;
use util::str::DOMString;
use util::thread;
use util::thread_state;
Expand Down Expand Up @@ -739,6 +740,15 @@ impl ScriptThread {
DisableIncrementalGC(runtime.rt());
}

// Enable or disable the JITs.
let rt_opts = unsafe { &mut *RuntimeOptionsRef(runtime.rt()) };
if let Some(val) = get_pref("js.baseline.enabled").as_boolean() {
rt_opts.set_baseline_(val);
}
if let Some(val) = get_pref("js.ion.enabled").as_boolean() {
rt_opts.set_ion_(val);
}

runtime
}

Expand Down
2 changes: 2 additions & 0 deletions resources/prefs.json
Expand Up @@ -2,6 +2,8 @@
"dom.mouseevent.which.enabled": false,
"dom.mozbrowser.enabled": false,
"gfx.webrender.enabled": false,
"js.baseline.enabled": true,
"js.ion.enabled": true,
"layout.columns.enabled": false,
"layout.column-width.enabled": false,
"layout.column-count.enabled": false,
Expand Down

0 comments on commit 3ad7119

Please sign in to comment.