servo: Merge #10465 - Fix rebasing error (from stjepang:rescue-jit-prefs); r=KiChjang

This PR mistakenly removed JIT enabling/disabling by preference:
https://github.com/servo/servo/pull/10342/files
Look for `get_pref`.

I'm putting the missing piece of code into the appropriate place in
script_runtime.rs

r? @KiChjang

Source-Repo: https://github.com/servo/servo
Source-Revision: bead9585000eed60394b20c7a8e3788284ea458a
This commit is contained in:
Stjepan Glavina
2016-04-08 08:59:07 +05:00
parent 125e19623e
commit ff9ea7f7d0
2 changed files with 11 additions and 2 deletions

View File

@@ -13,7 +13,7 @@ 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};
@@ -24,6 +24,7 @@ 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
@@ -121,6 +122,15 @@ pub fn new_rt_and_cx() -> Runtime {
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
}