Bug 723157 - Call forgetSkippable more often, r=mccr8, a=akeybl
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Wed, 08 Feb 2012 20:03:41 +0200
changeset 88368 2ce0548f5e52cc958d1357e0047d836e1e49a987
parent 88367 36476c9edc645fab23800226d6d5bbfac6eae1a4
child 88369 baeb3c39c4772aec1996fbe7c882ff2841e79f87
push idunknown
push userunknown
push dateunknown
reviewersmccr8, akeybl
bugs723157
milestone12.0a2
Bug 723157 - Call forgetSkippable more often, r=mccr8, a=akeybl
dom/base/nsJSEnvironment.cpp
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -3376,33 +3376,34 @@ CCTimerFired(nsITimer *aTimer, void *aCl
   }
   ++sCCTimerFireCount;
   if (sCCTimerFireCount < (NS_CC_DELAY / NS_CC_SKIPPABLE_DELAY)) {
     PRUint32 suspected = nsCycleCollector_suspectedCount();
     if ((sPreviousSuspectedCount + 100) > suspected) {
       // Just few new suspected objects, return early.
       return;
     }
-    sPreviousSuspectedCount = suspected;
+    
     PRTime startTime;
     if (sPostGCEventsToConsole) {
       startTime = PR_Now();
     }
     nsCycleCollector_forgetSkippable();
+    sPreviousSuspectedCount = nsCycleCollector_suspectedCount();
     sCleanupSinceLastGC = true;
     if (sPostGCEventsToConsole) {
       PRTime delta = PR_Now() - startTime;
       if (sMinForgetSkippableTime > delta) {
         sMinForgetSkippableTime = delta;
       }
       if (sMaxForgetSkippableTime < delta) {
         sMaxForgetSkippableTime = delta;
       }
       sTotalForgetSkippableTime += delta;
-      sRemovedPurples += (suspected - nsCycleCollector_suspectedCount());
+      sRemovedPurples += (suspected - sPreviousSuspectedCount);
       ++sForgetSkippableBeforeCC;
     }
   } else {
     sPreviousSuspectedCount = 0;
     nsJSContext::KillCCTimer();
     if (nsCycleCollector_suspectedCount() > 500 ||
         sLastCCEndTime + NS_CC_FORCED < PR_Now()) {
       nsJSContext::CycleCollectNow();