diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-04-05 05:50:13 +0530 |
---|---|---|
committer | bors-servo <lbergstrom+bors@mozilla.com> | 2016-04-05 05:50:13 +0530 |
commit | 863c905025e75e7119539c832e4e4647f44d90bb (patch) | |
tree | ff8ece87b0f021b01aa3c3832ea72bed999e74a2 /components/script/script_thread.rs | |
parent | d6c5fd8dabe51365f72fcbfa90eb16115a274110 (diff) | |
parent | 3ad7119b08344df7aa4b48483393ba0971ad377a (diff) | |
download | servo-863c905025e75e7119539c832e4e4647f44d90bb.tar.gz servo-863c905025e75e7119539c832e4e4647f44d90bb.zip |
Auto merge of #10325 - stjepang:pref-disable-jit, r=mbrubeck
Add preferences to enable/disable the JITs
When creating a runtime (script.rs), we check prefs and then enable or
disable the JITs (Baseline and Ion) accordingly.
Closes #10278.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10325)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r-- | components/script/script_thread.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index cfce8de2768..5cd38e80532 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -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}; @@ -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; @@ -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 } |