author | Andrew McCreight <continuation@gmail.com> |
Tue, 10 Sep 2013 08:56:34 -0700 | |
changeset 146433 | c65a5025b50a820e9d438244d4e014e080d2119d |
parent 146432 | f937dc17e5ac87d6df73ff66b64293acccf839d8 |
child 146434 | 41888e2e355d03b369e14a59084b01a44450fdaa |
push id | 25260 |
push user | ryanvm@gmail.com |
push date | Wed, 11 Sep 2013 00:29:30 +0000 |
treeherder | mozilla-central@f73bed2856a8 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | smaug |
bugs | 913527 |
milestone | 26.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -976,26 +976,23 @@ private: void ShutdownCollect(nsICycleCollectorListener *aListener); public: bool Collect(ccType aCCType, nsTArray<PtrInfo*> *aWhiteNodes, nsCycleCollectorResults *aResults, nsICycleCollectorListener *aListener); - // Prepare for and cleanup after one or more collection(s). bool PrepareForCollection(nsCycleCollectorResults *aResults, nsTArray<PtrInfo*> *aWhiteNodes); void FixGrayBits(bool aForceGC); bool ShouldMergeZones(ccType aCCType); void CleanupAfterCollection(); - // Start and finish an individual collection. void BeginCollection(ccType aCCType, nsICycleCollectorListener *aListener); - bool FinishCollection(nsICycleCollectorListener *aListener); bool FreeSnowWhite(bool aUntilNoSWInPurpleBuffer); uint32_t SuspectedCount(); void Shutdown(); void ClearGraph() { @@ -2312,17 +2309,17 @@ nsCycleCollector::CollectWhite(nsICycleC // - Root(whites), which should pin the whites in memory. // - Unlink(whites), which drops outgoing links on each white. // - Unroot(whites), which returns the whites to normal GC. nsresult rv; TimeLog timeLog; MOZ_ASSERT(mWhiteNodes->IsEmpty(), - "FinishCollection wasn't called?"); + "CleanupAfterCollection wasn't called?"); mWhiteNodes->SetCapacity(mWhiteNodeCount); uint32_t numWhiteGCed = 0; NodePool::Enumerator etor(mGraph.mNodes); while (!etor.IsDone()) { PtrInfo *pinfo = etor.GetNext(); @@ -2628,17 +2625,19 @@ nsCycleCollector::PrepareForCollection(n timeLog.Checkpoint("PrepareForCollection()"); return true; } void nsCycleCollector::CleanupAfterCollection() { + mWhiteNodes->Clear(); mWhiteNodes = nullptr; + ClearGraph(); mCollectionInProgress = false; #ifdef XP_OS2 // Now that the cycle collector has freed some memory, we can try to // force the C library to give back as much memory to the system as // possible. _heapmin(); #endif @@ -2702,17 +2701,17 @@ nsCycleCollector::Collect(ccType aCCType FreeSnowWhite(true); if (aListener && NS_FAILED(aListener->Begin())) { aListener = nullptr; } BeginCollection(aCCType, aListener); - bool collectedAny = FinishCollection(aListener); + bool collectedAny = CollectWhite(aListener); CleanupAfterCollection(); return collectedAny; } // Don't merge too many times in a row, and do at least a minimum // number of unmerged CCs in a row. static const uint32_t kMinConsecutiveUnmerged = 3; static const uint32_t kMaxConsecutiveMerged = 3; @@ -2796,30 +2795,16 @@ nsCycleCollector::BeginCollection(ccType } } } } else { mScanInProgress = false; } } -bool -nsCycleCollector::FinishCollection(nsICycleCollectorListener *aListener) -{ - TimeLog timeLog; - bool collected = CollectWhite(aListener); - timeLog.Checkpoint("CollectWhite()"); - - mWhiteNodes->Clear(); - ClearGraph(); - timeLog.Checkpoint("ClearGraph()"); - - return collected; -} - uint32_t nsCycleCollector::SuspectedCount() { CheckThreadSafety(); return mPurpleBuf.Count(); } void