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
This commit is contained in:
yangguo@chromium.org 2012-06-12 06:15:59 +00:00
parent aed1f49552
commit 4b50adaf9a

View File

@ -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);