Bug 1546874 - Propagate OOM status from x86 assembler buffer. r=nbp
authorLars T Hansen <lhansen@mozilla.com>
Thu, 25 Apr 2019 14:49:52 +0200
changeset 530262 1ac79bd52a1106f850bc78af12c964cba0d3af5c
parent 530261 da2a8881bec105a4ba75ff77a9e61300c1b6141c
child 530263 7d47e7fa2489550ffa83aae67715c5497048923f
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1546874
milestone68.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 1546874 - Propagate OOM status from x86 assembler buffer. r=nbp This copies the mechanism that was introduced for ARM into the x86 code: it uses a flag on the jitcontext, if present, to propagate the OOM flag so that we won't assert in ~Label. Differential Revision: https://phabricator.services.mozilla.com/D28829
js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h
--- a/js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h
+++ b/js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h
@@ -29,16 +29,17 @@
 
 #ifndef jit_x86_shared_AssemblerBuffer_x86_shared_h
 #define jit_x86_shared_AssemblerBuffer_x86_shared_h
 
 #include <stdarg.h>
 #include <string.h>
 
 #include "jit/ExecutableAllocator.h"
+#include "jit/Ion.h"
 #include "jit/JitSpewer.h"
 
 // Spew formatting helpers.
 #define PRETTYHEX(x)      \
   (((x) < 0) ? "-" : ""), \
       ((unsigned)((x) ^ ((x) >> 31)) + ((unsigned)(x) >> 31))
 
 #define MEM_o "%s0x%x"
@@ -188,16 +189,22 @@ class AssemblerBuffer {
    * can continue assembling into the buffer, deferring OOM checking
    * until the user wants to read code out of the buffer.
    *
    * See also the |buffer| method.
    */
   void oomDetected() {
     m_oom = true;
     m_buffer.clear();
+#ifdef DEBUG
+    JitContext* context = MaybeGetJitContext();
+    if (context) {
+      context->setOOM();
+    }
+#endif
   }
 
   mozilla::Vector<unsigned char, 256, AssemblerBufferAllocPolicy> m_buffer;
   bool m_oom;
 };
 
 class GenericAssembler {
 #ifdef JS_JITSPEW