Bug 935721, part 7 - Inline PrepareForCollection into BeginCollection. r=smaug
authorAndrew McCreight <continuation@gmail.com>
Wed, 20 Nov 2013 14:35:16 -0800
changeset 156695 c3ea0308d733bfb3c44d60652a8d633c4c888279
parent 156694 eedc72464698771e60096e7b024724c4e858ae7d
child 156696 374376d6e85e12a9d9e793706c7573414ee9a283
push id25684
push usercbook@mozilla.com
push dateThu, 21 Nov 2013 13:21:05 +0000
treeherdermozilla-central@7427eede548f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs935721
milestone28.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
Bug 935721, part 7 - Inline PrepareForCollection into BeginCollection. r=smaug PrepareForCollection is trivial now, so just inline it.
xpcom/base/nsCycleCollector.cpp
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -968,18 +968,16 @@ public:
                              size_t *aGraphEdgesSize,
                              size_t *aWeakMapsSize,
                              size_t *aPurpleBufferSize) const;
 
 private:
     void CheckThreadSafety();
     void ShutdownCollect();
 
-    void PrepareForCollection();
-
     void FixGrayBits(bool aForceGC);
     bool ShouldMergeZones(ccType aCCType);
 
     void BeginCollection(ccType aCCType, nsICycleCollectorListener *aManualListener);
     void MarkRoots();
     void ScanRoots();
     void ScanWeakMaps();
 
@@ -2609,32 +2607,16 @@ nsCycleCollector::FixGrayBits(bool aForc
     }
 
     TimeLog timeLog;
     mJSRuntime->Collect(aForceGC ? JS::gcreason::SHUTDOWN_CC : JS::gcreason::CC_FORCED);
     timeLog.Checkpoint("GC()");
 }
 
 void
-nsCycleCollector::PrepareForCollection()
-{
-    TimeLog timeLog;
-
-    mCollectionStart = TimeStamp::Now();
-
-    mCollectionInProgress = true;
-
-    if (mJSRuntime) {
-        mJSRuntime->BeginCycleCollectionCallback();
-    }
-
-    timeLog.Checkpoint("PrepareForCollection()");
-}
-
-void
 nsCycleCollector::CleanupAfterCollection()
 {
     mGraph.Clear();
     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
@@ -2677,17 +2659,16 @@ nsCycleCollector::Collect(ccType aCCType
 {
     CheckThreadSafety();
 
     // This can legitimately happen in a few cases. See bug 383651.
     if (mCollectionInProgress) {
         return false;
     }
 
-    PrepareForCollection();
     BeginCollection(aCCType, aManualListener);
     MarkRoots();
     ScanRoots();
     bool collectedAny = CollectWhite();
     CleanupAfterCollection();
     return collectedAny;
 }
 
@@ -2726,16 +2707,26 @@ nsCycleCollector::ShouldMergeZones(ccTyp
     }
 }
 
 void
 nsCycleCollector::BeginCollection(ccType aCCType,
                                   nsICycleCollectorListener *aManualListener)
 {
     TimeLog timeLog;
+
+    mCollectionStart = TimeStamp::Now();
+
+    mCollectionInProgress = true;
+
+    if (mJSRuntime) {
+        mJSRuntime->BeginCycleCollectionCallback();
+        timeLog.Checkpoint("BeginCycleCollectionCallback()");
+    }
+
     bool isShutdown = (aCCType == ShutdownCC);
 
     // Set up the listener for this CC.
     MOZ_ASSERT_IF(isShutdown, !aManualListener);
     MOZ_ASSERT(!mListener, "Forgot to clear a previous listener?");
     mListener = aManualListener;
     aManualListener = nullptr;
     if (!mListener) {