mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 06:09:19 +00:00
Backed out changeset e38543d56e9b (bug 1899872) for causing build bustages CLOSED TREE
This commit is contained in:
parent
2bf18ccc89
commit
ba4157f317
@ -468,7 +468,7 @@ bool CCGCScheduler::GCRunnerFiredDoGC(TimeStamp aDeadline,
|
||||
|
||||
MOZ_ASSERT(mActiveIntersliceGCBudget);
|
||||
TimeStamp startTimeStamp = TimeStamp::Now();
|
||||
JS::SliceBudget budget = ComputeInterSliceGCBudget(aDeadline, startTimeStamp);
|
||||
js::SliceBudget budget = ComputeInterSliceGCBudget(aDeadline, startTimeStamp);
|
||||
nsJSContext::RunIncrementalGCSlice(aStep.mReason, is_shrinking, budget);
|
||||
|
||||
// If the GC doesn't have any more work to do on the foreground thread (and
|
||||
@ -778,7 +778,7 @@ void CCGCScheduler::KillAllTimersAndRunners() {
|
||||
KillGCRunner();
|
||||
}
|
||||
|
||||
JS::SliceBudget CCGCScheduler::ComputeCCSliceBudget(
|
||||
js::SliceBudget CCGCScheduler::ComputeCCSliceBudget(
|
||||
TimeStamp aDeadline, TimeStamp aCCBeginTime, TimeStamp aPrevSliceEndTime,
|
||||
TimeStamp aNow, bool* aPreferShorterSlices) const {
|
||||
*aPreferShorterSlices =
|
||||
@ -789,14 +789,14 @@ JS::SliceBudget CCGCScheduler::ComputeCCSliceBudget(
|
||||
|
||||
if (aPrevSliceEndTime.IsNull()) {
|
||||
// The first slice gets the standard slice time.
|
||||
return JS::SliceBudget(JS::TimeBudget(baseBudget));
|
||||
return js::SliceBudget(js::TimeBudget(baseBudget));
|
||||
}
|
||||
|
||||
// Only run a limited slice if we're within the max running time.
|
||||
MOZ_ASSERT(aNow >= aCCBeginTime);
|
||||
TimeDuration runningTime = aNow - aCCBeginTime;
|
||||
if (runningTime >= kMaxICCDuration) {
|
||||
return JS::SliceBudget::unlimited();
|
||||
return js::SliceBudget::unlimited();
|
||||
}
|
||||
|
||||
const TimeDuration maxSlice =
|
||||
@ -818,7 +818,7 @@ JS::SliceBudget CCGCScheduler::ComputeCCSliceBudget(
|
||||
// Note: We may have already overshot the deadline, in which case
|
||||
// baseBudget will be negative and we will end up returning
|
||||
// laterSliceBudget.
|
||||
return JS::SliceBudget(JS::TimeBudget(
|
||||
return js::SliceBudget(js::TimeBudget(
|
||||
std::max({delaySliceBudget, laterSliceBudget, baseBudget})));
|
||||
}
|
||||
|
||||
@ -828,7 +828,7 @@ JS::SliceBudget CCGCScheduler::ComputeCCSliceBudget(
|
||||
// Inputs are an idle deadline (or null if this is not running in idle time),
|
||||
// and a timestamp (probably null) when the CC started being locked out while
|
||||
// waiting for the ongoing GC to finish.
|
||||
JS::SliceBudget CCGCScheduler::ComputeInterSliceGCBudget(TimeStamp aDeadline,
|
||||
js::SliceBudget CCGCScheduler::ComputeInterSliceGCBudget(TimeStamp aDeadline,
|
||||
TimeStamp aNow) {
|
||||
TimeDuration budget =
|
||||
aDeadline.IsNull() ? mActiveIntersliceGCBudget : aDeadline - aNow;
|
||||
@ -1110,7 +1110,7 @@ GCRunnerStep CCGCScheduler::GetNextGCRunnerAction(TimeStamp aDeadline) const {
|
||||
return {GCRunnerAction::None, JS::GCReason::NO_REASON};
|
||||
}
|
||||
|
||||
JS::SliceBudget CCGCScheduler::ComputeForgetSkippableBudget(
|
||||
js::SliceBudget CCGCScheduler::ComputeForgetSkippableBudget(
|
||||
TimeStamp aStartTimeStamp, TimeStamp aDeadline) {
|
||||
if (mForgetSkippableFrequencyStartTime.IsNull()) {
|
||||
mForgetSkippableFrequencyStartTime = aStartTimeStamp;
|
||||
@ -1137,7 +1137,7 @@ JS::SliceBudget CCGCScheduler::ComputeForgetSkippableBudget(
|
||||
|
||||
TimeDuration budgetTime =
|
||||
aDeadline ? (aDeadline - aStartTimeStamp) : kForgetSkippableSliceDuration;
|
||||
return JS::SliceBudget(budgetTime);
|
||||
return js::SliceBudget(budgetTime);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -178,11 +178,11 @@ class CCGCScheduler {
|
||||
enum IsIdle { eNotIdle = false, eIdle = true };
|
||||
enum IsExtended { eNormalBudget = false, eExtendedBudget = true };
|
||||
enum IsInterruptible { eNonInterruptible = false, eInterruptible = true };
|
||||
JS::SliceBudget CreateGCSliceBudget(mozilla::TimeDuration aDuration,
|
||||
js::SliceBudget CreateGCSliceBudget(mozilla::TimeDuration aDuration,
|
||||
IsIdle aIsIdle, IsExtended aIsExtended,
|
||||
IsInterruptible aIsInterruptible) {
|
||||
mInterruptRequested = false;
|
||||
auto budget = JS::SliceBudget(aDuration, aIsInterruptible == eInterruptible
|
||||
auto budget = js::SliceBudget(aDuration, aIsInterruptible == eInterruptible
|
||||
? &mInterruptRequested
|
||||
: nullptr);
|
||||
budget.idle = aIsIdle == eIdle;
|
||||
@ -352,13 +352,13 @@ class CCGCScheduler {
|
||||
// Return a budget along with a boolean saying whether to prefer to run short
|
||||
// slices and stop rather than continuing to the next phase of cycle
|
||||
// collection.
|
||||
JS::SliceBudget ComputeCCSliceBudget(TimeStamp aDeadline,
|
||||
js::SliceBudget ComputeCCSliceBudget(TimeStamp aDeadline,
|
||||
TimeStamp aCCBeginTime,
|
||||
TimeStamp aPrevSliceEndTime,
|
||||
TimeStamp aNow,
|
||||
bool* aPreferShorterSlices) const;
|
||||
|
||||
JS::SliceBudget ComputeInterSliceGCBudget(TimeStamp aDeadline,
|
||||
js::SliceBudget ComputeInterSliceGCBudget(TimeStamp aDeadline,
|
||||
TimeStamp aNow);
|
||||
|
||||
bool ShouldForgetSkippable(uint32_t aSuspectedCCObjects) const {
|
||||
@ -459,7 +459,7 @@ class CCGCScheduler {
|
||||
|
||||
// aStartTimeStamp : when the ForgetSkippable timer fired. This may be some
|
||||
// time ago, if an incremental GC needed to be finished.
|
||||
JS::SliceBudget ComputeForgetSkippableBudget(TimeStamp aStartTimeStamp,
|
||||
js::SliceBudget ComputeForgetSkippableBudget(TimeStamp aStartTimeStamp,
|
||||
TimeStamp aDeadline);
|
||||
|
||||
private:
|
||||
@ -482,7 +482,7 @@ class CCGCScheduler {
|
||||
|
||||
// Set when the IdleTaskRunner requests the current task be interrupted.
|
||||
// Cleared when the GC slice budget has detected the interrupt request.
|
||||
JS::SliceBudget::InterruptRequestFlag mInterruptRequested;
|
||||
js::SliceBudget::InterruptRequestFlag mInterruptRequested;
|
||||
|
||||
// When a shrinking GC has been requested but we back-out, if this is true
|
||||
// we run a non-shrinking GC.
|
||||
|
@ -1039,7 +1039,7 @@ void nsJSContext::SetLowMemoryState(bool aState) {
|
||||
|
||||
static void GarbageCollectImpl(JS::GCReason aReason,
|
||||
nsJSContext::IsShrinking aShrinking,
|
||||
const JS::SliceBudget& aBudget) {
|
||||
const js::SliceBudget& aBudget) {
|
||||
AUTO_PROFILER_LABEL_DYNAMIC_CSTR_NONSENSITIVE(
|
||||
"nsJSContext::GarbageCollectNow", GCCC, JS::ExplainGCReason(aReason));
|
||||
|
||||
@ -1085,13 +1085,13 @@ static void GarbageCollectImpl(JS::GCReason aReason,
|
||||
// static
|
||||
void nsJSContext::GarbageCollectNow(JS::GCReason aReason,
|
||||
IsShrinking aShrinking) {
|
||||
GarbageCollectImpl(aReason, aShrinking, JS::SliceBudget::unlimited());
|
||||
GarbageCollectImpl(aReason, aShrinking, js::SliceBudget::unlimited());
|
||||
}
|
||||
|
||||
// static
|
||||
void nsJSContext::RunIncrementalGCSlice(JS::GCReason aReason,
|
||||
IsShrinking aShrinking,
|
||||
JS::SliceBudget& aBudget) {
|
||||
js::SliceBudget& aBudget) {
|
||||
AUTO_PROFILER_LABEL_RELEVANT_FOR_JS("Incremental GC", GCCC);
|
||||
GarbageCollectImpl(aReason, aShrinking, aBudget);
|
||||
}
|
||||
@ -1141,7 +1141,7 @@ static void FireForgetSkippable(bool aRemoveChildless, TimeStamp aDeadline) {
|
||||
FinishAnyIncrementalGC();
|
||||
|
||||
uint32_t suspectedBefore = nsCycleCollector_suspectedCount();
|
||||
JS::SliceBudget budget =
|
||||
js::SliceBudget budget =
|
||||
sScheduler->ComputeForgetSkippableBudget(startTimeStamp, aDeadline);
|
||||
bool earlyForgetSkippable = sScheduler->IsEarlyForgetSkippable();
|
||||
nsCycleCollector_forgetSkippable(budget, aRemoveChildless,
|
||||
@ -1470,12 +1470,12 @@ void nsJSContext::RunCycleCollectorSlice(CCReason aReason,
|
||||
// Decide how long we want to budget for this slice.
|
||||
if (sIncrementalCC) {
|
||||
bool preferShorterSlices;
|
||||
JS::SliceBudget budget = sScheduler->ComputeCCSliceBudget(
|
||||
js::SliceBudget budget = sScheduler->ComputeCCSliceBudget(
|
||||
aDeadline, sCCStats.mBeginTime, sCCStats.mEndSliceTime,
|
||||
TimeStamp::Now(), &preferShorterSlices);
|
||||
nsCycleCollector_collectSlice(budget, aReason, preferShorterSlices);
|
||||
} else {
|
||||
JS::SliceBudget budget = JS::SliceBudget::unlimited();
|
||||
js::SliceBudget budget = js::SliceBudget::unlimited();
|
||||
nsCycleCollector_collectSlice(budget, aReason, false);
|
||||
}
|
||||
|
||||
@ -1492,7 +1492,7 @@ void nsJSContext::RunCycleCollectorWorkSlice(int64_t aWorkBudget) {
|
||||
|
||||
PrepareForCycleCollectionSlice(CCReason::API, TimeStamp());
|
||||
|
||||
JS::SliceBudget budget = JS::SliceBudget(JS::WorkBudget(aWorkBudget));
|
||||
js::SliceBudget budget = js::SliceBudget(js::WorkBudget(aWorkBudget));
|
||||
nsCycleCollector_collectSlice(budget, CCReason::API);
|
||||
|
||||
sCCStats.AfterCycleCollectionSlice();
|
||||
@ -2067,7 +2067,7 @@ static bool ConsumeStream(JSContext* aCx, JS::Handle<JSObject*> aObj,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
static JS::SliceBudget CreateGCSliceBudget(JS::GCReason aReason,
|
||||
static js::SliceBudget CreateGCSliceBudget(JS::GCReason aReason,
|
||||
int64_t aMillis) {
|
||||
return sScheduler->CreateGCSliceBudget(
|
||||
mozilla::TimeDuration::FromMilliseconds(aMillis), CCGCScheduler::eNotIdle,
|
||||
|
@ -67,7 +67,7 @@ class nsJSContext : public nsIScriptContext {
|
||||
|
||||
static void RunIncrementalGCSlice(JS::GCReason aReason,
|
||||
IsShrinking aShrinking,
|
||||
JS::SliceBudget& aBudget);
|
||||
js::SliceBudget& aBudget);
|
||||
|
||||
static void CycleCollectNow(mozilla::CCReason aReason,
|
||||
nsICycleCollectorListener* aListener = nullptr);
|
||||
|
@ -58,7 +58,7 @@ void TestGC::Run(int aNumSlices) {
|
||||
for (int slice = 0; slice < aNumSlices; slice++) {
|
||||
EXPECT_TRUE(mScheduler.InIncrementalGC());
|
||||
TimeStamp idleDeadline = Now() + kTenthSecond;
|
||||
JS::SliceBudget budget =
|
||||
js::SliceBudget budget =
|
||||
mScheduler.ComputeInterSliceGCBudget(idleDeadline, Now());
|
||||
TimeDuration budgetDuration =
|
||||
TimeDuration::FromMilliseconds(budget.timeBudget());
|
||||
@ -154,7 +154,7 @@ void TestCC::TimerFires(int aNumSlices) {
|
||||
void TestCC::ForgetSkippable() {
|
||||
uint32_t suspectedBefore = sSuspected;
|
||||
// ...ForgetSkippable would happen here...
|
||||
JS::SliceBudget budget =
|
||||
js::SliceBudget budget =
|
||||
mScheduler.ComputeForgetSkippableBudget(Now(), Now() + kTenthSecond);
|
||||
EXPECT_NEAR(budget.timeBudget(), kTenthSecond.ToMilliseconds(), 1);
|
||||
AdvanceTime(kTenthSecond);
|
||||
@ -213,7 +213,7 @@ void TestIdleCC::RunSlice(TimeStamp aCCStartTime, TimeStamp aPrevSliceEnd,
|
||||
|
||||
EXPECT_FALSE(mScheduler.InIncrementalGC());
|
||||
bool preferShorter;
|
||||
JS::SliceBudget budget = mScheduler.ComputeCCSliceBudget(
|
||||
js::SliceBudget budget = mScheduler.ComputeCCSliceBudget(
|
||||
idleDeadline, aCCStartTime, aPrevSliceEnd, Now(), &preferShorter);
|
||||
// The scheduler will set the budget to our deadline (0.1sec in the future).
|
||||
EXPECT_NEAR(budget.timeBudget(), kTenthSecond.ToMilliseconds(), 1);
|
||||
@ -252,7 +252,7 @@ void TestNonIdleCC::RunSlice(TimeStamp aCCStartTime, TimeStamp aPrevSliceEnd,
|
||||
EXPECT_FALSE(mScheduler.InIncrementalGC());
|
||||
|
||||
bool preferShorter;
|
||||
JS::SliceBudget budget = mScheduler.ComputeCCSliceBudget(
|
||||
js::SliceBudget budget = mScheduler.ComputeCCSliceBudget(
|
||||
nullDeadline, aCCStartTime, aPrevSliceEnd, Now(), &preferShorter);
|
||||
if (aSliceNum == 0) {
|
||||
// First slice of the CC, so always use the baseBudget which is
|
||||
|
@ -28,6 +28,7 @@ namespace js {
|
||||
namespace gc {
|
||||
class GCRuntime;
|
||||
} // namespace gc
|
||||
class JS_PUBLIC_API SliceBudget;
|
||||
namespace gcstats {
|
||||
struct Statistics;
|
||||
} // namespace gcstats
|
||||
@ -35,8 +36,6 @@ struct Statistics;
|
||||
|
||||
namespace JS {
|
||||
|
||||
class JS_PUBLIC_API SliceBudget;
|
||||
|
||||
// Options used when starting a GC.
|
||||
enum class GCOptions : uint32_t {
|
||||
// Normal GC invocation.
|
||||
@ -506,7 +505,7 @@ typedef void (*JSTraceDataOp)(JSTracer* trc, void* data);
|
||||
* While tracing this should check the budget and return false if it has been
|
||||
* exceeded. When passed an unlimited budget it should always return true.
|
||||
*/
|
||||
typedef bool (*JSGrayRootsTracer)(JSTracer* trc, JS::SliceBudget& budget,
|
||||
typedef bool (*JSGrayRootsTracer)(JSTracer* trc, js::SliceBudget& budget,
|
||||
void* data);
|
||||
|
||||
typedef enum JSGCStatus { JSGC_BEGIN, JSGC_END } JSGCStatus;
|
||||
@ -779,7 +778,7 @@ extern JS_PUBLIC_API void NonIncrementalGC(JSContext* cx, JS::GCOptions options,
|
||||
extern JS_PUBLIC_API void StartIncrementalGC(JSContext* cx,
|
||||
JS::GCOptions options,
|
||||
GCReason reason,
|
||||
const JS::SliceBudget& budget);
|
||||
const js::SliceBudget& budget);
|
||||
|
||||
/**
|
||||
* Perform a slice of an ongoing incremental collection. When this function
|
||||
@ -790,7 +789,7 @@ extern JS_PUBLIC_API void StartIncrementalGC(JSContext* cx,
|
||||
* shorter than the requested interval.
|
||||
*/
|
||||
extern JS_PUBLIC_API void IncrementalGCSlice(JSContext* cx, GCReason reason,
|
||||
const JS::SliceBudget& budget);
|
||||
const js::SliceBudget& budget);
|
||||
|
||||
/**
|
||||
* Return whether an incremental GC has work to do on the foreground thread and
|
||||
@ -958,7 +957,7 @@ typedef void (*DoCycleCollectionCallback)(JSContext* cx);
|
||||
extern JS_PUBLIC_API DoCycleCollectionCallback
|
||||
SetDoCycleCollectionCallback(JSContext* cx, DoCycleCollectionCallback callback);
|
||||
|
||||
using CreateSliceBudgetCallback = JS::SliceBudget (*)(JS::GCReason reason,
|
||||
using CreateSliceBudgetCallback = js::SliceBudget (*)(JS::GCReason reason,
|
||||
int64_t millis);
|
||||
|
||||
/**
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "jstypes.h"
|
||||
|
||||
namespace JS {
|
||||
namespace js {
|
||||
|
||||
struct JS_PUBLIC_API TimeBudget {
|
||||
const mozilla::TimeDuration budget;
|
||||
@ -140,6 +140,6 @@ class JS_PUBLIC_API SliceBudget {
|
||||
int describe(char* buffer, size_t maxlen) const;
|
||||
};
|
||||
|
||||
} // namespace JS
|
||||
} // namespace js
|
||||
|
||||
#endif /* js_SliceBudget_h */
|
||||
|
@ -161,10 +161,8 @@ using mozilla::Span;
|
||||
|
||||
using JS::AutoStableStringChars;
|
||||
using JS::CompileOptions;
|
||||
using JS::SliceBudget;
|
||||
using JS::SourceOwnership;
|
||||
using JS::SourceText;
|
||||
using JS::WorkBudget;
|
||||
|
||||
// If fuzzingSafe is set, remove functionality that could cause problems with
|
||||
// fuzzers. Set this via the environment variable MOZ_FUZZING_SAFE.
|
||||
|
@ -18,13 +18,10 @@
|
||||
#include "js/TypeDecls.h"
|
||||
#include "threading/ProtectedData.h"
|
||||
|
||||
namespace JS {
|
||||
class SliceBudget;
|
||||
}
|
||||
|
||||
namespace js {
|
||||
|
||||
class Nursery;
|
||||
class SliceBudget;
|
||||
|
||||
namespace gcstats {
|
||||
struct Statistics;
|
||||
@ -137,7 +134,7 @@ class ArenaList {
|
||||
Arena* removeRemainingArenas(Arena** arenap);
|
||||
Arena** pickArenasToRelocate(size_t& arenaTotalOut, size_t& relocTotalOut);
|
||||
Arena* relocateArenas(Arena* toRelocate, Arena* relocated,
|
||||
JS::SliceBudget& sliceBudget,
|
||||
js::SliceBudget& sliceBudget,
|
||||
gcstats::Statistics& stats);
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -345,7 +342,7 @@ class ArenaLists {
|
||||
void checkEmptyArenaList(AllocKind kind);
|
||||
|
||||
bool relocateArenas(Arena*& relocatedListOut, JS::GCReason reason,
|
||||
JS::SliceBudget& sliceBudget, gcstats::Statistics& stats);
|
||||
js::SliceBudget& sliceBudget, gcstats::Statistics& stats);
|
||||
|
||||
void queueForegroundObjectsForSweep(JS::GCContext* gcx);
|
||||
void queueForegroundThingsForSweep();
|
||||
|
@ -36,8 +36,6 @@ using namespace js::gc;
|
||||
|
||||
using mozilla::Maybe;
|
||||
|
||||
using JS::SliceBudget;
|
||||
|
||||
bool GCRuntime::canRelocateZone(Zone* zone) const {
|
||||
return !zone->isAtomsZone();
|
||||
}
|
||||
|
@ -260,9 +260,6 @@ using mozilla::TimeDuration;
|
||||
using mozilla::TimeStamp;
|
||||
|
||||
using JS::AutoGCRooter;
|
||||
using JS::SliceBudget;
|
||||
using JS::TimeBudget;
|
||||
using JS::WorkBudget;
|
||||
|
||||
const AllocKind gc::slotsToThingKind[] = {
|
||||
// clang-format off
|
||||
@ -4674,7 +4671,7 @@ void GCRuntime::gc(JS::GCOptions options, JS::GCReason reason) {
|
||||
}
|
||||
|
||||
void GCRuntime::startGC(JS::GCOptions options, JS::GCReason reason,
|
||||
const SliceBudget& budget) {
|
||||
const js::SliceBudget& budget) {
|
||||
MOZ_ASSERT(!isIncrementalGCInProgress());
|
||||
setGCOptions(options);
|
||||
|
||||
@ -4691,7 +4688,7 @@ void GCRuntime::setGCOptions(JS::GCOptions options) {
|
||||
maybeGcOptions = Some(options);
|
||||
}
|
||||
|
||||
void GCRuntime::gcSlice(JS::GCReason reason, const SliceBudget& budget) {
|
||||
void GCRuntime::gcSlice(JS::GCReason reason, const js::SliceBudget& budget) {
|
||||
MOZ_ASSERT(isIncrementalGCInProgress());
|
||||
collect(false, budget, reason);
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ JS_PUBLIC_API void JS::NonIncrementalGC(JSContext* cx, JS::GCOptions options,
|
||||
|
||||
JS_PUBLIC_API void JS::StartIncrementalGC(JSContext* cx, JS::GCOptions options,
|
||||
GCReason reason,
|
||||
const JS::SliceBudget& budget) {
|
||||
const js::SliceBudget& budget) {
|
||||
AssertHeapIsIdle();
|
||||
CHECK_THREAD(cx);
|
||||
CheckGCOptions(options);
|
||||
@ -311,7 +311,7 @@ JS_PUBLIC_API void JS::StartIncrementalGC(JSContext* cx, JS::GCOptions options,
|
||||
}
|
||||
|
||||
JS_PUBLIC_API void JS::IncrementalGCSlice(JSContext* cx, GCReason reason,
|
||||
const JS::SliceBudget& budget) {
|
||||
const js::SliceBudget& budget) {
|
||||
AssertHeapIsIdle();
|
||||
CHECK_THREAD(cx);
|
||||
|
||||
|
@ -18,13 +18,10 @@
|
||||
|
||||
class JSRope;
|
||||
|
||||
namespace JS {
|
||||
class SliceBudget;
|
||||
}
|
||||
|
||||
namespace js {
|
||||
|
||||
class GCMarker;
|
||||
class SliceBudget;
|
||||
class WeakMapBase;
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -374,7 +371,7 @@ class GCMarker {
|
||||
void reset();
|
||||
|
||||
[[nodiscard]] bool markUntilBudgetExhausted(
|
||||
JS::SliceBudget& budget,
|
||||
SliceBudget& budget,
|
||||
gc::ShouldReportMarkTime reportTime = gc::ReportMarkTime);
|
||||
|
||||
void setRootMarkingMode(bool newState);
|
||||
@ -400,10 +397,10 @@ class GCMarker {
|
||||
bool markOneObjectForTest(JSObject* obj);
|
||||
#endif
|
||||
|
||||
bool markCurrentColorInParallel(JS::SliceBudget& budget);
|
||||
bool markCurrentColorInParallel(SliceBudget& budget);
|
||||
|
||||
template <uint32_t markingOptions, gc::MarkColor>
|
||||
bool markOneColor(JS::SliceBudget& budget);
|
||||
bool markOneColor(SliceBudget& budget);
|
||||
|
||||
static void moveWork(GCMarker* dst, GCMarker* src);
|
||||
|
||||
@ -452,7 +449,7 @@ class GCMarker {
|
||||
friend class gc::AutoUpdateMarkStackRanges;
|
||||
|
||||
template <uint32_t markingOptions>
|
||||
bool processMarkStackTop(JS::SliceBudget& budget);
|
||||
bool processMarkStackTop(SliceBudget& budget);
|
||||
friend class gc::GCRuntime;
|
||||
|
||||
// Helper methods that coerce their second argument to the base pointer
|
||||
@ -537,7 +534,7 @@ class GCMarker {
|
||||
#endif
|
||||
|
||||
template <uint32_t markingOptions>
|
||||
bool doMarking(JS::SliceBudget& budget, gc::ShouldReportMarkTime reportTime);
|
||||
bool doMarking(SliceBudget& budget, gc::ShouldReportMarkTime reportTime);
|
||||
|
||||
void delayMarkingChildrenOnOOM(gc::Cell* cell);
|
||||
|
||||
|
@ -63,7 +63,7 @@ struct SweepAction {
|
||||
struct Args {
|
||||
GCRuntime* gc;
|
||||
JS::GCContext* gcx;
|
||||
JS::SliceBudget& budget;
|
||||
SliceBudget& budget;
|
||||
};
|
||||
|
||||
virtual ~SweepAction() = default;
|
||||
@ -139,11 +139,11 @@ class ChunkPool {
|
||||
class BackgroundMarkTask : public GCParallelTask {
|
||||
public:
|
||||
explicit BackgroundMarkTask(GCRuntime* gc);
|
||||
void setBudget(const JS::SliceBudget& budget) { this->budget = budget; }
|
||||
void setBudget(const SliceBudget& budget) { this->budget = budget; }
|
||||
void run(AutoLockHelperThreadState& lock) override;
|
||||
|
||||
private:
|
||||
JS::SliceBudget budget;
|
||||
SliceBudget budget;
|
||||
};
|
||||
|
||||
class BackgroundUnmarkTask : public GCParallelTask {
|
||||
@ -335,12 +335,12 @@ class GCRuntime {
|
||||
|
||||
void gc(JS::GCOptions options, JS::GCReason reason);
|
||||
void startGC(JS::GCOptions options, JS::GCReason reason,
|
||||
const JS::SliceBudget& budget);
|
||||
void gcSlice(JS::GCReason reason, const JS::SliceBudget& budget);
|
||||
const SliceBudget& budget);
|
||||
void gcSlice(JS::GCReason reason, const SliceBudget& budget);
|
||||
void finishGC(JS::GCReason reason);
|
||||
void abortGC();
|
||||
void startDebugGC(JS::GCOptions options, const JS::SliceBudget& budget);
|
||||
void debugGCSlice(const JS::SliceBudget& budget);
|
||||
void startDebugGC(JS::GCOptions options, const SliceBudget& budget);
|
||||
void debugGCSlice(const SliceBudget& budget);
|
||||
|
||||
void runDebugGC();
|
||||
void notifyRootsRemoved();
|
||||
@ -711,13 +711,13 @@ class GCRuntime {
|
||||
void startBackgroundAllocTaskIfIdle();
|
||||
|
||||
void requestMajorGC(JS::GCReason reason);
|
||||
JS::SliceBudget defaultBudget(JS::GCReason reason, int64_t millis);
|
||||
bool maybeIncreaseSliceBudget(JS::SliceBudget& budget);
|
||||
bool maybeIncreaseSliceBudgetForLongCollections(JS::SliceBudget& budget);
|
||||
bool maybeIncreaseSliceBudgetForUrgentCollections(JS::SliceBudget& budget);
|
||||
SliceBudget defaultBudget(JS::GCReason reason, int64_t millis);
|
||||
bool maybeIncreaseSliceBudget(SliceBudget& budget);
|
||||
bool maybeIncreaseSliceBudgetForLongCollections(SliceBudget& budget);
|
||||
bool maybeIncreaseSliceBudgetForUrgentCollections(SliceBudget& budget);
|
||||
IncrementalResult budgetIncrementalGC(bool nonincrementalByAPI,
|
||||
JS::GCReason reason,
|
||||
JS::SliceBudget& budget);
|
||||
SliceBudget& budget);
|
||||
void checkZoneIsScheduled(Zone* zone, JS::GCReason reason,
|
||||
const char* trigger);
|
||||
IncrementalResult resetIncrementalGC(GCAbortReason reason);
|
||||
@ -734,7 +734,7 @@ class GCRuntime {
|
||||
|
||||
void setGCOptions(JS::GCOptions options);
|
||||
|
||||
void collect(bool nonincrementalByAPI, const JS::SliceBudget& budget,
|
||||
void collect(bool nonincrementalByAPI, const SliceBudget& budget,
|
||||
JS::GCReason reason) JS_HAZ_GC_CALL;
|
||||
|
||||
/*
|
||||
@ -747,11 +747,11 @@ class GCRuntime {
|
||||
* * Ok otherwise.
|
||||
*/
|
||||
[[nodiscard]] IncrementalResult gcCycle(bool nonincrementalByAPI,
|
||||
const JS::SliceBudget& budgetArg,
|
||||
const SliceBudget& budgetArg,
|
||||
JS::GCReason reason);
|
||||
bool shouldRepeatForDeadZone(JS::GCReason reason);
|
||||
|
||||
void incrementalSlice(JS::SliceBudget& budget, JS::GCReason reason,
|
||||
void incrementalSlice(SliceBudget& budget, JS::GCReason reason,
|
||||
bool budgetWasIncreased);
|
||||
|
||||
bool mightSweepInThisSlice(bool nonIncremental);
|
||||
@ -786,7 +786,7 @@ class GCRuntime {
|
||||
void traceEmbeddingBlackRoots(JSTracer* trc);
|
||||
void traceEmbeddingGrayRoots(JSTracer* trc);
|
||||
IncrementalProgress traceEmbeddingGrayRoots(JSTracer* trc,
|
||||
JS::SliceBudget& budget);
|
||||
SliceBudget& budget);
|
||||
void checkNoRuntimeRoots(AutoGCSession& session);
|
||||
void maybeDoCycleCollection();
|
||||
void findDeadCompartments();
|
||||
@ -797,7 +797,7 @@ class GCRuntime {
|
||||
AllowParallelMarking = true
|
||||
};
|
||||
IncrementalProgress markUntilBudgetExhausted(
|
||||
JS::SliceBudget& sliceBudget,
|
||||
SliceBudget& sliceBudget,
|
||||
ParallelMarking allowParallelMarking = SingleThreadedMarking,
|
||||
ShouldReportMarkTime reportTime = ReportMarkTime);
|
||||
bool canMarkInParallel() const;
|
||||
@ -826,9 +826,9 @@ class GCRuntime {
|
||||
void forEachDelayedMarkingArena(F&& f);
|
||||
|
||||
template <class ZoneIterT>
|
||||
IncrementalProgress markWeakReferences(JS::SliceBudget& budget);
|
||||
IncrementalProgress markWeakReferencesInCurrentGroup(JS::SliceBudget& budget);
|
||||
IncrementalProgress markGrayRoots(JS::SliceBudget& budget,
|
||||
IncrementalProgress markWeakReferences(SliceBudget& budget);
|
||||
IncrementalProgress markWeakReferencesInCurrentGroup(SliceBudget& budget);
|
||||
IncrementalProgress markGrayRoots(SliceBudget& budget,
|
||||
gcstats::PhaseKind phase);
|
||||
void markBufferedGrayRoots(JS::Zone* zone);
|
||||
IncrementalProgress markAllWeakReferences();
|
||||
@ -852,19 +852,19 @@ class GCRuntime {
|
||||
void moveToNextSweepGroup();
|
||||
void resetGrayList(Compartment* comp);
|
||||
IncrementalProgress beginMarkingSweepGroup(JS::GCContext* gcx,
|
||||
JS::SliceBudget& budget);
|
||||
SliceBudget& budget);
|
||||
IncrementalProgress markGrayRootsInCurrentGroup(JS::GCContext* gcx,
|
||||
JS::SliceBudget& budget);
|
||||
IncrementalProgress markGray(JS::GCContext* gcx, JS::SliceBudget& budget);
|
||||
SliceBudget& budget);
|
||||
IncrementalProgress markGray(JS::GCContext* gcx, SliceBudget& budget);
|
||||
IncrementalProgress endMarkingSweepGroup(JS::GCContext* gcx,
|
||||
JS::SliceBudget& budget);
|
||||
SliceBudget& budget);
|
||||
void markIncomingGrayCrossCompartmentPointers();
|
||||
IncrementalProgress beginSweepingSweepGroup(JS::GCContext* gcx,
|
||||
JS::SliceBudget& budget);
|
||||
SliceBudget& budget);
|
||||
void initBackgroundSweep(Zone* zone, JS::GCContext* gcx,
|
||||
const FinalizePhase& phase);
|
||||
IncrementalProgress markDuringSweeping(JS::GCContext* gcx,
|
||||
JS::SliceBudget& budget);
|
||||
SliceBudget& budget);
|
||||
void updateAtomsBitmap();
|
||||
void sweepCCWrappers();
|
||||
void sweepRealmGlobals();
|
||||
@ -880,20 +880,17 @@ class GCRuntime {
|
||||
void traceWeakFinalizationObserverEdges(JSTracer* trc, Zone* zone);
|
||||
void sweepWeakRefs();
|
||||
IncrementalProgress endSweepingSweepGroup(JS::GCContext* gcx,
|
||||
JS::SliceBudget& budget);
|
||||
IncrementalProgress performSweepActions(JS::SliceBudget& sliceBudget);
|
||||
SliceBudget& budget);
|
||||
IncrementalProgress performSweepActions(SliceBudget& sliceBudget);
|
||||
void startSweepingAtomsTable();
|
||||
IncrementalProgress sweepAtomsTable(JS::GCContext* gcx,
|
||||
JS::SliceBudget& budget);
|
||||
IncrementalProgress sweepWeakCaches(JS::GCContext* gcx,
|
||||
JS::SliceBudget& budget);
|
||||
IncrementalProgress sweepAtomsTable(JS::GCContext* gcx, SliceBudget& budget);
|
||||
IncrementalProgress sweepWeakCaches(JS::GCContext* gcx, SliceBudget& budget);
|
||||
IncrementalProgress finalizeAllocKind(JS::GCContext* gcx,
|
||||
JS::SliceBudget& budget);
|
||||
SliceBudget& budget);
|
||||
bool foregroundFinalize(JS::GCContext* gcx, Zone* zone, AllocKind thingKind,
|
||||
JS::SliceBudget& sliceBudget,
|
||||
js::SliceBudget& sliceBudget,
|
||||
SortedArenaList& sweepList);
|
||||
IncrementalProgress sweepPropMapTree(JS::GCContext* gcx,
|
||||
JS::SliceBudget& budget);
|
||||
IncrementalProgress sweepPropMapTree(JS::GCContext* gcx, SliceBudget& budget);
|
||||
void endSweepPhase(bool destroyingRuntime);
|
||||
void queueZonesAndStartBackgroundSweep(ZoneList&& zones);
|
||||
void sweepFromBackgroundThread(AutoLockHelperThreadState& lock);
|
||||
@ -919,14 +916,14 @@ class GCRuntime {
|
||||
bool shouldCompact();
|
||||
void beginCompactPhase();
|
||||
IncrementalProgress compactPhase(JS::GCReason reason,
|
||||
JS::SliceBudget& sliceBudget,
|
||||
SliceBudget& sliceBudget,
|
||||
AutoGCSession& session);
|
||||
void endCompactPhase();
|
||||
void sweepZoneAfterCompacting(MovingTracer* trc, Zone* zone);
|
||||
bool canRelocateZone(Zone* zone) const;
|
||||
[[nodiscard]] bool relocateArenas(Zone* zone, JS::GCReason reason,
|
||||
Arena*& relocatedListOut,
|
||||
JS::SliceBudget& sliceBudget);
|
||||
SliceBudget& sliceBudget);
|
||||
void updateCellPointers(Zone* zone, AllocKinds kinds);
|
||||
void updateAllCellPointers(MovingTracer* trc, Zone* zone);
|
||||
void updateZonePointersToRelocatedCells(Zone* zone);
|
||||
@ -957,8 +954,8 @@ class GCRuntime {
|
||||
};
|
||||
|
||||
IncrementalProgress waitForBackgroundTask(
|
||||
GCParallelTask& task, const JS::SliceBudget& budget,
|
||||
bool shouldPauseMutator, ShouldTriggerSliceWhenFinished triggerSlice);
|
||||
GCParallelTask& task, const SliceBudget& budget, bool shouldPauseMutator,
|
||||
ShouldTriggerSliceWhenFinished triggerSlice);
|
||||
|
||||
void maybeRequestGCAfterBackgroundTask(const AutoLockHelperThreadState& lock);
|
||||
void cancelRequestedGCAfterBackgroundTask();
|
||||
|
@ -35,7 +35,6 @@ using namespace js;
|
||||
using namespace js::gc;
|
||||
|
||||
using JS::MapTypeToTraceKind;
|
||||
using JS::SliceBudget;
|
||||
|
||||
using mozilla::DebugOnly;
|
||||
using mozilla::IntegerRange;
|
||||
|
@ -19,8 +19,6 @@ using mozilla::Maybe;
|
||||
using mozilla::TimeDuration;
|
||||
using mozilla::TimeStamp;
|
||||
|
||||
using JS::SliceBudget;
|
||||
|
||||
class AutoAddTimeDuration {
|
||||
TimeStamp start;
|
||||
TimeDuration& result;
|
||||
|
@ -38,7 +38,7 @@ class MOZ_STACK_CLASS ParallelMarker {
|
||||
public:
|
||||
explicit ParallelMarker(GCRuntime* gc);
|
||||
|
||||
bool mark(JS::SliceBudget& sliceBudget);
|
||||
bool mark(SliceBudget& sliceBudget);
|
||||
|
||||
using AtomicCount = mozilla::Atomic<uint32_t, mozilla::Relaxed>;
|
||||
AtomicCount& waitingTaskCountRef() { return waitingTaskCount; }
|
||||
@ -46,7 +46,7 @@ class MOZ_STACK_CLASS ParallelMarker {
|
||||
void donateWorkFrom(GCMarker* src);
|
||||
|
||||
private:
|
||||
bool markOneColor(MarkColor color, JS::SliceBudget& sliceBudget);
|
||||
bool markOneColor(MarkColor color, SliceBudget& sliceBudget);
|
||||
|
||||
bool hasWork(MarkColor color) const;
|
||||
|
||||
@ -88,7 +88,7 @@ class alignas(TypicalCacheLineSize) ParallelMarkTask
|
||||
friend class ParallelMarker;
|
||||
|
||||
ParallelMarkTask(ParallelMarker* pm, GCMarker* marker, MarkColor color,
|
||||
const JS::SliceBudget& budget);
|
||||
const SliceBudget& budget);
|
||||
~ParallelMarkTask();
|
||||
|
||||
void run(AutoLockHelperThreadState& lock) override;
|
||||
@ -109,7 +109,7 @@ class alignas(TypicalCacheLineSize) ParallelMarkTask
|
||||
ParallelMarker* const pm;
|
||||
GCMarker* const marker;
|
||||
AutoSetMarkColor color;
|
||||
JS::SliceBudget budget;
|
||||
SliceBudget budget;
|
||||
ConditionVariable resumed;
|
||||
|
||||
HelperThreadLockData<bool> isWaiting;
|
||||
|
@ -38,7 +38,7 @@ class ParallelWorker : public GCParallelTask {
|
||||
|
||||
ParallelWorker(GCRuntime* gc, gcstats::PhaseKind phaseKind, GCUse use,
|
||||
WorkFunc func, WorkItemIterator& work,
|
||||
const JS::SliceBudget& budget, AutoLockHelperThreadState& lock)
|
||||
const SliceBudget& budget, AutoLockHelperThreadState& lock)
|
||||
: GCParallelTask(gc, phaseKind, use),
|
||||
func_(func),
|
||||
work_(work),
|
||||
@ -79,7 +79,7 @@ class ParallelWorker : public GCParallelTask {
|
||||
HelperThreadLockData<WorkItemIterator&> work_;
|
||||
|
||||
// The budget that determines how long to run for.
|
||||
JS::SliceBudget budget_;
|
||||
SliceBudget budget_;
|
||||
|
||||
// The next work item to process.
|
||||
WorkItem item_;
|
||||
@ -97,7 +97,7 @@ class MOZ_RAII AutoRunParallelWork {
|
||||
|
||||
AutoRunParallelWork(GCRuntime* gc, WorkFunc func,
|
||||
gcstats::PhaseKind phaseKind, GCUse use,
|
||||
WorkItemIterator& work, const JS::SliceBudget& budget,
|
||||
WorkItemIterator& work, const SliceBudget& budget,
|
||||
AutoLockHelperThreadState& lock)
|
||||
: gc(gc), phaseKind(phaseKind), lock(lock), tasksStarted(0) {
|
||||
size_t workerCount = gc->parallelWorkerCount();
|
||||
|
@ -37,8 +37,6 @@ using mozilla::Maybe;
|
||||
using mozilla::TimeDuration;
|
||||
using mozilla::TimeStamp;
|
||||
|
||||
using JS::SliceBudget;
|
||||
|
||||
static const size_t BYTES_PER_MB = 1024 * 1024;
|
||||
|
||||
/*
|
||||
|
@ -178,7 +178,7 @@ struct Statistics {
|
||||
void resumePhases();
|
||||
|
||||
void beginSlice(const ZoneGCStats& zoneStats, JS::GCOptions options,
|
||||
const JS::SliceBudget& budget, JS::GCReason reason,
|
||||
const SliceBudget& budget, JS::GCReason reason,
|
||||
bool budgetWasIncreased);
|
||||
void endSlice();
|
||||
|
||||
@ -253,11 +253,11 @@ struct Statistics {
|
||||
static const size_t MAX_SUSPENDED_PHASES = MAX_PHASE_NESTING * 3;
|
||||
|
||||
struct SliceData {
|
||||
SliceData(const JS::SliceBudget& budget, mozilla::Maybe<Trigger> trigger,
|
||||
SliceData(const SliceBudget& budget, mozilla::Maybe<Trigger> trigger,
|
||||
JS::GCReason reason, TimeStamp start, size_t startFaults,
|
||||
gc::State initialState);
|
||||
|
||||
JS::SliceBudget budget;
|
||||
SliceBudget budget;
|
||||
JS::GCReason reason = JS::GCReason::NO_REASON;
|
||||
mozilla::Maybe<Trigger> trigger;
|
||||
gc::State initialState = gc::State::NotActive;
|
||||
@ -503,7 +503,7 @@ struct Statistics {
|
||||
|
||||
struct MOZ_RAII AutoGCSlice {
|
||||
AutoGCSlice(Statistics& stats, const ZoneGCStats& zoneStats,
|
||||
JS::GCOptions options, const JS::SliceBudget& budget,
|
||||
JS::GCOptions options, const SliceBudget& budget,
|
||||
JS::GCReason reason, bool budgetWasIncreased)
|
||||
: stats(stats) {
|
||||
stats.beginSlice(zoneStats, options, budget, reason, budgetWasIncreased);
|
||||
|
@ -56,8 +56,6 @@ using namespace js::gc;
|
||||
|
||||
using mozilla::TimeStamp;
|
||||
|
||||
using JS::SliceBudget;
|
||||
|
||||
struct js::gc::FinalizePhase {
|
||||
gcstats::PhaseKind statsPhase;
|
||||
AllocKinds kinds;
|
||||
|
@ -794,7 +794,7 @@ class Zone : public js::ZoneAllocator, public js::gc::GraphNodeBase<JS::Zone> {
|
||||
// Perform all pending weakmap entry marking for this zone after
|
||||
// transitioning to weak marking mode.
|
||||
js::gc::IncrementalProgress enterWeakMarkingMode(js::GCMarker* marker,
|
||||
JS::SliceBudget& budget);
|
||||
js::SliceBudget& budget);
|
||||
|
||||
// A set of edges from this zone to other zones used during GC to calculate
|
||||
// sweep groups.
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "jsapi-tests/tests.h"
|
||||
|
||||
using namespace js;
|
||||
using namespace JS;
|
||||
|
||||
static const unsigned BufSize = 20;
|
||||
static unsigned FinalizeCalls = 0;
|
||||
|
@ -281,7 +281,7 @@ bool TestJSWeakMapWithGrayUnmarking(MarkKeyOrDelegate markKey,
|
||||
// Start an incremental GC and run until gray roots have been pushed onto
|
||||
// the mark stack.
|
||||
JS::PrepareForFullGC(cx);
|
||||
JS::SliceBudget budget(TimeBudget(1000000));
|
||||
js::SliceBudget budget(TimeBudget(1000000));
|
||||
JS::StartIncrementalGC(cx, JS::GCOptions::Normal, JS::GCReason::DEBUG_GC,
|
||||
budget);
|
||||
MOZ_ASSERT(cx->runtime()->gc.state() == gc::State::Sweep);
|
||||
@ -411,7 +411,7 @@ bool TestInternalWeakMapWithGrayUnmarking(CellColor keyMarkColor,
|
||||
// Start an incremental GC and run until gray roots have been pushed onto
|
||||
// the mark stack.
|
||||
JS::PrepareForFullGC(cx);
|
||||
JS::SliceBudget budget(TimeBudget(1000000));
|
||||
js::SliceBudget budget(TimeBudget(1000000));
|
||||
JS::StartIncrementalGC(cx, JS::GCOptions::Normal, JS::GCReason::DEBUG_GC,
|
||||
budget);
|
||||
MOZ_ASSERT(cx->runtime()->gc.state() == gc::State::Sweep);
|
||||
@ -503,7 +503,7 @@ bool TestCCWs() {
|
||||
|
||||
JSRuntime* rt = cx->runtime();
|
||||
JS::PrepareForFullGC(cx);
|
||||
JS::SliceBudget budget(JS::WorkBudget(1));
|
||||
js::SliceBudget budget(js::WorkBudget(1));
|
||||
rt->gc.startDebugGC(JS::GCOptions::Normal, budget);
|
||||
while (rt->gc.state() == gc::State::Prepare) {
|
||||
rt->gc.debugGCSlice(budget);
|
||||
@ -531,7 +531,7 @@ bool TestCCWs() {
|
||||
|
||||
// Incremental zone GC started: the source is now unmarked.
|
||||
JS::PrepareZoneForGC(cx, wrapper->zone());
|
||||
budget = JS::SliceBudget(JS::WorkBudget(1));
|
||||
budget = js::SliceBudget(js::WorkBudget(1));
|
||||
rt->gc.startDebugGC(JS::GCOptions::Normal, budget);
|
||||
while (rt->gc.state() == gc::State::Prepare) {
|
||||
rt->gc.debugGCSlice(budget);
|
||||
|
@ -504,7 +504,7 @@ bool CallDuringIncrementalGC(uint32_t mode, F&& f) {
|
||||
|
||||
JS::SetGCZeal(cx, mode, 0);
|
||||
JS::PrepareZoneForGC(cx, js::GetContextZone(cx));
|
||||
JS::SliceBudget budget{JS::TimeBudget(BudgetMS)};
|
||||
js::SliceBudget budget{TimeBudget(BudgetMS)};
|
||||
JS::StartIncrementalGC(cx, JS::GCOptions(), JS::GCReason::DEBUG_GC, budget);
|
||||
CHECK(JS::IsIncrementalGCInProgress(cx));
|
||||
|
||||
|
@ -86,7 +86,7 @@ BEGIN_TEST(testGCRootsRemoved) {
|
||||
CHECK(obj);
|
||||
|
||||
JS::PrepareForFullGC(cx);
|
||||
JS::SliceBudget budget(JS::WorkBudget(1));
|
||||
js::SliceBudget budget(js::WorkBudget(1));
|
||||
cx->runtime()->gc.startDebugGC(JS::GCOptions::Shrink, budget);
|
||||
CHECK(JS::IsIncrementalGCInProgress(cx));
|
||||
|
||||
@ -171,7 +171,7 @@ static void GCTreeCallback(JSContext* cx, JSGCStatus status,
|
||||
if (invocation.requestFullGC) {
|
||||
JS::PrepareForFullGC(cx);
|
||||
}
|
||||
JS::SliceBudget budget = JS::SliceBudget(JS::WorkBudget(1));
|
||||
js::SliceBudget budget = js::SliceBudget(js::WorkBudget(1));
|
||||
cx->runtime()->gc.startGC(GCOptions::Normal, invocation.reason, budget);
|
||||
MOZ_RELEASE_ASSERT(JS::IsIncrementalGCInProgress(cx));
|
||||
|
||||
@ -265,7 +265,7 @@ BEGIN_TEST(testGCTree) {
|
||||
|
||||
// Outer GC is a full GC.
|
||||
JS::PrepareForFullGC(cx);
|
||||
JS::SliceBudget budget(JS::WorkBudget(1));
|
||||
js::SliceBudget budget(js::WorkBudget(1));
|
||||
cx->runtime()->gc.startDebugGC(JS::GCOptions::Normal, budget);
|
||||
CHECK(JS::IsIncrementalGCInProgress(cx));
|
||||
|
||||
|
@ -375,7 +375,7 @@ BEGIN_TEST(testIncrementalRoots) {
|
||||
// Do the root marking slice. This should mark 'root' and a bunch of its
|
||||
// descendants. It shouldn't make it all the way through (it gets a budget
|
||||
// of 1000, and the graph is about 3000 objects deep).
|
||||
JS::SliceBudget budget(JS::WorkBudget(1000));
|
||||
js::SliceBudget budget(js::WorkBudget(1000));
|
||||
AutoGCParameter param(cx, JSGC_INCREMENTAL_GC_ENABLED, true);
|
||||
rt->gc.startDebugGC(JS::GCOptions::Normal, budget);
|
||||
while (rt->gc.state() != gc::State::Mark) {
|
||||
@ -436,7 +436,7 @@ BEGIN_TEST(testIncrementalRoots) {
|
||||
}
|
||||
|
||||
// Finish the GC using an unlimited budget.
|
||||
auto unlimited = JS::SliceBudget::unlimited();
|
||||
auto unlimited = js::SliceBudget::unlimited();
|
||||
rt->gc.debugGCSlice(unlimited);
|
||||
|
||||
// Access the leaf object to try to trigger a crash if it is dead.
|
||||
|
@ -9,9 +9,6 @@
|
||||
#include "jsapi-tests/tests.h"
|
||||
|
||||
using namespace js;
|
||||
using JS::SliceBudget;
|
||||
using JS::TimeBudget;
|
||||
using JS::WorkBudget;
|
||||
|
||||
BEGIN_TEST(testSliceBudgetUnlimited) {
|
||||
SliceBudget budget = SliceBudget::unlimited();
|
||||
|
@ -309,7 +309,7 @@ JSObject* newDelegate() {
|
||||
|
||||
void performIncrementalGC() {
|
||||
JSRuntime* rt = cx->runtime();
|
||||
JS::SliceBudget budget(JS::WorkBudget(1000));
|
||||
js::SliceBudget budget(js::WorkBudget(1000));
|
||||
rt->gc.startDebugGC(JS::GCOptions::Normal, budget);
|
||||
|
||||
// Wait until we've started marking before finishing the GC
|
||||
|
@ -911,7 +911,7 @@ static void TraceBlackRoots(JSTracer* trc, void* data) {
|
||||
TraceRootArrays(trc, gc::MarkColor::Black);
|
||||
}
|
||||
|
||||
static bool TraceGrayRoots(JSTracer* trc, JS::SliceBudget& budget, void* data) {
|
||||
static bool TraceGrayRoots(JSTracer* trc, SliceBudget& budget, void* data) {
|
||||
TraceRootArrays(trc, gc::MarkColor::Gray);
|
||||
return true;
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ class AtomsTable {
|
||||
bool startIncrementalSweep(mozilla::Maybe<SweepIterator>& atomsToSweepOut);
|
||||
|
||||
// Sweep some atoms incrementally and return whether we finished.
|
||||
bool sweepIncrementally(SweepIterator& atomsToSweep, JS::SliceBudget& budget);
|
||||
bool sweepIncrementally(SweepIterator& atomsToSweep, SliceBudget& budget);
|
||||
|
||||
size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
|
||||
|
||||
|
@ -343,7 +343,7 @@ void AtomsTable::mergeAtomsAddedWhileSweeping() {
|
||||
}
|
||||
|
||||
bool AtomsTable::sweepIncrementally(SweepIterator& atomsToSweep,
|
||||
JS::SliceBudget& budget) {
|
||||
SliceBudget& budget) {
|
||||
// Sweep the table incrementally until we run out of work or budget.
|
||||
while (!atomsToSweep.empty()) {
|
||||
budget.step();
|
||||
|
@ -154,7 +154,7 @@ class AsyncFreeSnowWhite : public Runnable {
|
||||
|
||||
TimeStamp start = TimeStamp::Now();
|
||||
// 2 ms budget, given that kICCSliceBudget is only 3 ms
|
||||
SliceBudget budget = SliceBudget(TimeBudget(2));
|
||||
js::SliceBudget budget = js::SliceBudget(js::TimeBudget(2));
|
||||
bool hadSnowWhiteObjects =
|
||||
nsCycleCollector_doDeferredDeletionWithBudget(budget);
|
||||
Telemetry::Accumulate(
|
||||
|
@ -993,7 +993,7 @@ void CycleCollectedJSRuntime::TraceBlackJS(JSTracer* aTracer, void* aData) {
|
||||
|
||||
/* static */
|
||||
bool CycleCollectedJSRuntime::TraceGrayJS(JSTracer* aTracer,
|
||||
JS::SliceBudget& budget,
|
||||
js::SliceBudget& budget,
|
||||
void* aData) {
|
||||
CycleCollectedJSRuntime* self = static_cast<CycleCollectedJSRuntime*>(aData);
|
||||
|
||||
@ -1366,7 +1366,7 @@ static inline bool ShouldCheckSingleZoneHolders() {
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
void CycleCollectedJSRuntime::TraceAllNativeGrayRoots(JSTracer* aTracer) {
|
||||
MOZ_RELEASE_ASSERT(mHolderIter.isNothing());
|
||||
JS::SliceBudget budget = JS::SliceBudget::unlimited();
|
||||
js::SliceBudget budget = js::SliceBudget::unlimited();
|
||||
MOZ_ALWAYS_TRUE(
|
||||
TraceNativeGrayRoots(aTracer, JSHolderMap::AllHolders, budget));
|
||||
}
|
||||
@ -1374,7 +1374,7 @@ void CycleCollectedJSRuntime::TraceAllNativeGrayRoots(JSTracer* aTracer) {
|
||||
|
||||
bool CycleCollectedJSRuntime::TraceNativeGrayRoots(
|
||||
JSTracer* aTracer, JSHolderMap::WhichHolders aWhich,
|
||||
JS::SliceBudget& aBudget) {
|
||||
js::SliceBudget& aBudget) {
|
||||
if (!mHolderIter) {
|
||||
// NB: This is here just to preserve the existing XPConnect order. I doubt
|
||||
// it would hurt to do this after the JS holders.
|
||||
@ -1398,7 +1398,7 @@ bool CycleCollectedJSRuntime::TraceNativeGrayRoots(
|
||||
|
||||
bool CycleCollectedJSRuntime::TraceJSHolders(JSTracer* aTracer,
|
||||
JSHolderMap::Iter& aIter,
|
||||
JS::SliceBudget& aBudget) {
|
||||
js::SliceBudget& aBudget) {
|
||||
bool checkSingleZoneHolders = ShouldCheckSingleZoneHolders();
|
||||
|
||||
while (!aIter.Done() && !aBudget.isOverBudget()) {
|
||||
|
@ -272,7 +272,7 @@ class CycleCollectedJSRuntime {
|
||||
|
||||
// Trace gray JS roots until budget is exceeded and return whether we
|
||||
// finished.
|
||||
static bool TraceGrayJS(JSTracer* aTracer, JS::SliceBudget& budget,
|
||||
static bool TraceGrayJS(JSTracer* aTracer, js::SliceBudget& budget,
|
||||
void* aData);
|
||||
|
||||
static void GCCallback(JSContext* aContext, JSGCStatus aStatus,
|
||||
@ -296,9 +296,9 @@ class CycleCollectedJSRuntime {
|
||||
#endif
|
||||
|
||||
bool TraceNativeGrayRoots(JSTracer* aTracer, JSHolderMap::WhichHolders aWhich,
|
||||
JS::SliceBudget& aBudget);
|
||||
js::SliceBudget& aBudget);
|
||||
bool TraceJSHolders(JSTracer* aTracer, JSHolderMap::Iter& aIter,
|
||||
JS::SliceBudget& aBudget);
|
||||
js::SliceBudget& aBudget);
|
||||
|
||||
public:
|
||||
enum DeferredFinalizeType {
|
||||
|
@ -198,8 +198,6 @@
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
using JS::SliceBudget;
|
||||
|
||||
struct NurseryPurpleBufferEntry {
|
||||
void* mPtr;
|
||||
nsCycleCollectionParticipant* mParticipant;
|
||||
@ -1051,7 +1049,7 @@ struct nsPurpleBuffer {
|
||||
// (4) If aRemoveChildlessNodes is true, then any nodes in the purple buffer
|
||||
// that will have no children in the cycle collector graph will also be
|
||||
// removed. CanSkip() may be run on these children.
|
||||
void RemoveSkippable(nsCycleCollector* aCollector, SliceBudget& aBudget,
|
||||
void RemoveSkippable(nsCycleCollector* aCollector, js::SliceBudget& aBudget,
|
||||
bool aRemoveChildlessNodes, bool aAsyncSnowWhiteFreeing,
|
||||
CC_ForgetSkippableCallback aCb);
|
||||
|
||||
@ -1121,6 +1119,8 @@ enum ccIsManual { CCIsNotManual = false, CCIsManual = true };
|
||||
// Top level structure for the cycle collector.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using js::SliceBudget;
|
||||
|
||||
class JSPurpleBuffer;
|
||||
|
||||
class nsCycleCollector : public nsIMemoryReporter {
|
||||
@ -1186,10 +1186,10 @@ class nsCycleCollector : public nsIMemoryReporter {
|
||||
nsCycleCollectingAutoRefCnt* aRefCnt);
|
||||
void SuspectNurseryEntries();
|
||||
uint32_t SuspectedCount();
|
||||
void ForgetSkippable(SliceBudget& aBudget, bool aRemoveChildlessNodes,
|
||||
void ForgetSkippable(js::SliceBudget& aBudget, bool aRemoveChildlessNodes,
|
||||
bool aAsyncSnowWhiteFreeing);
|
||||
bool FreeSnowWhite(bool aUntilNoSWInPurpleBuffer);
|
||||
bool FreeSnowWhiteWithBudget(SliceBudget& aBudget);
|
||||
bool FreeSnowWhiteWithBudget(js::SliceBudget& aBudget);
|
||||
|
||||
// This method assumes its argument is already canonicalized.
|
||||
void RemoveObjectFromGraph(void* aPtr);
|
||||
@ -2482,7 +2482,7 @@ class SnowWhiteKiller : public TraceCallbacks {
|
||||
ObjectsVector;
|
||||
|
||||
public:
|
||||
SnowWhiteKiller(nsCycleCollector* aCollector, SliceBudget* aBudget)
|
||||
SnowWhiteKiller(nsCycleCollector* aCollector, js::SliceBudget* aBudget)
|
||||
: mCollector(aCollector),
|
||||
mObjects(kSegmentSize),
|
||||
mBudget(aBudget),
|
||||
@ -2590,13 +2590,13 @@ class SnowWhiteKiller : public TraceCallbacks {
|
||||
private:
|
||||
RefPtr<nsCycleCollector> mCollector;
|
||||
ObjectsVector mObjects;
|
||||
SliceBudget* mBudget;
|
||||
js::SliceBudget* mBudget;
|
||||
bool mSawSnowWhiteObjects;
|
||||
};
|
||||
|
||||
class RemoveSkippableVisitor : public SnowWhiteKiller {
|
||||
public:
|
||||
RemoveSkippableVisitor(nsCycleCollector* aCollector, SliceBudget& aBudget,
|
||||
RemoveSkippableVisitor(nsCycleCollector* aCollector, js::SliceBudget& aBudget,
|
||||
bool aRemoveChildlessNodes,
|
||||
bool aAsyncSnowWhiteFreeing,
|
||||
CC_ForgetSkippableCallback aCb)
|
||||
@ -2649,7 +2649,7 @@ class RemoveSkippableVisitor : public SnowWhiteKiller {
|
||||
}
|
||||
|
||||
private:
|
||||
SliceBudget& mBudget;
|
||||
js::SliceBudget& mBudget;
|
||||
bool mRemoveChildlessNodes;
|
||||
bool mAsyncSnowWhiteFreeing;
|
||||
bool mDispatchedDeferredDeletion;
|
||||
@ -2657,7 +2657,7 @@ class RemoveSkippableVisitor : public SnowWhiteKiller {
|
||||
};
|
||||
|
||||
void nsPurpleBuffer::RemoveSkippable(nsCycleCollector* aCollector,
|
||||
SliceBudget& aBudget,
|
||||
js::SliceBudget& aBudget,
|
||||
bool aRemoveChildlessNodes,
|
||||
bool aAsyncSnowWhiteFreeing,
|
||||
CC_ForgetSkippableCallback aCb) {
|
||||
@ -2690,7 +2690,7 @@ bool nsCycleCollector::FreeSnowWhite(bool aUntilNoSWInPurpleBuffer) {
|
||||
return hadSnowWhiteObjects;
|
||||
}
|
||||
|
||||
bool nsCycleCollector::FreeSnowWhiteWithBudget(SliceBudget& aBudget) {
|
||||
bool nsCycleCollector::FreeSnowWhiteWithBudget(js::SliceBudget& aBudget) {
|
||||
CheckThreadSafety();
|
||||
|
||||
if (mFreeingSnowWhite) {
|
||||
@ -2707,7 +2707,7 @@ bool nsCycleCollector::FreeSnowWhiteWithBudget(SliceBudget& aBudget) {
|
||||
;
|
||||
}
|
||||
|
||||
void nsCycleCollector::ForgetSkippable(SliceBudget& aBudget,
|
||||
void nsCycleCollector::ForgetSkippable(js::SliceBudget& aBudget,
|
||||
bool aRemoveChildlessNodes,
|
||||
bool aAsyncSnowWhiteFreeing) {
|
||||
CheckThreadSafety();
|
||||
@ -3950,7 +3950,7 @@ void nsCycleCollector_setForgetSkippableCallback(
|
||||
data->mCollector->SetForgetSkippableCallback(aCB);
|
||||
}
|
||||
|
||||
void nsCycleCollector_forgetSkippable(SliceBudget& aBudget,
|
||||
void nsCycleCollector_forgetSkippable(js::SliceBudget& aBudget,
|
||||
bool aRemoveChildlessNodes,
|
||||
bool aAsyncSnowWhiteFreeing) {
|
||||
CollectorData* data = sCollectorData.get();
|
||||
@ -3984,7 +3984,7 @@ bool nsCycleCollector_doDeferredDeletion() {
|
||||
return data->mCollector->FreeSnowWhite(false);
|
||||
}
|
||||
|
||||
bool nsCycleCollector_doDeferredDeletionWithBudget(SliceBudget& aBudget) {
|
||||
bool nsCycleCollector_doDeferredDeletionWithBudget(js::SliceBudget& aBudget) {
|
||||
CollectorData* data = sCollectorData.get();
|
||||
|
||||
// We should have started the cycle collector by now.
|
||||
|
@ -16,7 +16,7 @@ struct already_AddRefed;
|
||||
#include <cstdint>
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
namespace JS {
|
||||
namespace js {
|
||||
class SliceBudget;
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ typedef void (*CC_ForgetSkippableCallback)(void);
|
||||
void nsCycleCollector_setForgetSkippableCallback(
|
||||
CC_ForgetSkippableCallback aCB);
|
||||
|
||||
void nsCycleCollector_forgetSkippable(JS::SliceBudget& aBudget,
|
||||
void nsCycleCollector_forgetSkippable(js::SliceBudget& aBudget,
|
||||
bool aRemoveChildlessNodes = false,
|
||||
bool aAsyncSnowWhiteFreeing = false);
|
||||
|
||||
@ -47,7 +47,7 @@ void nsCycleCollector_finishAnyCurrentCollection();
|
||||
void nsCycleCollector_dispatchDeferredDeletion(bool aContinuation = false,
|
||||
bool aPurge = false);
|
||||
bool nsCycleCollector_doDeferredDeletion();
|
||||
bool nsCycleCollector_doDeferredDeletionWithBudget(JS::SliceBudget& aBudget);
|
||||
bool nsCycleCollector_doDeferredDeletionWithBudget(js::SliceBudget& aBudget);
|
||||
|
||||
already_AddRefed<nsICycleCollectorLogSink> nsCycleCollector_createLogSink(
|
||||
bool aLogGC);
|
||||
@ -57,7 +57,7 @@ already_AddRefed<nsICycleCollectorListener> nsCycleCollector_createLogger();
|
||||
bool nsCycleCollector_collect(mozilla::CCReason aReason,
|
||||
nsICycleCollectorListener* aManualListener);
|
||||
|
||||
void nsCycleCollector_collectSlice(JS::SliceBudget& budget,
|
||||
void nsCycleCollector_collectSlice(js::SliceBudget& budget,
|
||||
mozilla::CCReason aReason,
|
||||
bool aPreferShorterSlices = false);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user