diff --git a/js/src/jit-test/tests/gc/bug-1171909.js b/js/src/jit-test/tests/gc/bug-1171909.js new file mode 100644 index 00000000000..590c41b7822 --- /dev/null +++ b/js/src/jit-test/tests/gc/bug-1171909.js @@ -0,0 +1,3 @@ +// |jit-test| --no-ggc; allow-unhandlable-oom +load(libdir + 'oomTest.js'); +oomTest((function(x) { assertEq(x + y + ex, 25); })); diff --git a/js/src/jit/Bailouts.cpp b/js/src/jit/Bailouts.cpp index 8807bf7f111..a618c129e16 100644 --- a/js/src/jit/Bailouts.cpp +++ b/js/src/jit/Bailouts.cpp @@ -221,19 +221,18 @@ jit::ExceptionHandlerBailout(JSContext* cx, const InlineFrameIterator& frame, rfe->target = cx->runtime()->jitRuntime()->getBailoutTail()->raw(); rfe->bailoutInfo = bailoutInfo; } else { - // Bailout failed. If there was a fatal error, clear the - // exception to turn this into an uncatchable error. If the - // overrecursion check failed, continue popping all inline - // frames and have the caller report an overrecursion error. + // Bailout failed. If the overrecursion check failed, clear the + // exception to turn this into an uncatchable error, continue popping + // all inline frames and have the caller report the error. MOZ_ASSERT(!bailoutInfo); - if (!excInfo.propagatingIonExceptionForDebugMode()) - cx->clearPendingException(); - - if (retval == BAILOUT_RETURN_OVERRECURSED) + if (retval == BAILOUT_RETURN_OVERRECURSED) { *overrecursed = true; - else + if (!excInfo.propagatingIonExceptionForDebugMode()) + cx->clearPendingException(); + } else { MOZ_ASSERT(retval == BAILOUT_RETURN_FATAL_ERROR); + } } // Make the frame being bailed out the top profiled frame. diff --git a/js/src/jit/shared/IonAssemblerBufferWithConstantPools.h b/js/src/jit/shared/IonAssemblerBufferWithConstantPools.h index 9b8fc7481c1..36a01ff6a08 100644 --- a/js/src/jit/shared/IonAssemblerBufferWithConstantPools.h +++ b/js/src/jit/shared/IonAssemblerBufferWithConstantPools.h @@ -460,6 +460,10 @@ struct AssemblerBufferWithConstantPools : public AssemblerBufferlifoAlloc_.template newArrayUninitialized(poolInfoSize_); + if (!poolInfo_) { + this->fail_oom(); + return; + } new (&pool_) Pool (poolMaxOffset_, pcBias_, this->lifoAlloc_); if (pool_.poolData() == nullptr)