Bug 1548161 - Add a JSGC parameter for zoneAllocDelayBytes r=jonco
authorPaul Bone <pbone@mozilla.com>
Wed, 01 May 2019 12:30:46 +0000
changeset 531040 8a7e44a884fc0f719fe953fcca70183f7f87d4ec
parent 531039 c0f3a0adee3ccb1bda58b1d0820bb1b961ec3c54
child 531041 ad04ccedc21ed4373acff2d310388bc55725182b
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)
reviewersjonco
bugs1548161
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 1548161 - Add a JSGC parameter for zoneAllocDelayBytes r=jonco Differential Revision: https://phabricator.services.mozilla.com/D29476
js/public/GCAPI.h
js/src/builtin/TestingFunctions.cpp
js/src/gc/GC.cpp
--- a/js/public/GCAPI.h
+++ b/js/public/GCAPI.h
@@ -310,16 +310,23 @@ typedef enum JSGCParamKey {
   /*
    * The minimum time to allow between triggering last ditch GCs in seconds.
    *
    * Default: 60 seconds
    * Pref: None
    */
   JSGC_MIN_LAST_DITCH_GC_PERIOD = 32,
 
+  /*
+   * The delay (in heapsize kilobytes) between slices of an incremental GC.
+   *
+   * Default: ZoneAllocDelayBytes
+   */
+  JSGC_ZONE_ALLOC_DELAY_KB = 33,
+
 } JSGCParamKey;
 
 /*
  * Generic trace operation that calls JS::TraceEdge on each traceable thing's
  * location reachable from data.
  */
 typedef void (*JSTraceDataOp)(JSTracer* trc, void* data);
 
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -503,17 +503,18 @@ static bool MinorGC(JSContext* cx, unsig
   _("maxEmptyChunkCount", JSGC_MAX_EMPTY_CHUNK_COUNT, true)                  \
   _("compactingEnabled", JSGC_COMPACTING_ENABLED, true)                      \
   _("minLastDitchGCPeriod", JSGC_MIN_LAST_DITCH_GC_PERIOD, true)             \
   _("nurseryFreeThresholdForIdleCollection",                                 \
     JSGC_NURSERY_FREE_THRESHOLD_FOR_IDLE_COLLECTION, true)                   \
   _("nurseryFreeThresholdForIdleCollectionPercent",                          \
     JSGC_NURSERY_FREE_THRESHOLD_FOR_IDLE_COLLECTION_PERCENT, true)           \
   _("pretenureThreshold", JSGC_PRETENURE_THRESHOLD, true)                    \
-  _("pretenureGroupThreshold", JSGC_PRETENURE_GROUP_THRESHOLD, true)
+  _("pretenureGroupThreshold", JSGC_PRETENURE_GROUP_THRESHOLD, true)         \
+  _("zoneAllocDelayKB", JSGC_ZONE_ALLOC_DELAY_KB, true)
 
 static const struct ParamInfo {
   const char* name;
   JSGCParamKey param;
   bool writable;
 } paramMap[] = {
 #define DEFINE_PARAM_INFO(name, key, writable) {name, key, writable},
     FOR_EACH_GC_PARAM(DEFINE_PARAM_INFO)
--- a/js/src/gc/GC.cpp
+++ b/js/src/gc/GC.cpp
@@ -304,17 +304,17 @@ static const float AllocThresholdFactorA
 static const float MallocThresholdGrowFactor = 1.5f;
 
 /* no parameter */
 static const float MallocThresholdShrinkFactor = 0.9f;
 
 /* no parameter */
 static const size_t MallocThresholdLimit = 1024 * 1024 * 1024;
 
-/* no parameter */
+/* JSGC_ZONE_ALLOC_DELAY_KB */
 static const size_t ZoneAllocDelayBytes = 1024 * 1024;
 
 /* JSGC_DYNAMIC_HEAP_GROWTH */
 static const bool DynamicHeapGrowthEnabled = false;
 
 /* JSGC_HIGH_FREQUENCY_TIME_LIMIT */
 static const auto HighFrequencyThreshold = 1;  // in seconds
 
@@ -1524,16 +1524,19 @@ bool GCSchedulingTunables::setParameter(
       if (value <= 0) {
         return false;
       }
       pretenureGroupThreshold_ = value;
       break;
     case JSGC_MIN_LAST_DITCH_GC_PERIOD:
       minLastDitchGCPeriod_ = TimeDuration::FromSeconds(value);
       break;
+    case JSGC_ZONE_ALLOC_DELAY_KB:
+      zoneAllocDelayBytes_ = value * 1024;
+      break;
     default:
       MOZ_CRASH("Unknown GC parameter.");
   }
 
   return true;
 }
 
 void GCSchedulingTunables::setMaxMallocBytes(size_t value) {
@@ -1715,16 +1718,19 @@ void GCSchedulingTunables::resetParamete
       pretenureThreshold_ = TuningDefaults::PretenureThreshold;
       break;
     case JSGC_PRETENURE_GROUP_THRESHOLD:
       pretenureGroupThreshold_ = TuningDefaults::PretenureGroupThreshold;
       break;
     case JSGC_MIN_LAST_DITCH_GC_PERIOD:
       minLastDitchGCPeriod_ = TuningDefaults::MinLastDitchGCPeriod;
       break;
+    case JSGC_ZONE_ALLOC_DELAY_KB:
+      zoneAllocDelayBytes_ = TuningDefaults::ZoneAllocDelayBytes;
+      break;
     default:
       MOZ_CRASH("Unknown GC parameter.");
   }
 }
 
 uint32_t GCRuntime::getParameter(JSGCParamKey key, const AutoLockGC& lock) {
   switch (key) {
     case JSGC_MAX_BYTES:
@@ -1792,16 +1798,18 @@ uint32_t GCRuntime::getParameter(JSGCPar
       return uint32_t(tunables.nurseryFreeThresholdForIdleCollectionFraction() *
                       100.0f);
     case JSGC_PRETENURE_THRESHOLD:
       return uint32_t(tunables.pretenureThreshold() * 100);
     case JSGC_PRETENURE_GROUP_THRESHOLD:
       return tunables.pretenureGroupThreshold();
     case JSGC_MIN_LAST_DITCH_GC_PERIOD:
       return tunables.minLastDitchGCPeriod().ToSeconds();
+    case JSGC_ZONE_ALLOC_DELAY_KB:
+      return tunables.zoneAllocDelayBytes() / 1024;
     default:
       MOZ_CRASH("Unknown parameter key");
   }
 }
 
 void GCRuntime::setMarkStackLimit(size_t limit, AutoLockGC& lock) {
   MOZ_ASSERT(!JS::RuntimeHeapIsBusy());
   AutoUnlockGC unlock(lock);