Bug 1248202 - Handle an OOM case in optimization tracking. r=jandem
authorShu-yu Guo <shu@rfrn.org>
Tue, 16 Feb 2016 14:06:00 +0100
changeset 321880 4b043b29bb042320fa0be83d30aff95ac5903f22
parent 321879 87a62c4c347446c5bf6bcdd1fa4808df3175463b
child 321881 7ab8341b7e7a9f2880309a031722e12cd79488f3
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1248202
milestone47.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 1248202 - Handle an OOM case in optimization tracking. r=jandem
js/src/jit/OptimizationTracking.cpp
--- a/js/src/jit/OptimizationTracking.cpp
+++ b/js/src/jit/OptimizationTracking.cpp
@@ -1053,23 +1053,27 @@ IonBuilder::startTrackingOptimizations()
         BytecodeSite* site = maybeTrackedOptimizationSite(current->trackedSite()->pc());
 
         if (!site) {
             site = current->trackedSite();
             site->setOptimizations(new(alloc()) TrackedOptimizations(alloc()));
             // OOMs are handled as if optimization tracking were turned off.
             if (!trackedOptimizationSites_.append(site))
                 site = nullptr;
-        } else {
+        } else if (site->hasOptimizations()) {
             // The same bytecode may be visited multiple times (see
             // restartLoop). Only the last time matters, so clear any previous
             // tracked optimizations.
             site->optimizations()->clear();
         }
 
+        // The case of !site->hasOptimizations() means we had an OOM when
+        // previously attempting to track optimizations. Leave
+        // site->optimizations_ nullptr to leave optimization tracking off.
+
         if (site)
             current->updateTrackedSite(site);
     }
 }
 
 void
 IonBuilder::trackTypeInfoUnchecked(TrackedTypeSite kind, MIRType mirType,
                                    TemporaryTypeSet* typeSet)