From 8e10daba979a7a30b69ffd66dd4f3b256c39b615 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Thu, 17 Apr 2014 17:03:21 -0400 Subject: [PATCH] Allow controlling GC zeal via JS_GC_ZEAL environment variable. --- src/components/script/script_task.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/script/script_task.rs b/src/components/script/script_task.rs index d82dace6d99..e319ef18837 100644 --- a/src/components/script/script_task.rs +++ b/src/components/script/script_task.rs @@ -36,7 +36,7 @@ use geom::point::Point2D; use geom::size::Size2D; use js::global::DEBUG_FNS; use js::jsapi::{JSObject, JS_CallFunctionValue, JS_DefineFunctions}; -use js::jsapi::JS_SetWrapObjectCallbacks; +use js::jsapi::{JS_SetWrapObjectCallbacks, JS_SetGCZeal, JS_DEFAULT_ZEAL_FREQ}; use js::jsval::NullValue; use js::rust::{Cx, RtUtils}; use js; @@ -432,6 +432,10 @@ impl Page { // Note that the order that these variables are initialized is _not_ arbitrary. Switching // them around can -- and likely will -- lead to things breaking. + unsafe { + JS_SetGCZeal(js_context.deref().ptr, 0, JS_DEFAULT_ZEAL_FREQ); + } + js_context.set_default_options_and_version(); js_context.set_logging_error_reporter();