mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Update SpiderMonkey
This commit is contained in:
parent
813be91926
commit
5a4f8cf93f
34 changed files with 279 additions and 230 deletions
|
@ -225,6 +225,7 @@ unsafe extern "C" fn enqueue_promise_job(
|
|||
/// https://html.spec.whatwg.org/multipage/#the-hostpromiserejectiontracker-implementation
|
||||
unsafe extern "C" fn promise_rejection_tracker(
|
||||
cx: *mut RawJSContext,
|
||||
_muted_errors: bool,
|
||||
promise: HandleObject,
|
||||
state: PromiseRejectionHandlingState,
|
||||
_data: *mut c_void,
|
||||
|
@ -507,8 +508,16 @@ unsafe fn new_rt_and_cx_with_parent(
|
|||
|
||||
// Enable or disable the JITs.
|
||||
let cx_opts = &mut *ContextOptionsRef(cx);
|
||||
cx_opts.set_baseline_(pref!(js.baseline.enabled));
|
||||
cx_opts.set_ion_(pref!(js.ion.enabled));
|
||||
JS_SetGlobalJitCompilerOption(
|
||||
cx,
|
||||
JSJitCompilerOption::JSJITCOMPILER_BASELINE_ENABLE,
|
||||
pref!(js.baseline.enabled) as u32,
|
||||
);
|
||||
JS_SetGlobalJitCompilerOption(
|
||||
cx,
|
||||
JSJitCompilerOption::JSJITCOMPILER_ION_ENABLE,
|
||||
pref!(js.ion.enabled) as u32,
|
||||
);
|
||||
cx_opts.set_asmJS_(pref!(js.asmjs.enabled));
|
||||
let wasm_enabled = pref!(js.wasm.enabled);
|
||||
cx_opts.set_wasm_(wasm_enabled);
|
||||
|
@ -523,7 +532,11 @@ unsafe fn new_rt_and_cx_with_parent(
|
|||
cx_opts.set_extraWarnings_(pref!(js.strict.enabled));
|
||||
// TODO: handle js.strict.debug.enabled
|
||||
// TODO: handle js.throw_on_asmjs_validation_failure (needs new Spidermonkey)
|
||||
cx_opts.set_nativeRegExp_(pref!(js.native_regex.enabled));
|
||||
JS_SetGlobalJitCompilerOption(
|
||||
cx,
|
||||
JSJitCompilerOption::JSJITCOMPILER_NATIVE_REGEXP_ENABLE,
|
||||
pref!(js.native_regex.enabled) as u32,
|
||||
);
|
||||
JS_SetParallelParsingEnabled(cx, pref!(js.parallel_parsing.enabled));
|
||||
JS_SetOffthreadIonCompilationEnabled(cx, pref!(js.offthread_compilation.enabled));
|
||||
JS_SetGlobalJitCompilerOption(
|
||||
|
@ -550,11 +563,6 @@ unsafe fn new_rt_and_cx_with_parent(
|
|||
// TODO: handle js.dump_stack_on_debugee_would_run (needs new Spidermonkey)
|
||||
cx_opts.set_werror_(pref!(js.werror.enabled));
|
||||
// TODO: handle js.shared_memory.enabled
|
||||
JS_SetGCParameter(
|
||||
cx,
|
||||
JSGCParamKey::JSGC_MAX_MALLOC_BYTES,
|
||||
(pref!(js.mem.high_water_mark) * 1024 * 1024) as u32,
|
||||
);
|
||||
JS_SetGCParameter(
|
||||
cx,
|
||||
JSGCParamKey::JSGC_MAX_BYTES,
|
||||
|
@ -572,7 +580,7 @@ unsafe fn new_rt_and_cx_with_parent(
|
|||
};
|
||||
JS_SetGCParameter(cx, JSGCParamKey::JSGC_MODE, js_gc_mode as u32);
|
||||
if let Some(val) = in_range(pref!(js.mem.gc.incremental.slice_ms), 0, 100_000) {
|
||||
JS_SetGCParameter(cx, JSGCParamKey::JSGC_SLICE_TIME_BUDGET, val as u32);
|
||||
JS_SetGCParameter(cx, JSGCParamKey::JSGC_SLICE_TIME_BUDGET_MS, val as u32);
|
||||
}
|
||||
JS_SetGCParameter(
|
||||
cx,
|
||||
|
@ -617,22 +625,14 @@ unsafe fn new_rt_and_cx_with_parent(
|
|||
JS_SetGCParameter(cx, JSGCParamKey::JSGC_HIGH_FREQUENCY_HIGH_LIMIT, val as u32);
|
||||
}
|
||||
if let Some(val) = in_range(pref!(js.mem.gc.allocation_threshold_factor), 0, 10_000) {
|
||||
JS_SetGCParameter(
|
||||
cx,
|
||||
JSGCParamKey::JSGC_ALLOCATION_THRESHOLD_FACTOR,
|
||||
val as u32,
|
||||
);
|
||||
JS_SetGCParameter(cx, JSGCParamKey::JSGC_NON_INCREMENTAL_FACTOR, val as u32);
|
||||
}
|
||||
if let Some(val) = in_range(
|
||||
pref!(js.mem.gc.allocation_threshold_avoid_interrupt_factor),
|
||||
0,
|
||||
10_000,
|
||||
) {
|
||||
JS_SetGCParameter(
|
||||
cx,
|
||||
JSGCParamKey::JSGC_ALLOCATION_THRESHOLD_FACTOR_AVOID_INTERRUPT,
|
||||
val as u32,
|
||||
);
|
||||
JS_SetGCParameter(cx, JSGCParamKey::JSGC_AVOID_INTERRUPT_FACTOR, val as u32);
|
||||
}
|
||||
if let Some(val) = in_range(pref!(js.mem.gc.empty_chunk_count_min), 0, 10_000) {
|
||||
JS_SetGCParameter(cx, JSGCParamKey::JSGC_MIN_EMPTY_CHUNK_COUNT, val as u32);
|
||||
|
@ -836,6 +836,7 @@ unsafe fn set_gc_zeal_options(cx: *mut RawJSContext) {
|
|||
unsafe fn set_gc_zeal_options(_: *mut RawJSContext) {}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
#[repr(transparent)]
|
||||
pub struct JSContext(*mut RawJSContext);
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue