Bug 1171909 - Check for alloc failure initializing AssemblerBufferWithConstantPools and update error handling ExceptionHandlerBailout r=jandem

This commit is contained in:
Jon Coppeard 2015-07-13 11:31:20 +01:00
parent ee75b8af17
commit 676d9ffdfd
3 changed files with 15 additions and 9 deletions

View File

@ -0,0 +1,3 @@
// |jit-test| --no-ggc; allow-unhandlable-oom
load(libdir + 'oomTest.js');
oomTest((function(x) { assertEq(x + y + ex, 25); }));

View File

@ -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.

View File

@ -460,6 +460,10 @@ struct AssemblerBufferWithConstantPools : public AssemblerBuffer<SliceSize, Inst
// MacroAssembler before allocating any space.
void initWithAllocator() {
poolInfo_ = this->lifoAlloc_.template newArrayUninitialized<PoolInfo>(poolInfoSize_);
if (!poolInfo_) {
this->fail_oom();
return;
}
new (&pool_) Pool (poolMaxOffset_, pcBias_, this->lifoAlloc_);
if (pool_.poolData() == nullptr)