Bug 721420 - WantAllTraces should disable Skippable CC optimizations. r=smaug
authorAndrew McCreight <amccreight@mozilla.com>
Sun, 29 Jan 2012 16:45:08 -0800
changeset 85688 1725d83e893a7c06f8b1d17d1b1d3f360d4e5af6
parent 85687 1f0c0a016330d2046b5250f769189fc626188139
child 85689 a4045a049e9efd60c4c776871034a0c2d15f51fa
push id21946
push usermak77@bonardo.net
push dateMon, 30 Jan 2012 10:32:39 +0000
treeherdermozilla-central@bfeeb813aef2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs721420
milestone12.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 721420 - WantAllTraces should disable Skippable CC optimizations. r=smaug
xpcom/base/nsCycleCollector.cpp
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -1730,17 +1730,17 @@ GCGraphBuilder::NoteRoot(PRUint32 langID
 {
     NS_ASSERTION(root, "Don't add a null root!");
 
     if (langID > nsIProgrammingLanguage::MAX || !mRuntimes[langID]) {
         Fault("adding root for unregistered language", root);
         return;
     }
 
-    if (!participant->CanSkipThis(root)) {
+    if (!participant->CanSkipThis(root) || WantAllTraces()) {
         AddNode(root, participant, langID);
     }
 }
 
 NS_IMETHODIMP_(void)
 GCGraphBuilder::DescribeRefCountedNode(nsrefcnt refCount, size_t objSz,
                                        const char *objName)
 {
@@ -1786,17 +1786,17 @@ GCGraphBuilder::NoteXPCOMChild(nsISuppor
 
 #ifdef DEBUG_CC
     if (nsCycleCollector_shouldSuppress(child))
         return;
 #endif
     
     nsXPCOMCycleCollectionParticipant *cp;
     ToParticipant(child, &cp);
-    if (cp && !cp->CanSkipThis(child)) {
+    if (cp && (!cp->CanSkipThis(child) || WantAllTraces())) {
 
         PtrInfo *childPi = AddNode(child, cp, nsIProgrammingLanguage::CPLUSPLUS);
         if (!childPi)
             return;
         mEdgeBuilder.Add(childPi);
 #ifdef DEBUG_CC
         mCurrPi->mEdgeNames.AppendElement(edgeName);
 #endif
@@ -1920,17 +1920,17 @@ AddPurpleRoot(GCGraphBuilder &builder, n
 {
     root = canonicalize(root);
     NS_ASSERTION(root,
                  "Don't add objects that don't participate in collection!");
 
     nsXPCOMCycleCollectionParticipant *cp;
     ToParticipant(root, &cp);
 
-    if (!cp->CanSkipInCC(root)) {
+    if (builder.WantAllTraces() || !cp->CanSkipInCC(root)) {
         PtrInfo *pinfo = builder.AddNode(root, cp,
                                          nsIProgrammingLanguage::CPLUSPLUS);
         if (!pinfo) {
             return false;
         }
     }
 
     cp->UnmarkPurple(root);
@@ -3727,17 +3727,23 @@ public:
     {
         NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
     }
 
     PRUint32 Collect(nsICycleCollectorListener* aListener)
     {
         NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
 
-        mCollector->GCIfNeeded(false);
+        // On a WantAllTraces CC, force a synchronous global GC to prevent
+        // hijinks from ForgetSkippable and compartmental GCs.
+        bool wantAllTraces = false;
+        if (aListener) {
+            aListener->GetWantAllTraces(&wantAllTraces);
+        }
+        mCollector->GCIfNeeded(wantAllTraces);
 
         MutexAutoLock autoLock(mLock);
 
         if (!mRunning)
             return 0;
 
         nsAutoTArray<PtrInfo*, 4000> whiteNodes;
         if (!mCollector->PrepareForCollection(&whiteNodes))