Commit f2b9ad36 authored by Paul Bone's avatar Paul Bone
Browse files

Bug 1507377 - Set pretenuring from an environment variable r=jonco

--HG--
extra : rebase_source : 8106dd065be57526e69cd5853ff791d19b14a143
parent 6299b00e
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1266,6 +1266,17 @@ bool GCRuntime::init(uint32_t maxbytes, uint32_t maxNurseryBytes) {
    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