зеркало из https://github.com/mozilla/gecko-dev.git
Bug 935721, part 10 - Separate nsCycleCollector_collect and nsCycleCollector_scheduledCollect. r=smaug
This commit is contained in:
Родитель
e95cbc0c81
Коммит
6663405c37
|
@ -2016,18 +2016,10 @@ struct CycleCollectorStats
|
|||
|
||||
CycleCollectorStats gCCStats;
|
||||
|
||||
//static
|
||||
void
|
||||
nsJSContext::CycleCollectNow(nsICycleCollectorListener *aListener,
|
||||
int32_t aExtraForgetSkippableCalls,
|
||||
bool aManuallyTriggered)
|
||||
|
||||
static void
|
||||
PrepareForCycleCollection(int32_t aExtraForgetSkippableCalls = 0)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
return;
|
||||
}
|
||||
|
||||
PROFILER_LABEL("CC", "CycleCollectNow");
|
||||
|
||||
gCCStats.mBeginSliceTime = PR_Now();
|
||||
|
||||
// Before we begin the cycle collection, make sure there is no active GC.
|
||||
|
@ -2063,9 +2055,33 @@ nsJSContext::CycleCollectNow(nsICycleCollectorListener *aListener,
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
nsCycleCollector_collect(aManuallyTriggered, aListener);
|
||||
//static
|
||||
void
|
||||
nsJSContext::CycleCollectNow(nsICycleCollectorListener *aListener,
|
||||
int32_t aExtraForgetSkippableCalls)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
return;
|
||||
}
|
||||
|
||||
PROFILER_LABEL("CC", "CycleCollectNow");
|
||||
PrepareForCycleCollection(aExtraForgetSkippableCalls);
|
||||
nsCycleCollector_collect(aListener);
|
||||
}
|
||||
|
||||
//static
|
||||
void
|
||||
nsJSContext::ScheduledCycleCollectNow()
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
return;
|
||||
}
|
||||
|
||||
PROFILER_LABEL("CC", "ScheduledCycleCollectNow");
|
||||
PrepareForCycleCollection();
|
||||
nsCycleCollector_scheduledCollect();
|
||||
}
|
||||
|
||||
//static
|
||||
|
@ -2300,7 +2316,7 @@ CCTimerFired(nsITimer *aTimer, void *aClosure)
|
|||
// We are in the final timer fire and still meet the conditions for
|
||||
// triggering a CC. Let CycleCollectNow finish the current IGC, if any,
|
||||
// because that will allow us to include the GC time in the CC pause.
|
||||
nsJSContext::CycleCollectNow(nullptr, 0, false);
|
||||
nsJSContext::ScheduledCycleCollectNow();
|
||||
}
|
||||
} else if ((sPreviousSuspectedCount + 100) <= suspected) {
|
||||
// Only do a forget skippable if there are more than a few new objects.
|
||||
|
|
|
@ -104,8 +104,8 @@ public:
|
|||
// If aExtraForgetSkippableCalls is -1, forgetSkippable won't be
|
||||
// called even if the previous collection was GC.
|
||||
static void CycleCollectNow(nsICycleCollectorListener *aListener = nullptr,
|
||||
int32_t aExtraForgetSkippableCalls = 0,
|
||||
bool aManuallyTriggered = true);
|
||||
int32_t aExtraForgetSkippableCalls = 0);
|
||||
static void ScheduledCycleCollectNow();
|
||||
static void BeginCycleCollectionCallback();
|
||||
static void EndCycleCollectionCallback(mozilla::CycleCollectorResults &aResults);
|
||||
|
||||
|
|
|
@ -914,7 +914,7 @@ public:
|
|||
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||
|
||||
if (aStatus == JSGC_END) {
|
||||
nsCycleCollector_collect(true, nullptr);
|
||||
nsCycleCollector_collect(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3170,8 +3170,7 @@ nsCycleCollector_doDeferredDeletion()
|
|||
}
|
||||
|
||||
void
|
||||
nsCycleCollector_collect(bool aManuallyTriggered,
|
||||
nsICycleCollectorListener *aManualListener)
|
||||
nsCycleCollector_collect(nsICycleCollectorListener *aManualListener)
|
||||
{
|
||||
CollectorData *data = sCollectorData.get();
|
||||
|
||||
|
@ -3180,9 +3179,20 @@ nsCycleCollector_collect(bool aManuallyTriggered,
|
|||
MOZ_ASSERT(data->mCollector);
|
||||
|
||||
PROFILER_LABEL("CC", "nsCycleCollector_collect");
|
||||
data->mCollector->Collect(ManualCC, aManualListener);
|
||||
}
|
||||
|
||||
MOZ_ASSERT_IF(aManualListener, aManuallyTriggered);
|
||||
data->mCollector->Collect(aManuallyTriggered ? ManualCC : ScheduledCC, aManualListener);
|
||||
void
|
||||
nsCycleCollector_scheduledCollect()
|
||||
{
|
||||
CollectorData *data = sCollectorData.get();
|
||||
|
||||
// We should have started the cycle collector by now.
|
||||
MOZ_ASSERT(data);
|
||||
MOZ_ASSERT(data->mCollector);
|
||||
|
||||
PROFILER_LABEL("CC", "nsCycleCollector_scheduledCollect");
|
||||
data->mCollector->Collect(ScheduledCC, nullptr);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -38,8 +38,9 @@ void nsCycleCollector_forgetSkippable(bool aRemoveChildlessNodes = false,
|
|||
void nsCycleCollector_dispatchDeferredDeletion(bool aContinuation = false);
|
||||
bool nsCycleCollector_doDeferredDeletion();
|
||||
|
||||
void nsCycleCollector_collect(bool aManuallyTriggered,
|
||||
nsICycleCollectorListener *aManualListener);
|
||||
void nsCycleCollector_collect(nsICycleCollectorListener *aManualListener);
|
||||
void nsCycleCollector_scheduledCollect();
|
||||
|
||||
uint32_t nsCycleCollector_suspectedCount();
|
||||
void nsCycleCollector_shutdown();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче