forked from mirrors/gecko-dev
Bug 1895661 - Part 2: Add browser prefs for GC zeal r=sfink
There was existing code to read the prefs, but the prefs themselves had been removed. I renamed the prefs in line with all the other JS GC options, so starting javascript.options.mem.gc_. Differential Revision: https://phabricator.services.mozilla.com/D210059
This commit is contained in:
parent
e38e561b0a
commit
0cf7156d6d
3 changed files with 23 additions and 18 deletions
|
|
@ -131,7 +131,9 @@ static_assert(MAX_WORKERS_PER_DOMAIN >= 1,
|
||||||
// Prefixes for observing preference changes.
|
// Prefixes for observing preference changes.
|
||||||
#define PREF_JS_OPTIONS_PREFIX "javascript.options."
|
#define PREF_JS_OPTIONS_PREFIX "javascript.options."
|
||||||
#define PREF_MEM_OPTIONS_PREFIX "mem."
|
#define PREF_MEM_OPTIONS_PREFIX "mem."
|
||||||
#define PREF_GCZEAL "gczeal"
|
#define PREF_GCZEAL_OPTIONS_PREFIX "mem.gc_zeal."
|
||||||
|
#define PREF_MODE "mode"
|
||||||
|
#define PREF_FREQUENCY "frequency"
|
||||||
|
|
||||||
static NS_DEFINE_CID(kStreamTransportServiceCID, NS_STREAMTRANSPORTSERVICE_CID);
|
static NS_DEFINE_CID(kStreamTransportServiceCID, NS_STREAMTRANSPORTSERVICE_CID);
|
||||||
|
|
||||||
|
|
@ -229,12 +231,6 @@ void LoadContextOptions(const char* aPrefName, void* /* aClosure */) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef JS_GC_ZEAL
|
|
||||||
if (prefName.EqualsLiteral(PREF_JS_OPTIONS_PREFIX PREF_GCZEAL)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
JS::ContextOptions contextOptions;
|
JS::ContextOptions contextOptions;
|
||||||
xpc::SetPrefableContextOptions(contextOptions);
|
xpc::SetPrefableContextOptions(contextOptions);
|
||||||
|
|
||||||
|
|
@ -264,18 +260,19 @@ void LoadGCZealOptions(const char* /* aPrefName */, void* /* aClosure */) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t gczeal = GetPref<int32_t>(PREF_JS_OPTIONS_PREFIX PREF_GCZEAL, -1);
|
int32_t mode = GetPref<int32_t>(
|
||||||
if (gczeal < 0) {
|
PREF_JS_OPTIONS_PREFIX PREF_GCZEAL_OPTIONS_PREFIX PREF_MODE, -1);
|
||||||
gczeal = 0;
|
if (mode < 0) {
|
||||||
|
mode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t frequency =
|
int32_t frequency = GetPref<int32_t>(
|
||||||
GetPref<int32_t>(PREF_JS_OPTIONS_PREFIX PREF_GCZEAL ".frequency", -1);
|
PREF_JS_OPTIONS_PREFIX PREF_GCZEAL_OPTIONS_PREFIX PREF_FREQUENCY, -1);
|
||||||
if (frequency < 0) {
|
if (frequency < 0) {
|
||||||
frequency = JS::BrowserDefaultGCZealFrequency;
|
frequency = JS::BrowserDefaultGCZealFrequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
RuntimeService::SetDefaultGCZeal(uint8_t(gczeal), uint32_t(frequency));
|
RuntimeService::SetDefaultGCZeal(uint8_t(mode), uint32_t(frequency));
|
||||||
|
|
||||||
if (rts) {
|
if (rts) {
|
||||||
rts->UpdateAllWorkerGCZeal();
|
rts->UpdateAllWorkerGCZeal();
|
||||||
|
|
@ -1406,7 +1403,8 @@ nsresult RuntimeService::Init() {
|
||||||
PREF_JS_OPTIONS_PREFIX PREF_MEM_OPTIONS_PREFIX)) ||
|
PREF_JS_OPTIONS_PREFIX PREF_MEM_OPTIONS_PREFIX)) ||
|
||||||
#ifdef JS_GC_ZEAL
|
#ifdef JS_GC_ZEAL
|
||||||
NS_FAILED(Preferences::RegisterCallback(
|
NS_FAILED(Preferences::RegisterCallback(
|
||||||
LoadGCZealOptions, PREF_JS_OPTIONS_PREFIX PREF_GCZEAL)) ||
|
LoadGCZealOptions,
|
||||||
|
PREF_JS_OPTIONS_PREFIX PREF_GCZEAL_OPTIONS_PREFIX)) ||
|
||||||
#endif
|
#endif
|
||||||
WORKER_PREF("intl.accept_languages", PrefLanguagesChanged) ||
|
WORKER_PREF("intl.accept_languages", PrefLanguagesChanged) ||
|
||||||
WORKER_PREF("general.appversion.override", AppVersionOverrideChanged) ||
|
WORKER_PREF("general.appversion.override", AppVersionOverrideChanged) ||
|
||||||
|
|
@ -1665,7 +1663,8 @@ void RuntimeService::Cleanup() {
|
||||||
WORKER_PREF("general.platform.override", PlatformOverrideChanged) ||
|
WORKER_PREF("general.platform.override", PlatformOverrideChanged) ||
|
||||||
#ifdef JS_GC_ZEAL
|
#ifdef JS_GC_ZEAL
|
||||||
NS_FAILED(Preferences::UnregisterCallback(
|
NS_FAILED(Preferences::UnregisterCallback(
|
||||||
LoadGCZealOptions, PREF_JS_OPTIONS_PREFIX PREF_GCZEAL)) ||
|
LoadGCZealOptions,
|
||||||
|
PREF_JS_OPTIONS_PREFIX PREF_GCZEAL_OPTIONS_PREFIX)) ||
|
||||||
#endif
|
#endif
|
||||||
NS_FAILED(Preferences::UnregisterPrefixCallback(
|
NS_FAILED(Preferences::UnregisterPrefixCallback(
|
||||||
LoadJSGCMemoryOptions,
|
LoadJSGCMemoryOptions,
|
||||||
|
|
|
||||||
|
|
@ -969,9 +969,10 @@ static void ReloadPrefsCallback(const char* pref, void* aXpccx) {
|
||||||
sStreamsEnabled = Preferences::GetBool(JS_OPTIONS_DOT_STR "streams");
|
sStreamsEnabled = Preferences::GetBool(JS_OPTIONS_DOT_STR "streams");
|
||||||
|
|
||||||
#ifdef JS_GC_ZEAL
|
#ifdef JS_GC_ZEAL
|
||||||
int32_t zeal = Preferences::GetInt(JS_OPTIONS_DOT_STR "gczeal", -1);
|
int32_t zeal = Preferences::GetInt(JS_OPTIONS_DOT_STR "mem.gc_zeal.mode", -1);
|
||||||
int32_t zeal_frequency = Preferences::GetInt(
|
int32_t zeal_frequency =
|
||||||
JS_OPTIONS_DOT_STR "gczeal.frequency", JS::BrowserDefaultGCZealFrequency);
|
Preferences::GetInt(JS_OPTIONS_DOT_STR "mem.gc_zeal.frequency",
|
||||||
|
JS::BrowserDefaultGCZealFrequency);
|
||||||
if (zeal >= 0) {
|
if (zeal >= 0) {
|
||||||
JS::SetGCZeal(cx, (uint8_t)zeal, zeal_frequency);
|
JS::SetGCZeal(cx, (uint8_t)zeal, zeal_frequency);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1020,6 +1020,11 @@ pref("javascript.options.mem.nursery_eager_collection_threshold_percent", 25);
|
||||||
// JSGC_NURSERY_EAGER_COLLECTION_TIMEOUT_MS
|
// JSGC_NURSERY_EAGER_COLLECTION_TIMEOUT_MS
|
||||||
pref("javascript.options.mem.nursery_eager_collection_timeout_ms", 5000);
|
pref("javascript.options.mem.nursery_eager_collection_timeout_ms", 5000);
|
||||||
|
|
||||||
|
#ifdef JS_GC_ZEAL
|
||||||
|
pref("javascript.options.mem.gc_zeal.mode", 0);
|
||||||
|
pref("javascript.options.mem.gc_zeal.frequency", 5000);
|
||||||
|
#endif
|
||||||
|
|
||||||
pref("javascript.options.shared_memory", true);
|
pref("javascript.options.shared_memory", true);
|
||||||
|
|
||||||
pref("javascript.options.throw_on_debuggee_would_run", false);
|
pref("javascript.options.throw_on_debuggee_would_run", false);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue