mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 1384010 - Create prefs for allocation threshold factors. r=jonco
--HG-- extra : rebase_source : 61ad2bd2ef8c07be5ffafb8518800f50126a4383
This commit is contained in:
parent
2556466b06
commit
3c56bb4f01
@ -2682,6 +2682,12 @@ nsJSContext::EnsureStatics()
|
||||
Preferences::RegisterCallbackAndCall(SetMemoryPrefChangedCallbackInt,
|
||||
"javascript.options.mem.gc_allocation_threshold_mb",
|
||||
(void *)JSGC_ALLOCATION_THRESHOLD);
|
||||
Preferences::RegisterCallbackAndCall(SetMemoryPrefChangedCallbackInt,
|
||||
"javascript.options.mem.gc_allocation_threshold_factor",
|
||||
(void *)JSGC_ALLOCATION_THRESHOLD_FACTOR);
|
||||
Preferences::RegisterCallbackAndCall(SetMemoryPrefChangedCallbackInt,
|
||||
"javascript.options.mem.gc_allocation_threshold_factor_avoid_interrupt",
|
||||
(void *)JSGC_ALLOCATION_THRESHOLD_FACTOR_AVOID_INTERRUPT);
|
||||
|
||||
Preferences::RegisterCallbackAndCall(SetIncrementalCCPrefChangedCallback,
|
||||
"dom.cycle_collector.incremental");
|
||||
|
@ -162,9 +162,18 @@ class GCSchedulingTunables
|
||||
*/
|
||||
ActiveThreadOrGCTaskData<size_t> gcZoneAllocThresholdBase_;
|
||||
|
||||
/* Fraction of threshold.gcBytes() which triggers an incremental GC. */
|
||||
/*
|
||||
* JSGC_ALLOCATION_THRESHOLD_FACTOR
|
||||
*
|
||||
* Fraction of threshold.gcBytes() which triggers an incremental GC.
|
||||
*/
|
||||
UnprotectedData<float> zoneAllocThresholdFactor_;
|
||||
/* The same except when doing so would interrupt an already running GC. */
|
||||
|
||||
/*
|
||||
* JSGC_ALLOCATION_THRESHOLD_FACTOR_AVOID_INTERRUPT
|
||||
*
|
||||
* The same except when doing so would interrupt an already running GC.
|
||||
*/
|
||||
UnprotectedData<float> zoneAllocThresholdFactorAvoidInterrupt_;
|
||||
|
||||
/*
|
||||
|
@ -1973,6 +1973,23 @@ typedef enum JSGCParamKey {
|
||||
* Default: RefreshFrameSlicesEnabled
|
||||
*/
|
||||
JSGC_REFRESH_FRAME_SLICES_ENABLED = 24,
|
||||
|
||||
/**
|
||||
* Factor for triggering a GC based on JSGC_ALLOCATION_THRESHOLD
|
||||
*
|
||||
* Default: ZoneAllocThresholdFactorDefault
|
||||
* Pref: None
|
||||
*/
|
||||
JSGC_ALLOCATION_THRESHOLD_FACTOR = 25,
|
||||
|
||||
/**
|
||||
* Factor for triggering a GC based on JSGC_ALLOCATION_THRESHOLD.
|
||||
* Used if another GC (in different zones) is already running.
|
||||
*
|
||||
* Default: ZoneAllocThresholdFactorAvoidInterruptDefault
|
||||
* Pref: None
|
||||
*/
|
||||
JSGC_ALLOCATION_THRESHOLD_FACTOR_AVOID_INTERRUPT = 26,
|
||||
} JSGCParamKey;
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
|
@ -278,7 +278,11 @@ namespace TuningDefaults {
|
||||
|
||||
/* JSGC_ALLOCATION_THRESHOLD */
|
||||
static const size_t GCZoneAllocThresholdBase = 30 * 1024 * 1024;
|
||||
|
||||
/* JSGC_ALLOCATION_THRESHOLD_FACTOR */
|
||||
static const float ZoneAllocThresholdFactor = 0.9f;
|
||||
|
||||
/* JSGC_ALLOCATION_THRESHOLD_FACTOR_AVOID_INTERRUPT */
|
||||
static const float ZoneAllocThresholdFactorAvoidInterrupt = 0.9f;
|
||||
|
||||
/* no parameter */
|
||||
@ -1342,6 +1346,20 @@ GCSchedulingTunables::setParameter(JSGCParamKey key, uint32_t value, const AutoL
|
||||
case JSGC_ALLOCATION_THRESHOLD:
|
||||
gcZoneAllocThresholdBase_ = value * 1024 * 1024;
|
||||
break;
|
||||
case JSGC_ALLOCATION_THRESHOLD_FACTOR: {
|
||||
float newFactor = value / 100.0;
|
||||
if (newFactor <= 0.1 || newFactor > 1.0)
|
||||
return false;
|
||||
zoneAllocThresholdFactor_ = newFactor;
|
||||
break;
|
||||
}
|
||||
case JSGC_ALLOCATION_THRESHOLD_FACTOR_AVOID_INTERRUPT: {
|
||||
float newFactor = value / 100.0;
|
||||
if (newFactor <= 0.1 || newFactor > 1.0)
|
||||
return false;
|
||||
zoneAllocThresholdFactorAvoidInterrupt_ = newFactor;
|
||||
break;
|
||||
}
|
||||
case JSGC_MIN_EMPTY_CHUNK_COUNT:
|
||||
setMinEmptyChunkCount(value);
|
||||
break;
|
||||
@ -1488,6 +1506,13 @@ GCSchedulingTunables::resetParameter(JSGCParamKey key, const AutoLockGC& lock)
|
||||
case JSGC_ALLOCATION_THRESHOLD:
|
||||
gcZoneAllocThresholdBase_ = TuningDefaults::GCZoneAllocThresholdBase;
|
||||
break;
|
||||
case JSGC_ALLOCATION_THRESHOLD_FACTOR:
|
||||
zoneAllocThresholdFactor_ = TuningDefaults::ZoneAllocThresholdFactor;
|
||||
break;
|
||||
case JSGC_ALLOCATION_THRESHOLD_FACTOR_AVOID_INTERRUPT:
|
||||
zoneAllocThresholdFactorAvoidInterrupt_ =
|
||||
TuningDefaults::ZoneAllocThresholdFactorAvoidInterrupt;
|
||||
break;
|
||||
case JSGC_MIN_EMPTY_CHUNK_COUNT:
|
||||
setMinEmptyChunkCount(TuningDefaults::MinEmptyChunkCount);
|
||||
break;
|
||||
@ -1548,6 +1573,10 @@ GCRuntime::getParameter(JSGCParamKey key, const AutoLockGC& lock)
|
||||
return tunables.isDynamicMarkSliceEnabled();
|
||||
case JSGC_ALLOCATION_THRESHOLD:
|
||||
return tunables.gcZoneAllocThresholdBase() / 1024 / 1024;
|
||||
case JSGC_ALLOCATION_THRESHOLD_FACTOR:
|
||||
return uint32_t(tunables.zoneAllocThresholdFactor() * 100);
|
||||
case JSGC_ALLOCATION_THRESHOLD_FACTOR_AVOID_INTERRUPT:
|
||||
return uint32_t(tunables.zoneAllocThresholdFactorAvoidInterrupt() * 100);
|
||||
case JSGC_MIN_EMPTY_CHUNK_COUNT:
|
||||
return tunables.minEmptyChunkCount(lock);
|
||||
case JSGC_MAX_EMPTY_CHUNK_COUNT:
|
||||
|
@ -1520,6 +1520,12 @@ pref("javascript.options.mem.gc_refresh_frame_slices_enabled", true);
|
||||
// JSGC_ALLOCATION_THRESHOLD
|
||||
pref("javascript.options.mem.gc_allocation_threshold_mb", 30);
|
||||
|
||||
// JSGC_ALLOCATION_THRESHOLD_FACTOR
|
||||
pref("javascript.options.mem.gc_allocation_threshold_factor", 90);
|
||||
|
||||
// JSGC_ALLOCATION_THRESHOLD_FACTOR_AVOID_INTERRUPT
|
||||
pref("javascript.options.mem.gc_allocation_threshold_factor_avoid_interrupt", 90);
|
||||
|
||||
// JSGC_MIN_EMPTY_CHUNK_COUNT
|
||||
pref("javascript.options.mem.gc_min_empty_chunk_count", 1);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user