Bug 1087799, part 1 - Loosen the invariant in nsCycleCollector::FinishAnyCurrentCollection(). r=smaug

If an Unlink() method ends up running JS, it can cause a GC, which will make us reenter the CC,
which will not do anything because we're already in a CC. Therefore, FinishAnyCurrentCollection()
won't finish the CC. This is safe because the CC only touches things it actually holds alive via
the Root() method.
This commit is contained in:
Andrew McCreight 2014-10-24 15:06:55 -07:00
parent 36e7a0430f
commit 14343f4a96

View File

@ -3673,7 +3673,10 @@ nsCycleCollector::FinishAnyCurrentCollection()
PrintPhase("FinishAnyCurrentCollection");
// Use SliceCC because we only want to finish the CC in progress.
Collect(SliceCC, unlimitedBudget, nullptr);
MOZ_ASSERT(mIncrementalPhase == IdlePhase);
MOZ_ASSERT(mIncrementalPhase == IdlePhase ||
(mIncrementalPhase == ScanAndCollectWhitePhase && mActivelyCollecting),
"FinishAnyCurrentCollection should finish the collection, unless we've reentered the CC during unlinking");
}
// Don't merge too many times in a row, and do at least a minimum