Bug 1770768 - Part 3: Add browser prefs for the new GC parameters r=mccr8,sfink

Differential Revision: https://phabricator.services.mozilla.com/D152864
This commit is contained in:
Jon Coppeard 2022-08-02 10:05:05 +00:00
Родитель d5ad2725fb
Коммит 0ebad143ef
4 изменённых файлов: 23 добавлений и 1 удалений

Просмотреть файл

@ -2073,6 +2073,16 @@ void nsJSContext::EnsureStatics() {
"javascript.options.mem.gc_high_frequency_small_heap_growth", "javascript.options.mem.gc_high_frequency_small_heap_growth",
(void*)JSGC_HIGH_FREQUENCY_SMALL_HEAP_GROWTH); (void*)JSGC_HIGH_FREQUENCY_SMALL_HEAP_GROWTH);
Preferences::RegisterCallbackAndCall(
SetMemoryPrefChangedCallbackBool,
"javascript.options.mem.gc_balanced_heap_limits",
(void*)JSGC_BALANCED_HEAP_LIMITS_ENABLED);
Preferences::RegisterCallbackAndCall(
SetMemoryPrefChangedCallbackInt,
"javascript.options.mem.gc_heap_growth_factor",
(void*)JSGC_HEAP_GROWTH_FACTOR);
Preferences::RegisterCallbackAndCall( Preferences::RegisterCallbackAndCall(
SetMemoryPrefChangedCallbackInt, SetMemoryPrefChangedCallbackInt,
"javascript.options.mem.gc_small_heap_size_max_mb", "javascript.options.mem.gc_small_heap_size_max_mb",

Просмотреть файл

@ -350,6 +350,8 @@ void LoadJSGCMemoryOptions(const char* aPrefName, void* /* aClosure */) {
JSGC_HIGH_FREQUENCY_SMALL_HEAP_GROWTH), JSGC_HIGH_FREQUENCY_SMALL_HEAP_GROWTH),
PREF("gc_small_heap_size_max_mb", JSGC_SMALL_HEAP_SIZE_MAX), PREF("gc_small_heap_size_max_mb", JSGC_SMALL_HEAP_SIZE_MAX),
PREF("gc_large_heap_size_min_mb", JSGC_LARGE_HEAP_SIZE_MIN), PREF("gc_large_heap_size_min_mb", JSGC_LARGE_HEAP_SIZE_MIN),
PREF("gc_balanced_heap_limits", JSGC_BALANCED_HEAP_LIMITS_ENABLED),
PREF("gc_heap_growth_factor", JSGC_HEAP_GROWTH_FACTOR),
PREF("gc_allocation_threshold_mb", JSGC_ALLOCATION_THRESHOLD), PREF("gc_allocation_threshold_mb", JSGC_ALLOCATION_THRESHOLD),
PREF("gc_malloc_threshold_base_mb", JSGC_MALLOC_THRESHOLD_BASE), PREF("gc_malloc_threshold_base_mb", JSGC_MALLOC_THRESHOLD_BASE),
PREF("gc_small_heap_incremental_limit", PREF("gc_small_heap_incremental_limit",
@ -408,7 +410,8 @@ void LoadJSGCMemoryOptions(const char* aPrefName, void* /* aClosure */) {
UpdateOtherJSGCMemoryOption(rts, pref->key, value); UpdateOtherJSGCMemoryOption(rts, pref->key, value);
break; break;
} }
case JSGC_COMPACTING_ENABLED: { case JSGC_COMPACTING_ENABLED:
case JSGC_BALANCED_HEAP_LIMITS_ENABLED: {
bool present; bool present;
bool prefValue = GetPref(pref->fullName, false, &present); bool prefValue = GetPref(pref->fullName, false, &present);
Maybe<uint32_t> value = present ? Some(prefValue ? 1 : 0) : Nothing(); Maybe<uint32_t> value = present ? Some(prefValue ? 1 : 0) : Nothing();
@ -428,6 +431,7 @@ void LoadJSGCMemoryOptions(const char* aPrefName, void* /* aClosure */) {
case JSGC_URGENT_THRESHOLD_MB: case JSGC_URGENT_THRESHOLD_MB:
case JSGC_MIN_EMPTY_CHUNK_COUNT: case JSGC_MIN_EMPTY_CHUNK_COUNT:
case JSGC_MAX_EMPTY_CHUNK_COUNT: case JSGC_MAX_EMPTY_CHUNK_COUNT:
case JSGC_HEAP_GROWTH_FACTOR:
UpdateCommonJSGCMemoryOption(rts, pref->fullName, pref->key); UpdateCommonJSGCMemoryOption(rts, pref->fullName, pref->key);
break; break;
default: default:

Просмотреть файл

@ -229,6 +229,7 @@ typedef enum JSGCParamKey {
* Otherwise, heap limits are set based on a linear multiple of the retained * Otherwise, heap limits are set based on a linear multiple of the retained
* size after the last collection. * size after the last collection.
* *
* Pref: javascript.options.mem.gc_balanced_heap_limits
* Default: BalancedHeapLimitsEnabled * Default: BalancedHeapLimitsEnabled
*/ */
JSGC_BALANCED_HEAP_LIMITS_ENABLED = 17, JSGC_BALANCED_HEAP_LIMITS_ENABLED = 17,
@ -239,6 +240,7 @@ typedef enum JSGCParamKey {
* This parameter trades off GC time for memory usage. Smaller values result * This parameter trades off GC time for memory usage. Smaller values result
* in lower memory use and larger values result in less time spent collecting. * in lower memory use and larger values result in less time spent collecting.
* *
* Pref: javascript.options.mem.gc_heap_growth_factor
* Default: HeapGrowthFactor * Default: HeapGrowthFactor
*/ */
JSGC_HEAP_GROWTH_FACTOR = 18, JSGC_HEAP_GROWTH_FACTOR = 18,

Просмотреть файл

@ -1042,6 +1042,12 @@ pref("javascript.options.mem.gc_high_frequency_large_heap_growth", 150);
// JSGC_LOW_FREQUENCY_HEAP_GROWTH // JSGC_LOW_FREQUENCY_HEAP_GROWTH
pref("javascript.options.mem.gc_low_frequency_heap_growth", 150); pref("javascript.options.mem.gc_low_frequency_heap_growth", 150);
// JSGC_BALANCED_HEAP_LIMITS_ENABLED
pref("javascript.options.mem.gc_balanced_heap_limits", false);
// JSGC_HEAP_GROWTH_FACTOR
pref("javascript.options.mem.gc_heap_growth_factor", 40);
// JSGC_ALLOCATION_THRESHOLD // JSGC_ALLOCATION_THRESHOLD
pref("javascript.options.mem.gc_allocation_threshold_mb", 27); pref("javascript.options.mem.gc_allocation_threshold_mb", 27);