Commit 9e50295a authored by lrn@chromium.org's avatar lrn@chromium.org

X64/Win64: Fix bug in returning ObjectPair.

Used the registers to test for failure before loading the result from the stack.

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


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3119 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e82a07c0
......@@ -6850,6 +6850,15 @@ void CEntryStub::GenerateCore(MacroAssembler* masm,
// Check for failure result.
Label failure_returned;
ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0);
#ifdef _WIN64
// If return value is on the stack, pop it to registers.
if (result_size_ > 1) {
ASSERT_EQ(2, result_size_);
// Position above 4 argument mirrors and arguments object.
__ movq(rax, Operand(rsp, 6 * kPointerSize));
__ movq(rdx, Operand(rsp, 7 * kPointerSize));
}
#endif
__ lea(rcx, Operand(rax, 1));
// Lower 2 bits of rcx are 0 iff rax has failure tag.
__ testl(rcx, Immediate(kFailureTagMask));
......@@ -7707,13 +7716,13 @@ ModuloFunction CreateModuloFunction() {
// Clean up FPU stack and exceptions and return xmm0
__ bind(&return_result);
__ fstp(0); // Unload y.
{
Label no_exceptions;
__ testb(rax, Immediate(0x3f /* Any Exception*/));
__ j(zero, &no_exceptions);
__ fnclex();
__ bind(&no_exceptions);
}
Label clear_exceptions;
__ testb(rax, Immediate(0x3f /* Any Exception*/));
__ j(not_zero, &clear_exceptions);
__ ret(0);
__ bind(&clear_exceptions);
__ fnclex();
__ ret(0);
CodeDesc desc;
......
......@@ -1880,16 +1880,6 @@ void MacroAssembler::LeaveExitFrame(StackFrame::Type type, int result_size) {
movq(rcx, Operand(rbp, 1 * kPointerSize));
movq(rbp, Operand(rbp, 0 * kPointerSize));
#ifdef _WIN64
// If return value is on the stack, pop it to registers.
if (result_size > 1) {
ASSERT_EQ(2, result_size);
// Position above 4 argument mirrors and arguments object.
movq(rax, Operand(rsp, 6 * kPointerSize));
movq(rdx, Operand(rsp, 7 * kPointerSize));
}
#endif
// Pop everything up to and including the arguments and the receiver
// from the caller stack.
lea(rsp, Operand(r15, 1 * kPointerSize));
......
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