Bug 1367496 - Add more release asserts to the cycle collector. r=smaug draft
authorAndrew McCreight <continuation@gmail.com>
Wed, 24 May 2017 10:13:02 -0700
changeset 583808 02a9377cec54cbed103d4365d8ec80ea87834263
parent 582447 8f4d2d35cb317235f30f4e3738ad3df16d2f9f3f
child 630214 58ba2696fa3eaf2f943487ab7c41b6174a86241c
push id60558
push userbmo:continuation@gmail.com
push dateWed, 24 May 2017 17:22:10 +0000
reviewerssmaug
bugs1367496
milestone55.0a1
Bug 1367496 - Add more release asserts to the cycle collector. r=smaug A previous bug missed a few places where we could theoretically reenter the CC. MozReview-Commit-ID: I0otlAEwyZa
xpcom/base/nsCycleCollector.cpp
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -3539,16 +3539,17 @@ nsCycleCollector::FinishAnyIncrementalGC
   }
 }
 
 void
 nsCycleCollector::CleanupAfterCollection()
 {
   TimeLog timeLog;
   MOZ_ASSERT(mIncrementalPhase == CleanupPhase);
+  MOZ_RELEASE_ASSERT(!mScanInProgress);
   mGraph.Clear();
   timeLog.Checkpoint("CleanupAfterCollection::mGraph.Clear()");
 
   uint32_t interval =
     (uint32_t)((TimeStamp::Now() - mCollectionStart).ToMilliseconds());
 #ifdef COLLECT_TIME_DEBUG
   printf("cc: total cycle collector time was %ums in %u slices\n", interval,
          mResults.mNumSlices);
@@ -3779,16 +3780,17 @@ nsCycleCollector::ShouldMergeZones(ccTyp
 }
 
 void
 nsCycleCollector::BeginCollection(ccType aCCType,
                                   nsICycleCollectorListener* aManualListener)
 {
   TimeLog timeLog;
   MOZ_ASSERT(IsIdle());
+  MOZ_RELEASE_ASSERT(!mScanInProgress);
 
   mCollectionStart = TimeStamp::Now();
 
   if (mCCJSRuntime) {
     mCCJSRuntime->BeginCycleCollectionCallback();
     timeLog.Checkpoint("BeginCycleCollectionCallback()");
   }