[gjs/mozjs91: 11/21] Update GC API - https://bugzilla.mozilla.org/show_bug.cgi?id=1686249




commit ca073f585931ec859472c1af979da3bdc5fd11f2
Author: Evan Welsh <contact evanwelsh com>
Date:   Sat Jul 10 20:31:11 2021 -0700

    Update GC API - https://bugzilla.mozilla.org/show_bug.cgi?id=1686249

 gjs/engine.cpp     | 11 +----------
 gjs/jsapi-util.cpp |  4 +++-
 2 files changed, 4 insertions(+), 11 deletions(-)
---
diff --git a/gjs/engine.cpp b/gjs/engine.cpp
index 4908c775..7b68151d 100644
--- a/gjs/engine.cpp
+++ b/gjs/engine.cpp
@@ -195,19 +195,10 @@ JSContext* gjs_create_js_context(GjsContextPrivate* uninitialized_gjs) {
         return nullptr;
     }
 
-    // commented are defaults in moz-24
     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 2e404781..375e78f3 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -575,7 +575,9 @@ 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::GCReason::API);
+
+            JS::NonIncrementalGC(context, JS::GCOptions::Shrink,
+                                 JS::GCReason::API);
         } else if (rss_size < (0.75 * linux_rss_trigger)) {
             /* If we've shrunk by 75%, lower the trigger */
             linux_rss_trigger = rss_usize * 1.25;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]