Bug 1507377 - Set pretenuring from an environment variable r=jonco
authorPaul Bone <pbone@mozilla.com>
Thu, 13 Dec 2018 14:07:08 +1100
changeset 451005 3419d7dc0a29460dd5ea0e7f5fa160dee39fa6d4
parent 451004 f3a6aa5f0ca664fb25a7b346483d93f8b7c515d4
child 451006 24d7c1d1ea09a99df731986ab3ee0bb2b12c684d
push id110589
push userpbone@mozilla.com
push dateTue, 18 Dec 2018 00:58:40 +0000
treeherdermozilla-inbound@3419d7dc0a29 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1507377
milestone66.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 1507377 - Set pretenuring from an environment variable r=jonco
js/src/gc/GC.cpp
--- a/js/src/gc/GC.cpp
+++ b/js/src/gc/GC.cpp
@@ -1261,16 +1261,27 @@ bool GCRuntime::init(uint32_t maxbytes, 
     const char* size = getenv("JSGC_MARK_STACK_LIMIT");
     if (size) {
       setMarkStackLimit(atoi(size), lock);
     }
 
     if (!nursery().init(maxNurseryBytes, lock)) {
       return false;
     }
+
+    const char* pretenureThresholdStr = getenv("JSGC_PRETENURE_THRESHOLD");
+    if (pretenureThresholdStr && pretenureThresholdStr[0]) {
+      char* last;
+      long pretenureThreshold = strtol(pretenureThresholdStr, &last, 10);
+      if (last[0] || !tunables.setParameter(JSGC_PRETENURE_THRESHOLD,
+                                            pretenureThreshold, lock)) {
+        fprintf(stderr, "Invalid value for JSGC_PRETENURE_THRESHOLD: %s\n",
+                pretenureThresholdStr);
+      }
+    }
   }
 
 #ifdef JS_GC_ZEAL
   const char* zealSpec = getenv("JS_GC_ZEAL");
   if (zealSpec && zealSpec[0] && !parseAndSetZeal(zealSpec)) {
     return false;
   }
 #endif