servo: Merge #10465 - Fix rebasing error (from stjepang:rescue-jit-prefs); r=KiChjang
authorStjepan Glavina <>
Fri, 08 Apr 2016 08:59:37 +0500
changeset 338449 a58b94448aeadc68f968f056423ad68ec147499b
parent 338448 9f0a3eed19ee3ec08ef1d0d136ab5d2b76ce509e
child 338450 e48f920aff576c0c7dd9c94554c12586763cbe68
push id31307
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
servo: Merge #10465 - Fix rebasing error (from stjepang:rescue-jit-prefs); r=KiChjang This PR mistakenly removed JIT enabling/disabling by preference: Look for `get_pref`. I'm putting the missing piece of code into the appropriate place in r? @KiChjang Source-Repo: Source-Revision: bead9585000eed60394b20c7a8e3788284ea458a
--- a/servo/components/script/
+++ b/servo/components/script/
@@ -8,27 +8,28 @@
 use dom::bindings::js::{RootCollection, RootCollectionPtr, trace_roots};
 use dom::bindings::refcounted::{LiveDOMReferences, TrustedReference, trace_refcounted_objects};
 use dom::bindings::trace::trace_traceables;
 use dom::bindings::utils::DOM_CALLBACKS;
 use js::glue::CollectServoSizes;
 use js::jsapi::{DisableIncrementalGC, GCDescription, GCProgress};
 use js::jsapi::{JSContext, JS_GetRuntime, JSRuntime, JSTracer, SetDOMCallbacks, SetGCSliceCallback};
 use js::jsapi::{JSGCInvocationKind, JSGCStatus, JS_AddExtraGCRootsTracer, JS_SetGCCallback};
-use js::jsapi::{JSObject, SetPreserveWrapperCallback};
+use js::jsapi::{JSObject, RuntimeOptionsRef, SetPreserveWrapperCallback};
 use js::rust::Runtime;
 use libc;
 use profile_traits::mem::{Report, ReportKind, ReportsChan};
 use script_thread::{Runnable, STACK_ROOTS, trace_thread};
 use std::cell::Cell;
 use std::io::{Write, stdout};
 use std::marker::PhantomData;
 use std::ptr;
 use time::{Tm, now};
 use util::opts;
+use util::prefs::get_pref;
 use util::thread_state;
 /// Common messages used to control the event loops in both the script and the worker
 pub enum CommonScriptMsg {
     /// Requests that the script thread measure its memory usage. The results are sent back via the
     /// supplied channel.
     /// A DOM object's last pinned reference was removed (dispatched to all threads).
@@ -116,16 +117,25 @@ pub fn new_rt_and_cx() -> Runtime {
     unsafe {
         unsafe extern "C" fn empty_wrapper_callback(_: *mut JSContext, _: *mut JSObject) -> bool { true }
         SetDOMCallbacks(runtime.rt(), &DOM_CALLBACKS);
         SetPreserveWrapperCallback(runtime.rt(), Some(empty_wrapper_callback));
         // Pre barriers aren't working correctly at the moment
+    // 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);
+    }
 pub fn get_reports(cx: *mut JSContext, path_seg: String) -> Vec<Report> {
     let mut reports = vec![];
     unsafe {
--- a/servo/components/script/
+++ b/servo/components/script/
@@ -96,17 +96,16 @@ use task_source::TaskSource;
 use task_source::dom_manipulation::{DOMManipulationTaskSource, DOMManipulationTask};
 use task_source::file_reading::FileReadingTaskSource;
 use task_source::history_traversal::HistoryTraversalTaskSource;
 use task_source::networking::NetworkingTaskSource;
 use task_source::user_interaction::UserInteractionTaskSource;
 use time::Tm;
 use url::Url;
 use util::opts;
-use util::prefs::get_pref;
 use util::str::DOMString;
 use util::thread;
 use util::thread_state;
 use webdriver_handlers;
 thread_local!(pub static STACK_ROOTS: Cell<Option<RootCollectionPtr>> = Cell::new(None));
 thread_local!(static SCRIPT_THREAD_ROOT: RefCell<Option<*const ScriptThread>> = RefCell::new(None));