mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Support GC zeal
This commit is contained in:
parent
9eb7162b8a
commit
afd29b7c1e
2 changed files with 24 additions and 0 deletions
|
@ -117,6 +117,8 @@ pub unsafe fn new_rt_and_cx() -> Runtime {
|
||||||
// Pre barriers aren't working correctly at the moment
|
// Pre barriers aren't working correctly at the moment
|
||||||
DisableIncrementalGC(runtime.rt());
|
DisableIncrementalGC(runtime.rt());
|
||||||
|
|
||||||
|
set_gc_zeal_options(runtime.cx());
|
||||||
|
|
||||||
// Enable or disable the JITs.
|
// Enable or disable the JITs.
|
||||||
let rt_opts = &mut *RuntimeOptionsRef(runtime.rt());
|
let rt_opts = &mut *RuntimeOptionsRef(runtime.rt());
|
||||||
if let Some(val) = get_pref("js.baseline.enabled").as_boolean() {
|
if let Some(val) = get_pref("js.baseline.enabled").as_boolean() {
|
||||||
|
@ -377,3 +379,23 @@ unsafe extern fn trace_rust_roots(tr: *mut JSTracer, _data: *mut os::raw::c_void
|
||||||
trace_roots(tr);
|
trace_roots(tr);
|
||||||
debug!("done custom root handler");
|
debug!("done custom root handler");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(unsafe_code)]
|
||||||
|
#[cfg(feature = "debugmozjs")]
|
||||||
|
unsafe fn set_gc_zeal_options(cx: *mut JSContext) {
|
||||||
|
use js::jsapi::{JS_DEFAULT_ZEAL_FREQ, JS_SetGCZeal};
|
||||||
|
|
||||||
|
let level = match get_pref("js.mem.gc.zeal.level").as_i64() {
|
||||||
|
Some(level @ 0...14) => level as u8,
|
||||||
|
_ => return,
|
||||||
|
};
|
||||||
|
let frequency = match get_pref("js.mem.gc.zeal.frequency").as_i64() {
|
||||||
|
Some(frequency) if frequency >= 0 => frequency as u32,
|
||||||
|
_ => JS_DEFAULT_ZEAL_FREQ,
|
||||||
|
};
|
||||||
|
JS_SetGCZeal(cx, level, frequency);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(unsafe_code)]
|
||||||
|
#[cfg(not(feature = "debugmozjs"))]
|
||||||
|
unsafe fn set_gc_zeal_options(_: *mut JSContext) {}
|
||||||
|
|
|
@ -42,6 +42,8 @@
|
||||||
"js.mem.gc.decommit_threshold_mb": 32,
|
"js.mem.gc.decommit_threshold_mb": 32,
|
||||||
"js.mem.gc.empty_chunk_count_min": 1,
|
"js.mem.gc.empty_chunk_count_min": 1,
|
||||||
"js.mem.gc.empty_chunk_count_max": 30,
|
"js.mem.gc.empty_chunk_count_max": 30,
|
||||||
|
"js.mem.gc.zeal.level": 0,
|
||||||
|
"js.mem.gc.zeal.frequency": 100,
|
||||||
"layout.columns.enabled": false,
|
"layout.columns.enabled": false,
|
||||||
"layout.column-width.enabled": false,
|
"layout.column-width.enabled": false,
|
||||||
"layout.column-count.enabled": false,
|
"layout.column-count.enabled": false,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue