Commit f2faaa5c authored by whesse@chromium.org's avatar whesse@chromium.org

X64: Add missing pop when calling handler with Out-of-memory exception.

Review URL: http://codereview.chromium.org/160520

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2618 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4fa5fc4f
...@@ -6434,22 +6434,23 @@ void CEntryStub::GenerateThrowOutOfMemory(MacroAssembler* masm) { ...@@ -6434,22 +6434,23 @@ void CEntryStub::GenerateThrowOutOfMemory(MacroAssembler* masm) {
// Fetch top stack handler. // Fetch top stack handler.
ExternalReference handler_address(Top::k_handler_address); ExternalReference handler_address(Top::k_handler_address);
__ movq(kScratchRegister, handler_address); __ movq(kScratchRegister, handler_address);
__ movq(rdx, Operand(kScratchRegister, 0)); __ movq(rsp, Operand(kScratchRegister, 0));
// Unwind the handlers until the ENTRY handler is found. // Unwind the handlers until the ENTRY handler is found.
Label loop, done; Label loop, done;
__ bind(&loop); __ bind(&loop);
// Load the type of the current stack handler. // Load the type of the current stack handler.
__ cmpq(Operand(rdx, StackHandlerConstants::kStateOffset), __ cmpq(Operand(rsp, StackHandlerConstants::kStateOffset),
Immediate(StackHandler::ENTRY)); Immediate(StackHandler::ENTRY));
__ j(equal, &done); __ j(equal, &done);
// Fetch the next handler in the list. // Fetch the next handler in the list.
__ movq(rdx, Operand(rdx, StackHandlerConstants::kNextOffset)); ASSERT(StackHandlerConstants::kNextOffset == 0);
__ pop(rsp);
__ jmp(&loop); __ jmp(&loop);
__ bind(&done); __ bind(&done);
// Set the top handler address to next handler past the current ENTRY handler. // Set the top handler address to next handler past the current ENTRY handler.
__ movq(rax, Operand(rdx, StackHandlerConstants::kNextOffset)); __ pop(rax);
__ store_rax(handler_address); __ store_rax(handler_address);
// Set external caught exception to false. // Set external caught exception to false.
...@@ -6462,14 +6463,12 @@ void CEntryStub::GenerateThrowOutOfMemory(MacroAssembler* masm) { ...@@ -6462,14 +6463,12 @@ void CEntryStub::GenerateThrowOutOfMemory(MacroAssembler* masm) {
ExternalReference pending_exception(Top::k_pending_exception_address); ExternalReference pending_exception(Top::k_pending_exception_address);
__ store_rax(pending_exception); __ store_rax(pending_exception);
// Restore the stack to the address of the ENTRY handler
__ movq(rsp, rdx);
// Clear the context pointer; // Clear the context pointer;
__ xor_(rsi, rsi); __ xor_(rsi, rsi);
// Restore registers from handler. // Restore registers from handler.
ASSERT_EQ(StackHandlerConstants::kNextOffset + kPointerSize,
StackHandlerConstants::kFPOffset);
__ pop(rbp); // FP __ pop(rbp); // FP
ASSERT_EQ(StackHandlerConstants::kFPOffset + kPointerSize, ASSERT_EQ(StackHandlerConstants::kFPOffset + kPointerSize,
StackHandlerConstants::kStateOffset); StackHandlerConstants::kStateOffset);
......
...@@ -88,7 +88,7 @@ static ByteMnemonic two_operands_instr[] = { ...@@ -88,7 +88,7 @@ static ByteMnemonic two_operands_instr[] = {
{ 0x39, OPER_REG_OP_ORDER, "cmp" }, { 0x39, OPER_REG_OP_ORDER, "cmp" },
{ 0x3A, BYTE_REG_OPER_OP_ORDER, "cmp" }, { 0x3A, BYTE_REG_OPER_OP_ORDER, "cmp" },
{ 0x3B, REG_OPER_OP_ORDER, "cmp" }, { 0x3B, REG_OPER_OP_ORDER, "cmp" },
{ 0x8D, REG_OPER_OP_ORDER, "lea" }, { 0x63, REG_OPER_OP_ORDER, "movsxlq" },
{ 0x84, BYTE_REG_OPER_OP_ORDER, "test" }, { 0x84, BYTE_REG_OPER_OP_ORDER, "test" },
{ 0x85, REG_OPER_OP_ORDER, "test" }, { 0x85, REG_OPER_OP_ORDER, "test" },
{ 0x86, BYTE_REG_OPER_OP_ORDER, "xchg" }, { 0x86, BYTE_REG_OPER_OP_ORDER, "xchg" },
...@@ -97,6 +97,7 @@ static ByteMnemonic two_operands_instr[] = { ...@@ -97,6 +97,7 @@ static ByteMnemonic two_operands_instr[] = {
{ 0x89, OPER_REG_OP_ORDER, "mov" }, { 0x89, OPER_REG_OP_ORDER, "mov" },
{ 0x8A, BYTE_REG_OPER_OP_ORDER, "mov" }, { 0x8A, BYTE_REG_OPER_OP_ORDER, "mov" },
{ 0x8B, REG_OPER_OP_ORDER, "mov" }, { 0x8B, REG_OPER_OP_ORDER, "mov" },
{ 0x8D, REG_OPER_OP_ORDER, "lea" },
{ -1, UNSET_OP_ORDER, "" } { -1, UNSET_OP_ORDER, "" }
}; };
......
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