Bug 1539031 - (part 3) Set the GC modes from prefs with the new mode r=mccr8
authorPaul Bone <pbone@mozilla.com>
Tue, 26 Mar 2019 16:57:41 +0000
changeset 466246 1467f14d7dd6bc82b4d445dd6505353069d005ff
parent 466245 4ed9790591356611cecb37855fa3c351018ebf29
child 466247 cebb5fa563f96382ce4036ddd0f53168d9211006
push id35762
push usercsabou@mozilla.com
push dateWed, 27 Mar 2019 04:44:00 +0000
treeherdermozilla-central@bc572aee49b6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1539031
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1539031 - (part 3) Set the GC modes from prefs with the new mode r=mccr8 Differential Revision: https://phabricator.services.mozilla.com/D24851
dom/base/nsJSEnvironment.cpp
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -2352,21 +2352,27 @@ static void SetMemoryPrefChangedCallback
 static void 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");
   JSGCMode mode;
   if (enableIncrementalGC) {
-    mode = JSGC_MODE_ZONE_INCREMENTAL;
-  } else if (enableZoneGC) {
-    mode = JSGC_MODE_ZONE;
+    if (enableZoneGC) {
+      mode = JSGC_MODE_ZONE_INCREMENTAL;
+    } else {
+      mode = JSGC_MODE_INCREMENTAL;
+    }
   } else {
-    mode = JSGC_MODE_GLOBAL;
+    if (enableZoneGC) {
+      mode = JSGC_MODE_ZONE;
+    } else {
+      mode = JSGC_MODE_GLOBAL;
+    }
   }
 
   SetGCParameter(JSGC_MODE, mode);
 }
 
 static void SetMemoryGCSliceTimePrefChangedCallback(const char* aPrefName,
                                                     void* aClosure) {
   int32_t pref = Preferences::GetInt(aPrefName, -1);