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
This commit is contained in:
lrn@chromium.org 2009-10-23 10:53:20 +00:00
parent e82a07c0bd
commit 9e50295ad2
2 changed files with 16 additions and 17 deletions

View File

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

View File

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