Bug 866681, part 1 - Track if any slice of CC was manually triggered. r=smaug
authorAndrew McCreight <continuation@gmail.com>
Wed, 13 May 2015 12:48:52 -0700
changeset 274524 8e75b3eb23f44c52b6e22e2783bee7aba10c2823
parent 274523 64ed22c327ff1329ede1f96410a67727982b5107
child 274525 7fcf6bf43eda78d42b098cc2b24c032ebd29b34e
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs866681
milestone41.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 866681, part 1 - Track if any slice of CC was manually triggered. r=smaug
xpcom/base/CycleCollectedJSRuntime.h
xpcom/base/nsCycleCollector.cpp
--- a/xpcom/base/CycleCollectedJSRuntime.h
+++ b/xpcom/base/CycleCollectedJSRuntime.h
@@ -97,28 +97,30 @@ struct CycleCollectorResults
     // not using uninitialized memory.
     Init();
   }
 
   void Init()
   {
     mForcedGC = false;
     mMergedZones = false;
+    mAnyManual = false;
     mVisitedRefCounted = 0;
     mVisitedGCed = 0;
     mFreedRefCounted = 0;
     mFreedGCed = 0;
     mFreedJSZones = 0;
     mNumSlices = 1;
     // mNumSlices is initialized to one, because we call Init() after the
     // per-slice increment of mNumSlices has already occurred.
   }
 
   bool mForcedGC;
   bool mMergedZones;
+  bool mAnyManual; // true if any slice of the CC was manually triggered, or at shutdown.
   uint32_t mVisitedRefCounted;
   uint32_t mVisitedGCed;
   uint32_t mFreedRefCounted;
   uint32_t mFreedGCed;
   uint32_t mFreedJSZones;
   uint32_t mNumSlices;
 };
 
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -3589,16 +3589,20 @@ nsCycleCollector::Collect(ccType aCCType
   // If the CC started idle, it will call BeginCollection, which
   // will do FreeSnowWhite, so it doesn't need to be done here.
   if (!startedIdle) {
     TimeLog timeLog;
     FreeSnowWhite(true);
     timeLog.Checkpoint("Collect::FreeSnowWhite");
   }
 
+  if (aCCType != SliceCC) {
+    mResults.mAnyManual = true;
+  }
+
   ++mResults.mNumSlices;
 
   bool continueSlice = aBudget.isUnlimited() || !aPreferShorterSlices;
   do {
     switch (mIncrementalPhase) {
       case IdlePhase:
         PrintPhase("BeginCollection");
         BeginCollection(aCCType, aManualListener);
@@ -3774,16 +3778,17 @@ nsCycleCollector::BeginCollection(ccType
 
   if (mListener && NS_FAILED(mListener->Begin())) {
     mListener = nullptr;
   }
 
   // Set up the data structures for building the graph.
   mGraph.Init();
   mResults.Init();
+  mResults.mAnyManual = (aCCType != SliceCC);
   bool mergeZones = ShouldMergeZones(aCCType);
   mResults.mMergedZones = mergeZones;
 
   MOZ_ASSERT(!mBuilder, "Forgot to clear mBuilder");
   mBuilder = new CCGraphBuilder(mGraph, mResults, mJSRuntime, mListener,
                                 mergeZones);
 
   if (mJSRuntime) {