diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2017-07-19 01:24:28 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-02-02 19:03:24 +0100 |
commit | 1852c4834b4a12fff9c147e5f3ecfb2620430367 (patch) | |
tree | 7793437a25822339e20a82ed16f7f66cc54e1eaf /js | |
parent | c88530e150268a8e493c97050aa074e11be6052c (diff) | |
download | uxp-1852c4834b4a12fff9c147e5f3ecfb2620430367.tar.gz |
Implement configuration pref for Generational Garbage Collection.
Pref: javascript.options.mem.gc_generational
This resolves #20
Diffstat (limited to 'js')
-rw-r--r-- | js/src/jsapi.cpp | 11 | ||||
-rw-r--r-- | js/src/jsapi.h | 3 |
2 files changed, 14 insertions, 0 deletions
diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index a99d08951a..e4e86effac 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) { diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 46aa159471..6700a6c514 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -1768,6 +1768,9 @@ typedef enum JSGCParamKey { extern JS_PUBLIC_API(void) JS_SetGCParameter(JSContext* cx, JSGCParamKey key, uint32_t value); +extern JS_PUBLIC_API(void) +JS_SetGGCMode(JSContext* cx, bool enabled); + extern JS_PUBLIC_API(uint32_t) JS_GetGCParameter(JSContext* cx, JSGCParamKey key); |