summaryrefslogtreecommitdiffstats
path: root/js/src/jsapi.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2017-07-19 01:24:28 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-02-02 19:03:24 +0100
commit8a1dc97a5aaf1f245b8bbf72de0e9458d15eeb81 (patch)
tree7793437a25822339e20a82ed16f7f66cc54e1eaf /js/src/jsapi.cpp
parent216bd0a9580417e846aa357e3bc2a6dcfd5b1409 (diff)
downloadUXP-8a1dc97a5aaf1f245b8bbf72de0e9458d15eeb81.tar
UXP-8a1dc97a5aaf1f245b8bbf72de0e9458d15eeb81.tar.gz
UXP-8a1dc97a5aaf1f245b8bbf72de0e9458d15eeb81.tar.lz
UXP-8a1dc97a5aaf1f245b8bbf72de0e9458d15eeb81.tar.xz
UXP-8a1dc97a5aaf1f245b8bbf72de0e9458d15eeb81.zip
Implement configuration pref for Generational Garbage Collection.
Pref: javascript.options.mem.gc_generational This resolves #20
Diffstat (limited to 'js/src/jsapi.cpp')
-rw-r--r--js/src/jsapi.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp
index a99d08951..e4e86effa 100644
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -1410,6 +1410,17 @@ JS_SetGCParameter(JSContext* cx, JSGCParamKey key, uint32_t value)
MOZ_ALWAYS_TRUE(cx->gc.setParameter(key, value, lock));
}
+JS_PUBLIC_API(void)
+JS_SetGGCMode(JSContext* cx, bool enabled)
+{
+ // Control GGC
+ if (enabled && !cx->gc.isGenerationalGCEnabled()) {
+ cx->gc.enableGenerationalGC();
+ } else if (!enabled && cx->gc.isGenerationalGCEnabled()) {
+ cx->gc.disableGenerationalGC();
+ }
+}
+
JS_PUBLIC_API(uint32_t)
JS_GetGCParameter(JSContext* cx, JSGCParamKey key)
{