[gjs/mozjs91: 7/18] Update GC API
- From: Evan Welsh <ewlsh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/mozjs91: 7/18] Update GC API
- Date: Sat, 7 Aug 2021 22:15:39 +0000 (UTC)
commit 29db6e768fe21ecb6819647d6fac6c3add5716f6
Author: Evan Welsh <contact evanwelsh com>
Date: Sat Aug 7 14:35:06 2021 -0700
Update GC API
GC_* options are now JS::GCOptions, JSGC_MODE has been removed
in favor of individual flags. JSGC_MODE_INCREMENTAL is now
JSGC_INCREMENTAL_GC_ENABLED
See https://bugzilla.mozilla.org/show_bug.cgi?id=1686249
gjs/engine.cpp | 14 ++++----------
gjs/jsapi-util.cpp | 3 ++-
2 files changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/gjs/engine.cpp b/gjs/engine.cpp
index 0977bca8..15e3a036 100644
--- a/gjs/engine.cpp
+++ b/gjs/engine.cpp
@@ -133,19 +133,13 @@ JSContext* gjs_create_js_context(GjsContextPrivate* uninitialized_gjs) {
return nullptr;
}
- // commented are defaults in moz-24
+ // See
+ // https://searchfox.org/mozilla-esr91/rev/c49725508e97c1e2e2bb3bf9ed0ba14b2016abac/js/public/GCAPI.h#53
+ // for additional context on these options.
JS_SetNativeStackQuota(cx, 1024 * 1024);
JS_SetGCParameter(cx, JSGC_MAX_BYTES, -1);
- JS_SetGCParameter(cx, JSGC_MODE, JSGC_MODE_INCREMENTAL);
+ JS_SetGCParameter(cx, JSGC_INCREMENTAL_GC_ENABLED, 1);
JS_SetGCParameter(cx, JSGC_SLICE_TIME_BUDGET_MS, 10); /* ms */
- // JS_SetGCParameter(cx, JSGC_HIGH_FREQUENCY_TIME_LIMIT, 1000); /* ms */
- // JS_SetGCParameter(cx, JSGC_LOW_FREQUENCY_HEAP_GROWTH, 150);
- // JS_SetGCParameter(cx, JSGC_HIGH_FREQUENCY_HEAP_GROWTH_MIN, 150);
- // JS_SetGCParameter(cx, JSGC_HIGH_FREQUENCY_HEAP_GROWTH_MAX, 300);
- // JS_SetGCParameter(cx, JSGC_HIGH_FREQUENCY_LOW_LIMIT, 100);
- // JS_SetGCParameter(cx, JSGC_HIGH_FREQUENCY_HIGH_LIMIT, 500);
- // JS_SetGCParameter(cx, JSGC_ALLOCATION_THRESHOLD, 30);
- // JS_SetGCParameter(cx, JSGC_DECOMMIT_THRESHOLD, 32);
/* set ourselves as the private data */
JS_SetContextPrivate(cx, uninitialized_gjs);
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index 7db6e770..ce49bc1f 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -574,7 +574,8 @@ gjs_gc_if_needed (JSContext *context)
uint64_t rss_usize = rss_size;
if (rss_usize > linux_rss_trigger) {
linux_rss_trigger = MIN(G_MAXUINT32, rss_usize * 1.25);
- JS::NonIncrementalGC(context, GC_SHRINK,
+
+ JS::NonIncrementalGC(context, JS::GCOptions::Shrink,
Gjs::GCReason::LINUX_RSS_TRIGGER);
} else if (rss_size < (0.75 * linux_rss_trigger)) {
/* If we've shrunk by 75%, lower the trigger */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]