Bug 1532838 - Add a pref for the minimum nursery size r=mccr8
authorPaul Bone <pbone@mozilla.com>
Mon, 06 May 2019 03:14:22 +0000
changeset 531461 fbf69131cbda3adc802180e60c14fc6700cb2d90
parent 531460 81d3a25685dcde796218147075147e44177615a5
child 531462 2509defe2779464cd2df4c211decf32e5be37909
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1532838
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 1532838 - Add a pref for the minimum nursery size r=mccr8 Differential Revision: https://phabricator.services.mozilla.com/D29815
dom/base/nsJSEnvironment.cpp
js/public/GCAPI.h
modules/libpref/init/all.js
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -2350,18 +2350,18 @@ static void SetMemoryPrefChangedCallback
   CheckedInt<int32_t> prefB = CheckedInt<int32_t>(prefMB) * 1024 * 1024;
   if (prefB.isValid() && prefB.value() >= 0) {
     SetGCParameter((JSGCParamKey)(uintptr_t)aClosure, prefB.value());
   } else {
     ResetGCParameter((JSGCParamKey)(uintptr_t)aClosure);
   }
 }
 
-static void SetMemoryNurseryMaxPrefChangedCallback(const char* aPrefName,
-                                                   void* aClosure) {
+static void SetMemoryNurseryPrefChangedCallback(const char* aPrefName,
+                                                void* aClosure) {
   int32_t prefKB = Preferences::GetInt(aPrefName, -1);
   // handle overflow and negative pref values
   CheckedInt<int32_t> prefB = CheckedInt<int32_t>(prefKB) * 1024;
   if (prefB.isValid() && prefB.value() >= 0) {
     SetGCParameter((JSGCParamKey)(uintptr_t)aClosure, prefB.value());
   } else {
     ResetGCParameter((JSGCParamKey)(uintptr_t)aClosure);
   }
@@ -2506,17 +2506,20 @@ void nsJSContext::EnsureStatics() {
   // Set these global xpconnect options...
   Preferences::RegisterCallbackAndCall(SetMemoryPrefChangedCallbackMB,
                                        "javascript.options.mem.high_water_mark",
                                        (void*)JSGC_MAX_MALLOC_BYTES);
 
   Preferences::RegisterCallbackAndCall(SetMemoryPrefChangedCallbackMB,
                                        "javascript.options.mem.max",
                                        (void*)JSGC_MAX_BYTES);
-  Preferences::RegisterCallbackAndCall(SetMemoryNurseryMaxPrefChangedCallback,
+  Preferences::RegisterCallbackAndCall(SetMemoryNurseryPrefChangedCallback,
+                                       "javascript.options.mem.nursery.min_kb",
+                                       (void*)JSGC_MIN_NURSERY_BYTES);
+  Preferences::RegisterCallbackAndCall(SetMemoryNurseryPrefChangedCallback,
                                        "javascript.options.mem.nursery.max_kb",
                                        (void*)JSGC_MAX_NURSERY_BYTES);
 
   Preferences::RegisterCallbackAndCall(SetMemoryGCModePrefChangedCallback,
                                        "javascript.options.mem.gc_per_zone");
 
   Preferences::RegisterCallbackAndCall(SetMemoryGCModePrefChangedCallback,
                                        "javascript.options.mem.gc_incremental");
--- a/js/public/GCAPI.h
+++ b/js/public/GCAPI.h
@@ -298,17 +298,17 @@ typedef enum JSGCParamKey {
 
   /**
    * Minimum size of the generational GC nurseries.
    *
    * This value will be rounded to the nearest Nursery::SubChunkStep if below
    * gc::ChunkSize, otherwise it'll be rounded to the nearest gc::ChunkSize.
    *
    * Default: Nursery::SubChunkLimit
-   * Pref: None
+   * Pref: javascript.options.mem.nursery.min_kb
    */
   JSGC_MIN_NURSERY_BYTES = 31,
 
   /*
    * The minimum time to allow between triggering last ditch GCs in seconds.
    *
    * Default: 60 seconds
    * Pref: None
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -1474,20 +1474,22 @@ pref("javascript.options.discardSystemSo
 // How much malloc memory can be allocated before triggering a GC, in MB.
 pref("javascript.options.mem.high_water_mark", 128);
 
 // JSGC_MAX_BYTES
 // SpiderMonkey defaults to 2^32-1 bytes, but this is measured in MB so that
 // cannot be represented directly in order to show it in about:config.
 pref("javascript.options.mem.max", -1);
 
-// JSGC_MAX_NURSERY_BYTES
+// JSGC_MIN_NURSERY_BYTES / JSGC_MAX_NURSERY_BYTES
 #if defined(ANDROID) || defined(XP_IOS)
+pref("javascript.options.mem.nursery.min_kb", 192);
 pref("javascript.options.mem.nursery.max_kb", 4096);
 #else
+pref("javascript.options.mem.nursery.min_kb", 192);
 pref("javascript.options.mem.nursery.max_kb", 16384);
 #endif
 
 // JSGC_MODE
 pref("javascript.options.mem.gc_per_zone", true);
 pref("javascript.options.mem.gc_incremental", true);
 
 // JSGC_SLICE_TIME_BUDGET