Handle OOM failures correctly in the CEntryStub when embedders set V8::IgnoreOutOfMemoryException()

BUG=chromium:231217

Review URL: https://codereview.chromium.org/14066009

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14279 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 2e41f0ce
......@@ -3534,11 +3534,18 @@ void CEntryStub::GenerateCore(MacroAssembler* masm,
// Special handling of out of memory exceptions.
JumpIfOOM(masm, r0, ip, throw_out_of_memory_exception);
// Retrieve the pending exception and clear the variable.
__ mov(r3, Operand(isolate->factory()->the_hole_value()));
// Retrieve the pending exception.
__ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress,
isolate)));
__ ldr(r0, MemOperand(ip));
// See if we just retrieved an OOM exception.
JumpIfOOM(masm, r0, ip, throw_out_of_memory_exception);
// Clear the pending exception.
__ mov(r3, Operand(isolate->factory()->the_hole_value()));
__ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress,
isolate)));
__ str(r3, MemOperand(ip));
// Special handling of termination exceptions which are uncatchable
......
......@@ -5065,8 +5065,13 @@ void CEntryStub::GenerateCore(MacroAssembler* masm,
// Special handling of out of memory exceptions.
JumpIfOOM(masm, eax, ecx, throw_out_of_memory_exception);
// Retrieve the pending exception and clear the variable.
// Retrieve the pending exception.
__ mov(eax, Operand::StaticVariable(pending_exception_address));
// See if we just retrieved an OOM exception.
JumpIfOOM(masm, eax, ecx, throw_out_of_memory_exception);
// Clear the pending exception.
__ mov(edx, Immediate(masm->isolate()->factory()->the_hole_value()));
__ mov(Operand::StaticVariable(pending_exception_address), edx);
......
......@@ -4152,12 +4152,19 @@ void CEntryStub::GenerateCore(MacroAssembler* masm,
// Special handling of out of memory exceptions.
JumpIfOOM(masm, rax, kScratchRegister, throw_out_of_memory_exception);
// Retrieve the pending exception and clear the variable.
// Retrieve the pending exception.
ExternalReference pending_exception_address(
Isolate::kPendingExceptionAddress, masm->isolate());
Operand pending_exception_operand =
masm->ExternalOperand(pending_exception_address);
__ movq(rax, pending_exception_operand);
// See if we just retrieved an OOM exception.
JumpIfOOM(masm, rax, kScratchRegister, throw_out_of_memory_exception);
// Clear the pending exception.
pending_exception_operand =
masm->ExternalOperand(pending_exception_address);
__ LoadRoot(rdx, Heap::kTheHoleValueRootIndex);
__ movq(pending_exception_operand, rdx);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment