Chromium Code Reviews| 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 38c7f2a31c90724b3fd39767c07b3801fde1cbc6..a0e4299238496d109b826a1e79e73e425eb19e1f 100644 |
| --- a/src/compiler/x64/code-generator-x64.cc |
| +++ b/src/compiler/x64/code-generator-x64.cc |
| @@ -1219,6 +1219,10 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
| } 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(8)); |
|
Jarin
2015/08/03 10:38:18
Maybe replace 8 with kDoubleSize?
|
| + __ movsd(Operand(rsp, 0), i.InputDoubleRegister(0)); |
| } else { |
| __ pushq(i.InputOperand(0)); |
| } |
| @@ -1554,31 +1558,26 @@ void CodeGenerator::AssembleReturn() { |
| } |
| } |
| __ 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. |
| - int pop_count = static_cast<int>(descriptor->StackParameterCount()); |
| - if (pop_count == 0) { |
| - __ Ret(); |
| - } else { |
| - __ Ret(pop_count * kPointerSize, rbx); |
| - } |
| } |
| - } else { |
| - __ Ret(); |
| } |
| + 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); |
| } |