Bug 1549263 - Rename sliceTimeBudget() and related symbols to include units. r=pbone

Differential Revision: https://phabricator.services.mozilla.com/D35588

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Karan Sapolia 2019-06-28 12:56:08 +00:00
parent ab204e49ee
commit ed6ee44baf
11 changed files with 30 additions and 30 deletions

View File

@ -2417,9 +2417,9 @@ static void SetMemoryGCSliceTimePrefChangedCallback(const char* aPrefName,
// handle overflow and negative pref values
if (pref > 0 && pref < 100000) {
sActiveIntersliceGCBudget = pref;
SetGCParameter(JSGC_SLICE_TIME_BUDGET, pref);
SetGCParameter(JSGC_SLICE_TIME_BUDGET_MS, pref);
} else {
ResetGCParameter(JSGC_SLICE_TIME_BUDGET);
ResetGCParameter(JSGC_SLICE_TIME_BUDGET_MS);
}
}

View File

@ -504,7 +504,7 @@ void LoadJSGCMemoryOptions(const char* aPrefName, void* /* aClosure */) {
int32_t prefValue = GetWorkerPref(matchName, -1);
uint32_t value =
(prefValue <= 0 || prefValue >= 100000) ? 0 : uint32_t(prefValue);
UpdateOtherJSGCMemoryOption(rts, JSGC_SLICE_TIME_BUDGET, value);
UpdateOtherJSGCMemoryOption(rts, JSGC_SLICE_TIME_BUDGET_MS, value);
continue;
}

View File

@ -125,9 +125,9 @@ typedef enum JSGCParamKey {
* Max milliseconds to spend in an incremental GC slice.
*
* Pref: javascript.options.mem.gc_incremental_slice_ms
* Default: DefaultTimeBudget.
* Default: DefaultTimeBudgetMS.
*/
JSGC_SLICE_TIME_BUDGET = 9,
JSGC_SLICE_TIME_BUDGET_MS = 9,
/**
* Maximum size the GC mark stack can grow to.

View File

@ -503,7 +503,7 @@ static bool MinorGC(JSContext* cx, unsigned argc, Value* vp) {
_("mode", JSGC_MODE, true) \
_("unusedChunks", JSGC_UNUSED_CHUNKS, false) \
_("totalChunks", JSGC_TOTAL_CHUNKS, false) \
_("sliceTimeBudget", JSGC_SLICE_TIME_BUDGET, true) \
_("sliceTimeBudgetMS", JSGC_SLICE_TIME_BUDGET_MS, true) \
_("markStackLimit", JSGC_MARK_STACK_LIMIT, true) \
_("highFrequencyTimeLimit", JSGC_HIGH_FREQUENCY_TIME_LIMIT, true) \
_("highFrequencyLowLimit", JSGC_HIGH_FREQUENCY_LOW_LIMIT, true) \

View File

@ -343,8 +343,8 @@ static const uint32_t MinEmptyChunkCount = 1;
/* JSGC_MAX_EMPTY_CHUNK_COUNT */
static const uint32_t MaxEmptyChunkCount = 30;
/* JSGC_SLICE_TIME_BUDGET */
static const int64_t DefaultTimeBudget = SliceBudget::UnlimitedTimeBudget;
/* JSGC_SLICE_TIME_BUDGET_MS */
static const int64_t DefaultTimeBudgetMS = SliceBudget::UnlimitedTimeBudget;
/* JSGC_MODE */
static const JSGCMode Mode = JSGC_MODE_ZONE_INCREMENTAL;
@ -1024,7 +1024,7 @@ GCRuntime::GCRuntime(JSRuntime* rt)
#ifdef JS_GC_ZEAL
markingValidator(nullptr),
#endif
defaultTimeBudget_(TuningDefaults::DefaultTimeBudget),
defaultTimeBudgetMS_(TuningDefaults::DefaultTimeBudgetMS),
incrementalAllowed(true),
compactingEnabled(TuningDefaults::CompactingEnabled),
rootsRemoved(false),
@ -1437,8 +1437,8 @@ bool GCRuntime::setParameter(JSGCParamKey key, uint32_t value,
case JSGC_MAX_MALLOC_BYTES:
setMaxMallocBytes(value, lock);
break;
case JSGC_SLICE_TIME_BUDGET:
defaultTimeBudget_ = value ? value : SliceBudget::UnlimitedTimeBudget;
case JSGC_SLICE_TIME_BUDGET_MS:
defaultTimeBudgetMS_ = value ? value : SliceBudget::UnlimitedTimeBudget;
break;
case JSGC_MARK_STACK_LIMIT:
if (value == 0) {
@ -1705,8 +1705,8 @@ void GCRuntime::resetParameter(JSGCParamKey key, AutoLockGC& lock) {
case JSGC_MAX_MALLOC_BYTES:
setMaxMallocBytes(TuningDefaults::MaxMallocBytes, lock);
break;
case JSGC_SLICE_TIME_BUDGET:
defaultTimeBudget_ = TuningDefaults::DefaultTimeBudget;
case JSGC_SLICE_TIME_BUDGET_MS:
defaultTimeBudgetMS_ = TuningDefaults::DefaultTimeBudgetMS;
break;
case JSGC_MARK_STACK_LIMIT:
setMarkStackLimit(MarkStack::DefaultCapacity, lock);
@ -1827,13 +1827,13 @@ uint32_t GCRuntime::getParameter(JSGCParamKey key, const AutoLockGC& lock) {
case JSGC_TOTAL_CHUNKS:
return uint32_t(fullChunks(lock).count() + availableChunks(lock).count() +
emptyChunks(lock).count());
case JSGC_SLICE_TIME_BUDGET:
if (defaultTimeBudget_.ref() == SliceBudget::UnlimitedTimeBudget) {
case JSGC_SLICE_TIME_BUDGET_MS:
if (defaultTimeBudgetMS_.ref() == SliceBudget::UnlimitedTimeBudget) {
return 0;
} else {
MOZ_RELEASE_ASSERT(defaultTimeBudget_ >= 0);
MOZ_RELEASE_ASSERT(defaultTimeBudget_ <= UINT32_MAX);
return uint32_t(defaultTimeBudget_);
MOZ_RELEASE_ASSERT(defaultTimeBudgetMS_ >= 0);
MOZ_RELEASE_ASSERT(defaultTimeBudgetMS_ <= UINT32_MAX);
return uint32_t(defaultTimeBudgetMS_);
}
case JSGC_MARK_STACK_LIMIT:
return marker.maxCapacity();
@ -7932,12 +7932,12 @@ js::AutoEnqueuePendingParseTasksAfterGC::
SliceBudget GCRuntime::defaultBudget(JS::GCReason reason, int64_t millis) {
if (millis == 0) {
if (reason == JS::GCReason::ALLOC_TRIGGER) {
millis = defaultSliceBudget();
millis = defaultSliceBudgetMS();
} else if (schedulingState.inHighFrequencyGCMode() &&
tunables.isDynamicMarkSliceEnabled()) {
millis = defaultSliceBudget() * IGC_MARK_SLICE_MULTIPLIER;
millis = defaultSliceBudgetMS() * IGC_MARK_SLICE_MULTIPLIER;
} else {
millis = defaultSliceBudget();
millis = defaultSliceBudgetMS();
}
}

View File

@ -430,7 +430,7 @@ class GCRuntime {
uint64_t majorGCCount() const { return majorGCNumber; }
void incMajorGcNumber() { ++majorGCNumber; }
int64_t defaultSliceBudget() const { return defaultTimeBudget_; }
int64_t defaultSliceBudgetMS() const { return defaultTimeBudgetMS_; }
bool isIncrementalGc() const { return isIncremental; }
bool isFullGc() const { return isFull; }
@ -934,10 +934,10 @@ class GCRuntime {
/*
* Default budget for incremental GC slice. See js/SliceBudget.h.
*
* JSGC_SLICE_TIME_BUDGET
* JSGC_SLICE_TIME_BUDGET_MS
* pref: javascript.options.mem.gc_incremental_slice_ms,
*/
MainThreadData<int64_t> defaultTimeBudget_;
MainThreadData<int64_t> defaultTimeBudgetMS_;
/*
* We disable incremental GC if we encounter a Class with a trace hook

View File

@ -1,2 +1,2 @@
// |jit-test| error: Error
gcparam("sliceTimeBudget", -1);
gcparam("sliceTimeBudgetMS", -1);

View File

@ -37,7 +37,7 @@ testGetParam("totalChunks");
testChangeParam("maxBytes");
testChangeParam("maxMallocBytes");
testChangeParam("mode");
testChangeParam("sliceTimeBudget");
testChangeParam("sliceTimeBudgetMS");
testChangeParam("markStackLimit");
testChangeParam("highFrequencyTimeLimit");
testChangeParam("highFrequencyLowLimit");

View File

@ -1293,7 +1293,7 @@ JS_PUBLIC_API void JS_SetGCParametersBasedOnAvailableMemory(JSContext* cx,
static const JSGCConfig minimal[] = {
{JSGC_MAX_MALLOC_BYTES, 6 * 1024 * 1024},
{JSGC_SLICE_TIME_BUDGET, 30},
{JSGC_SLICE_TIME_BUDGET_MS, 30},
{JSGC_HIGH_FREQUENCY_TIME_LIMIT, 1500},
{JSGC_HIGH_FREQUENCY_HIGH_LIMIT, 40},
{JSGC_HIGH_FREQUENCY_LOW_LIMIT, 0},
@ -1308,7 +1308,7 @@ JS_PUBLIC_API void JS_SetGCParametersBasedOnAvailableMemory(JSContext* cx,
static const JSGCConfig nominal[] = {
{JSGC_MAX_MALLOC_BYTES, 6 * 1024 * 1024},
{JSGC_SLICE_TIME_BUDGET, 30},
{JSGC_SLICE_TIME_BUDGET_MS, 30},
{JSGC_HIGH_FREQUENCY_TIME_LIMIT, 1000},
{JSGC_HIGH_FREQUENCY_HIGH_LIMIT, 500},
{JSGC_HIGH_FREQUENCY_LOW_LIMIT, 100},

View File

@ -11354,7 +11354,7 @@ int main(int argc, char** argv, char** envp) {
if (!op.getBoolOption("no-incremental-gc")) {
JS_SetGCParameter(cx, JSGC_DYNAMIC_HEAP_GROWTH, 1);
JS_SetGCParameter(cx, JSGC_DYNAMIC_MARK_SLICE, 1);
JS_SetGCParameter(cx, JSGC_SLICE_TIME_BUDGET, 10);
JS_SetGCParameter(cx, JSGC_SLICE_TIME_BUDGET_MS, 10);
}
#endif

View File

@ -1339,7 +1339,7 @@ pref("javascript.options.mem.nursery.max_kb", 16384);
pref("javascript.options.mem.gc_per_zone", true);
pref("javascript.options.mem.gc_incremental", true);
// JSGC_SLICE_TIME_BUDGET
// JSGC_SLICE_TIME_BUDGET_MS
// Override the shell's default of unlimited slice time.
pref("javascript.options.mem.gc_incremental_slice_ms", 5);