Bug 1132888 part 2 - Prevent spewers from consuming almost all the ballast space. r=h4writer
authorNicolas B. Pierron <nicolas.b.pierron@mozilla.com>
Tue, 08 Nov 2016 14:06:38 +0000
changeset 321510 40ae0b40fd73c224b9e1a3b9f187c98aaab523ed
parent 321509 968aa5ce9ed400c45382a2ee0e0140340c03fa4e
child 321511 5c1b90a1926d9210471d5f411ffad85ac9295e5f
push id83626
push usernpierron@mozilla.com
push dateTue, 08 Nov 2016 14:06:58 +0000
treeherdermozilla-inbound@8daddd6054f2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersh4writer
bugs1132888
milestone52.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 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;