summaryrefslogtreecommitdiffstats
path: root/dom
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 /dom
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 'dom')
-rw-r--r--dom/base/nsJSEnvironment.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp
index b273d00c9..576f3052a 100644
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -2282,6 +2282,7 @@ SetMemoryGCModePrefChangedCallback(const char* aPrefName, void* aClosure)
{
bool enableZoneGC = Preferences::GetBool("javascript.options.mem.gc_per_zone");
bool enableIncrementalGC = Preferences::GetBool("javascript.options.mem.gc_incremental");
+ bool enableGenerationalGC = Preferences::GetBool("javascript.options.mem.gc_generational");
JSGCMode mode;
if (enableIncrementalGC) {
mode = JSGC_MODE_INCREMENTAL;
@@ -2291,6 +2292,7 @@ SetMemoryGCModePrefChangedCallback(const char* aPrefName, void* aClosure)
mode = JSGC_MODE_GLOBAL;
}
JS_SetGCParameter(sContext, JSGC_MODE, mode);
+ JS_SetGGCMode(sContext, enableGenerationalGC);
}
static void
@@ -2485,6 +2487,9 @@ nsJSContext::EnsureStatics()
Preferences::RegisterCallbackAndCall(SetMemoryGCSliceTimePrefChangedCallback,
"javascript.options.mem.gc_incremental_slice_ms");
+ Preferences::RegisterCallbackAndCall(SetMemoryGCModePrefChangedCallback,
+ "javascript.options.mem.gc_generational");
+
Preferences::RegisterCallbackAndCall(SetMemoryGCCompactingPrefChangedCallback,
"javascript.options.mem.gc_compacting");