Bug 1373663 - Establish non-oom precondition for patching. r=luke, a=jcristau
authorLars T Hansen <lhansen@mozilla.com>
Wed, 21 Jun 2017 12:39:23 +0200
changeset 411721 8987f5c030175b4a1f208672ffbc462c21f206cf
parent 411720 a088ee43f0f0b32a39c7d1daada7883a8b53060b
child 411722 b435b2f239458d25ce54caa2fd4459491faf6c70
push id7445
push userryanvm@gmail.com
push dateFri, 23 Jun 2017 18:41:40 +0000
treeherdermozilla-beta@8e494ed08940 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke, jcristau
bugs1373663
milestone55.0
Bug 1373663 - Establish non-oom precondition for patching. r=luke, a=jcristau
js/src/wasm/WasmBaselineCompile.cpp
--- a/js/src/wasm/WasmBaselineCompile.cpp
+++ b/js/src/wasm/WasmBaselineCompile.cpp
@@ -2336,16 +2336,20 @@ class BaseCompiler
     bool endFunction() {
         // Always branch to stackOverflowLabel_ or returnLabel_.
         masm.breakpoint();
 
         // Patch the add in the prologue so that it checks against the correct
         // frame size. Flush the constant pool in case it needs to be patched.
         MOZ_ASSERT(maxFramePushed_ >= localSize_);
         masm.flush();
+
+        // Precondition for patching.
+        if (masm.oom())
+            return false;
         masm.patchAdd32ToPtr(stackAddOffset_, Imm32(-int32_t(maxFramePushed_ - localSize_)));
 
         // Since we just overflowed the stack, to be on the safe side, pop the
         // stack so that, when the trap exit stub executes, it is a safe
         // distance away from the end of the native stack. If debugEnabled_ is
         // set, we pop all locals space except allocated for DebugFrame to
         // maintain the invariant that, when debugEnabled_, all wasm::Frames
         // are valid wasm::DebugFrames which is observable by WasmHandleThrow.