Index: src/compiler/x64/code-generator-x64.cc |
diff --git a/src/compiler/x64/code-generator-x64.cc b/src/compiler/x64/code-generator-x64.cc |
index 413fe635ac211779adc334516e81021a3b73922a..38c7f2a31c90724b3fd39767c07b3801fde1cbc6 100644 |
--- a/src/compiler/x64/code-generator-x64.cc |
+++ b/src/compiler/x64/code-generator-x64.cc |
@@ -48,10 +48,10 @@ |
Operand ToOperand(InstructionOperand* op, int extra = 0) { |
DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); |
- FrameOffset offset = |
- linkage()->GetFrameOffset(AllocatedOperand::cast(op)->index(), frame()); |
- return Operand(offset.from_stack_pointer() ? rsp : rbp, |
- offset.offset() + extra); |
+ // The linkage computes where all spill slots are located. |
+ FrameOffset offset = linkage()->GetFrameOffset( |
+ AllocatedOperand::cast(op)->index(), frame(), extra); |
+ return Operand(offset.from_stack_pointer() ? rsp : rbp, offset.offset()); |
} |
static size_t NextOffset(size_t* offset) { |
@@ -1219,10 +1219,6 @@ |
} else { |
if (instr->InputAt(0)->IsRegister()) { |
__ pushq(i.InputRegister(0)); |
- } else if (instr->InputAt(0)->IsDoubleRegister()) { |
- // TODO(titzer): use another machine instruction? |
- __ subq(rsp, Immediate(kDoubleSize)); |
- __ movsd(Operand(rsp, 0), i.InputDoubleRegister(0)); |
} else { |
__ pushq(i.InputOperand(0)); |
} |
@@ -1558,26 +1554,31 @@ |
} |
} |
__ popq(rbp); // Pop caller's frame pointer. |
+ __ ret(0); |
} else { |
// No saved registers. |
__ movq(rsp, rbp); // Move stack pointer back to frame pointer. |
__ popq(rbp); // Pop caller's frame pointer. |
+ __ ret(0); |
} |
} else if (descriptor->IsJSFunctionCall() || needs_frame_) { |
// Canonicalize JSFunction return sites for now. |
if (return_label_.is_bound()) { |
__ jmp(&return_label_); |
- return; |
} else { |
__ bind(&return_label_); |
__ movq(rsp, rbp); // Move stack pointer back to frame pointer. |
__ popq(rbp); // Pop caller's frame pointer. |
- } |
- } |
- size_t pop_size = descriptor->StackParameterCount() * kPointerSize; |
- // Might need rcx for scratch if pop_size is too big. |
- DCHECK_EQ(0, descriptor->CalleeSavedRegisters() & rcx.bit()); |
- __ Ret(static_cast<int>(pop_size), rcx); |
+ int pop_count = static_cast<int>(descriptor->StackParameterCount()); |
+ if (pop_count == 0) { |
+ __ Ret(); |
+ } else { |
+ __ Ret(pop_count * kPointerSize, rbx); |
+ } |
+ } |
+ } else { |
+ __ Ret(); |
+ } |
} |