зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1352430 - Update the GC finalize callback to communicate the new state r=sfink r=mccr8
--HG-- extra : rebase_source : ebd661eee50bbf48f21c12e6a1c6df9015f81beb
This commit is contained in:
Родитель
6b7c3479f2
Коммит
8c75ba5bbb
|
@ -160,15 +160,15 @@ virtual void uninit() override
|
|||
bool checkSingleGroup()
|
||||
{
|
||||
CHECK(FinalizeCalls < BufferSize);
|
||||
CHECK(FinalizeCalls == 3);
|
||||
CHECK(FinalizeCalls == 4);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool checkMultipleGroups()
|
||||
{
|
||||
CHECK(FinalizeCalls < BufferSize);
|
||||
CHECK(FinalizeCalls % 2 == 1);
|
||||
CHECK((FinalizeCalls - 1) / 2 > 1);
|
||||
CHECK(FinalizeCalls % 3 == 1);
|
||||
CHECK((FinalizeCalls - 1) / 3 > 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -180,9 +180,10 @@ bool checkFinalizeStatus()
|
|||
* and then once more with JSFINALIZE_COLLECTION_END.
|
||||
*/
|
||||
|
||||
for (unsigned i = 0; i < FinalizeCalls - 1; i += 2) {
|
||||
CHECK(StatusBuffer[i] == JSFINALIZE_GROUP_START);
|
||||
CHECK(StatusBuffer[i + 1] == JSFINALIZE_GROUP_END);
|
||||
for (unsigned i = 0; i < FinalizeCalls - 1; i += 3) {
|
||||
CHECK(StatusBuffer[i] == JSFINALIZE_GROUP_PREPARE);
|
||||
CHECK(StatusBuffer[i + 1] == JSFINALIZE_GROUP_START);
|
||||
CHECK(StatusBuffer[i + 2] == JSFINALIZE_GROUP_END);
|
||||
}
|
||||
|
||||
CHECK(StatusBuffer[FinalizeCalls - 1] == JSFINALIZE_COLLECTION_END);
|
||||
|
|
|
@ -563,15 +563,20 @@ typedef enum JSFinalizeStatus {
|
|||
/**
|
||||
* Called when preparing to sweep a group of zones, before anything has been
|
||||
* swept. The collector will not yield to the mutator before calling the
|
||||
* callback with JSFINALIZE_GROUP_END status.
|
||||
* callback with JSFINALIZE_GROUP_START status.
|
||||
*/
|
||||
JSFINALIZE_GROUP_PREPARE,
|
||||
|
||||
/**
|
||||
* Called after preparing to sweep a group of zones. Weak references to
|
||||
* unmarked things have been removed at this point, but no GC things have
|
||||
* been swept. The collector may yield to the mutator after this point.
|
||||
*/
|
||||
JSFINALIZE_GROUP_START,
|
||||
|
||||
/**
|
||||
* Called when preparing to sweep a group of zones. Weak references to
|
||||
* unmarked things have been removed and things that are not swept
|
||||
* incrementally have been finalized at this point. The collector may yield
|
||||
* to the mutator after this point.
|
||||
* Called after sweeping a group of zones. All dead GC things have been
|
||||
* swept at this point.
|
||||
*/
|
||||
JSFINALIZE_GROUP_END,
|
||||
|
||||
|
|
|
@ -5130,7 +5130,7 @@ GCRuntime::beginSweepingSweepGroup(AutoLockForExclusiveAccess& lock)
|
|||
|
||||
{
|
||||
gcstats::AutoPhase ap(stats(), gcstats::PHASE_FINALIZE_START);
|
||||
callFinalizeCallbacks(&fop, JSFINALIZE_GROUP_START);
|
||||
callFinalizeCallbacks(&fop, JSFINALIZE_GROUP_PREPARE);
|
||||
{
|
||||
gcstats::AutoPhase ap2(stats(), gcstats::PHASE_WEAK_ZONES_CALLBACK);
|
||||
callWeakPointerZonesCallbacks();
|
||||
|
@ -5142,6 +5142,7 @@ GCRuntime::beginSweepingSweepGroup(AutoLockForExclusiveAccess& lock)
|
|||
callWeakPointerCompartmentCallbacks(comp);
|
||||
}
|
||||
}
|
||||
callFinalizeCallbacks(&fop, JSFINALIZE_GROUP_START);
|
||||
}
|
||||
|
||||
if (sweepingAtoms) {
|
||||
|
@ -5275,16 +5276,17 @@ GCRuntime::beginSweepingSweepGroup(AutoLockForExclusiveAccess& lock)
|
|||
sweepPhaseIndex = 0;
|
||||
sweepZone = currentSweepGroup;
|
||||
sweepActionIndex = 0;
|
||||
|
||||
{
|
||||
gcstats::AutoPhase ap(stats(), gcstats::PHASE_FINALIZE_END);
|
||||
callFinalizeCallbacks(&fop, JSFINALIZE_GROUP_END);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
GCRuntime::endSweepingSweepGroup()
|
||||
{
|
||||
{
|
||||
gcstats::AutoPhase ap(stats(), gcstats::PHASE_FINALIZE_END);
|
||||
FreeOp fop(rt);
|
||||
callFinalizeCallbacks(&fop, JSFINALIZE_GROUP_END);
|
||||
}
|
||||
|
||||
/* Update the GC state for zones we have swept. */
|
||||
for (GCSweepGroupIter zone(rt); !zone.done(); zone.next()) {
|
||||
MOZ_ASSERT(zone->isGCSweeping());
|
||||
|
|
|
@ -813,7 +813,7 @@ XPCJSRuntime::FinalizeCallback(JSFreeOp* fop,
|
|||
return;
|
||||
|
||||
switch (status) {
|
||||
case JSFINALIZE_GROUP_START:
|
||||
case JSFINALIZE_GROUP_PREPARE:
|
||||
{
|
||||
MOZ_ASSERT(!self->mDoingFinalization, "bad state");
|
||||
|
||||
|
@ -821,12 +821,12 @@ XPCJSRuntime::FinalizeCallback(JSFreeOp* fop,
|
|||
self->mGCIsRunning = true;
|
||||
|
||||
self->mDoingFinalization = true;
|
||||
|
||||
break;
|
||||
}
|
||||
case JSFINALIZE_GROUP_END:
|
||||
case JSFINALIZE_GROUP_START:
|
||||
{
|
||||
MOZ_ASSERT(self->mDoingFinalization, "bad state");
|
||||
self->mDoingFinalization = false;
|
||||
|
||||
// Sweep scopes needing cleanup
|
||||
XPCWrappedNativeScope::KillDyingScopes();
|
||||
|
@ -836,6 +836,13 @@ XPCJSRuntime::FinalizeCallback(JSFreeOp* fop,
|
|||
|
||||
break;
|
||||
}
|
||||
case JSFINALIZE_GROUP_END:
|
||||
{
|
||||
MOZ_ASSERT(self->mDoingFinalization, "bad state");
|
||||
self->mDoingFinalization = false;
|
||||
|
||||
break;
|
||||
}
|
||||
case JSFINALIZE_COLLECTION_END:
|
||||
{
|
||||
MOZ_ASSERT(!self->mGCIsRunning, "bad state");
|
||||
|
|
Загрузка…
Ссылка в новой задаче