Implement configuration pref for Generational Garbage Collection.

Pref: javascript.options.mem.gc_generational
This resolves #20
This commit is contained in:
wolfbeast 2017-07-19 01:24:28 +02:00 committed by Roy Tam
commit 935b074787
4 changed files with 20 additions and 0 deletions

View file

@ -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)
{