Merge m-c to birch.
authorRyan VanderMeulen <ryanvm@gmail.com>
Fri, 19 Jul 2013 09:53:09 -0400
changeset 139154 7b2c82ae98dbd9dcefbfa593be7fa7ae7ef8cbe9
parent 139153 0e64f7227bb74e84171138ce171419b5939da341 (current diff)
parent 139135 91168463eaf283b5b20c0a500017489bc5fa9ce3 (diff)
child 139248 0983f1a0961ceb4edf9012650393648d44773cd0
child 139252 50c15e19fb09b544393ce487dde9ae4da35fcf52
child 145688 1555f551eff6f584fc42224e59e64e1b3818b8c1
push id1890
push userryanvm@gmail.com
push dateFri, 19 Jul 2013 17:44:21 +0000
treeherderfx-team@20848adc9980 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone25.0a1
Merge m-c to birch.
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -3022,16 +3022,19 @@ DOMGCSliceCallback(JSRuntime *aRt, JS::G
     sCCLockedOut = true;
     nsJSContext::KillShrinkGCBuffersTimer();
   } else if (aProgress == JS::GC_CYCLE_END) {
     sCCLockedOut = false;
   }
 
   // The GC has more work to do, so schedule another GC slice.
   if (aProgress == JS::GC_SLICE_END) {
+    if (ShouldTriggerCC(nsCycleCollector_suspectedCount())) {
+      nsCycleCollector_dispatchDeferredDeletion();
+    }
     nsJSContext::KillInterSliceGCTimer();
     if (!sShuttingDown) {
       CallCreateInstance("@mozilla.org/timer;1", &sInterSliceGCTimer);
       sInterSliceGCTimer->InitWithFuncCallback(InterSliceGCTimerFired,
                                                NULL,
                                                NS_INTERSLICE_GC_DELAY,
                                                nsITimer::TYPE_ONE_SHOT);
     }
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -2153,17 +2153,25 @@ struct SnowWhiteObject
   nsCycleCollectingAutoRefCnt* mRefCnt;
 };
 
 class SnowWhiteKiller
 {
 public:
     SnowWhiteKiller(uint32_t aMaxCount)
     {
-        mObjects.SetCapacity(aMaxCount);
+        while (true) {
+            if (mObjects.SetCapacity(aMaxCount)) {
+                break;
+            }
+            if (aMaxCount == 1) {
+                NS_RUNTIMEABORT("Not enough memory to even delete objects!");
+            }
+            aMaxCount /= 2;
+        }
     }
 
     ~SnowWhiteKiller()
     {
         for (uint32_t i = 0; i < mObjects.Length(); ++i) {
             SnowWhiteObject& o = mObjects[i];
             if (!o.mRefCnt->get() && !o.mRefCnt->IsInPurpleBuffer()) {
                 o.mRefCnt->stabilizeForDeletion();
@@ -2176,27 +2184,28 @@ public:
     Visit(nsPurpleBuffer& aBuffer, nsPurpleBufferEntry* aEntry)
     {
         MOZ_ASSERT(aEntry->mObject, "Null object in purple buffer");
         if (!aEntry->mRefCnt->get()) {
             void *o = aEntry->mObject;
             nsCycleCollectionParticipant *cp = aEntry->mParticipant;
             CanonicalizeParticipant(&o, &cp);
             SnowWhiteObject swo = { o, cp, aEntry->mRefCnt };
-            mObjects.AppendElement(swo);
-            aBuffer.Remove(aEntry);
+            if (mObjects.AppendElement(swo)) {
+                aBuffer.Remove(aEntry);
+            }
         }
     }
 
     bool HasSnowWhiteObjects()
     {
       return mObjects.Length() > 0;
     }
 private:
-    nsTArray<SnowWhiteObject> mObjects;
+    FallibleTArray<SnowWhiteObject> mObjects;
 };
 
 class RemoveSkippableVisitor : public SnowWhiteKiller
 {
 public:
     RemoveSkippableVisitor(uint32_t aMaxCount, bool aRemoveChildlessNodes,
                            CC_ForgetSkippableCallback aCb)
         : SnowWhiteKiller(aMaxCount),