From 4b50adaf9a9e98487b758b248b77a7cd72e6c7d4 Mon Sep 17 00:00:00 2001 From: "yangguo@chromium.org" Date: Tue, 12 Jun 2012 06:15:59 +0000 Subject: [PATCH] MIPS: Reland r11753: Fix try..finally. Port r11762 (4fdbdd7a) BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/10545121 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11768 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/mips/full-codegen-mips.cc | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc index 3ed794a..53a6732 100644 --- a/src/mips/full-codegen-mips.cc +++ b/src/mips/full-codegen-mips.cc @@ -4529,14 +4529,55 @@ void FullCodeGenerator::EnterFinallyBlock() { ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); STATIC_ASSERT(0 == kSmiTag); __ Addu(a1, a1, Operand(a1)); // Convert to smi. + + // Store result register while executing finally block. + __ push(a1); + + // Store pending message while executing finally block. + ExternalReference pending_message_obj = + ExternalReference::address_of_pending_message_obj(isolate()); + __ li(at, Operand(pending_message_obj)); + __ lw(a1, MemOperand(at)); + __ push(a1); + + ExternalReference has_pending_message = + ExternalReference::address_of_has_pending_message(isolate()); + __ li(at, Operand(has_pending_message)); + __ lw(a1, MemOperand(at)); + __ push(a1); + + ExternalReference pending_message_script = + ExternalReference::address_of_pending_message_script(isolate()); + __ li(at, Operand(pending_message_script)); + __ lw(a1, MemOperand(at)); __ push(a1); } void FullCodeGenerator::ExitFinallyBlock() { ASSERT(!result_register().is(a1)); + // Restore pending message from stack. + __ pop(a1); + ExternalReference pending_message_script = + ExternalReference::address_of_pending_message_script(isolate()); + __ li(at, Operand(pending_message_script)); + __ sw(a1, MemOperand(at)); + + __ pop(a1); + ExternalReference has_pending_message = + ExternalReference::address_of_has_pending_message(isolate()); + __ li(at, Operand(has_pending_message)); + __ sw(a1, MemOperand(at)); + + __ pop(a1); + ExternalReference pending_message_obj = + ExternalReference::address_of_pending_message_obj(isolate()); + __ li(at, Operand(pending_message_obj)); + __ sw(a1, MemOperand(at)); + // Restore result register from stack. __ pop(a1); + // Uncook return address and return. __ pop(result_register()); ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); -- 2.7.4