From: jkummerow@chromium.org Date: Tue, 16 Apr 2013 12:16:55 +0000 (+0000) Subject: Handle OOM failures correctly in the CEntryStub when embedders set V8::IgnoreOutOfMem... X-Git-Tag: upstream/4.7.83~14573 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fbe1a9e3c13ed657b9933fdf5510d28b78a910c9;p=platform%2Fupstream%2Fv8.git 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 --- diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc index 3e63741..1db4152 100644 --- a/src/arm/code-stubs-arm.cc +++ b/src/arm/code-stubs-arm.cc @@ -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 diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc index 8d28c9c..05dceb7 100644 --- a/src/ia32/code-stubs-ia32.cc +++ b/src/ia32/code-stubs-ia32.cc @@ -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); diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc index b43d583..349adc5 100644 --- a/src/x64/code-stubs-x64.cc +++ b/src/x64/code-stubs-x64.cc @@ -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);