Bug 1132888 part 2 - Prevent spewers from consuming almost all the ballast space. r=h4writer
☠☠ backed out by 9c43bca082b7 ☠ ☠
authorNicolas B. Pierron <nicolas.b.pierron@mozilla.com>
Fri, 04 Nov 2016 14:02:47 +0000
changeset 347719 5e2739dedc3a6633468e68427aa2c3d750ce0f81
parent 347718 e4b1a95a7f3997e90a1e278b82b17140ec235af8
child 347720 f596578a143e02a187656ff938db143208d4ceb8
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersh4writer
bugs1132888
milestone52.0a1
Bug 1132888 part 2 - Prevent spewers from consuming almost all the ballast space. r=h4writer
js/src/jit/JitSpewer.cpp
--- a/js/src/jit/JitSpewer.cpp
+++ b/js/src/jit/JitSpewer.cpp
@@ -16,16 +16,17 @@
 # include <unistd.h>
 #endif
 
 #include "jsprf.h"
 
 #include "jit/Ion.h"
 #include "jit/MIR.h"
 #include "jit/MIRGenerator.h"
+#include "jit/MIRGraph.h"
 
 #include "threading/LockGuard.h"
 
 #include "vm/HelperThreads.h"
 #include "vm/MutexIDs.h"
 
 #ifndef JIT_SPEW_DIR
 # if defined(_WIN32)
@@ -297,16 +298,23 @@ GraphSpewer::spewPass(const char* pass)
     c1Spewer_.spewPass(pass);
 
     jsonSpewer_.beginPass(pass);
     jsonSpewer_.spewMIR(graph_);
     jsonSpewer_.spewLIR(graph_);
     jsonSpewer_.endPass();
 
     ionspewer.spewPass(this);
+
+    // As this function is used for debugging, we ignore any of the previous
+    // failures and ensure there is enough ballast space, such that we do not
+    // exhaust the ballast space before running the next phase.
+    AutoEnterOOMUnsafeRegion oomUnsafe;
+    if (!graph_->alloc().ensureBallast())
+        oomUnsafe.crash("Could not ensure enough ballast space after spewing graph information.");
 }
 
 void
 GraphSpewer::spewPass(const char* pass, BacktrackingAllocator* ra)
 {
     if (!isSpewing())
         return;