Index: src/compiler/ia32/code-generator-ia32.cc |
diff --git a/src/compiler/ia32/code-generator-ia32.cc b/src/compiler/ia32/code-generator-ia32.cc |
index 298627b55bd35dfb1ba40d35da6b49fa16eca1f6..7b70f21babb3846c8088304abb5879d6f5d10e41 100644 |
--- a/src/compiler/ia32/code-generator-ia32.cc |
+++ b/src/compiler/ia32/code-generator-ia32.cc |
@@ -46,10 +46,10 @@ class IA32OperandConverter : public InstructionOperandConverter { |
return Operand(ToDoubleRegister(op)); |
} |
DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); |
- // 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() ? esp : ebp, offset.offset()); |
+ FrameOffset offset = |
+ linkage()->GetFrameOffset(AllocatedOperand::cast(op)->index(), frame()); |
+ return Operand(offset.from_stack_pointer() ? esp : ebp, |
+ offset.offset() + extra); |
} |
Operand HighOperand(InstructionOperand* op) { |
@@ -1325,31 +1325,26 @@ void CodeGenerator::AssembleReturn() { |
} |
} |
__ pop(ebp); // Pop caller's frame pointer. |
- __ ret(0); |
} else { |
// No saved registers. |
__ mov(esp, ebp); // Move stack pointer back to frame pointer. |
__ pop(ebp); // 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_); |
__ mov(esp, ebp); // Move stack pointer back to frame pointer. |
__ pop(ebp); // Pop caller's frame pointer. |
- int pop_count = static_cast<int>(descriptor->StackParameterCount()); |
- if (pop_count == 0) { |
- __ ret(0); |
- } else { |
- __ Ret(pop_count * kPointerSize, ebx); |
- } |
} |
- } else { |
- __ ret(0); |
} |
+ size_t pop_size = descriptor->StackParameterCount() * kPointerSize; |
+ // Might need ecx for scratch if pop_size is too big. |
+ DCHECK_EQ(0, descriptor->CalleeSavedRegisters() & ecx.bit()); |
+ __ Ret(static_cast<int>(pop_size), ecx); |
} |