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 f88cd106766c50fa4f3146727e7a7286295841a4..f82ddc3d33ba384d679384d58b609c9e8bc22b86 100644 |
--- a/src/compiler/ia32/code-generator-ia32.cc |
+++ b/src/compiler/ia32/code-generator-ia32.cc |
@@ -1010,7 +1010,7 @@ void CodeGenerator::AssemblePrologue() { |
__ Prologue(info->IsCodePreAgingActive()); |
frame()->SetRegisterSaveAreaSize( |
StandardFrameConstants::kFixedFrameSizeFromFp); |
- } else { |
+ } else if (stack_slots > 0) { |
__ StubPrologue(); |
frame()->SetRegisterSaveAreaSize( |
StandardFrameConstants::kFixedFrameSizeFromFp); |
@@ -1039,11 +1039,11 @@ void CodeGenerator::AssemblePrologue() { |
void CodeGenerator::AssembleReturn() { |
CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
+ int stack_slots = frame()->GetSpillSlotCount(); |
if (descriptor->kind() == CallDescriptor::kCallAddress) { |
const RegList saves = descriptor->CalleeSavedRegisters(); |
if (frame()->GetRegisterSaveAreaSize() > 0) { |
// Remove this frame's spill slots first. |
- int stack_slots = frame()->GetSpillSlotCount(); |
if (stack_slots > 0) { |
__ add(esp, Immediate(stack_slots * kPointerSize)); |
} |
@@ -1062,13 +1062,15 @@ void CodeGenerator::AssembleReturn() { |
__ pop(ebp); // Pop caller's frame pointer. |
__ ret(0); |
} |
- } else { |
+ } else if (descriptor->IsJSFunctionCall() || stack_slots > 0) { |
__ mov(esp, ebp); // Move stack pointer back to frame pointer. |
__ pop(ebp); // Pop caller's frame pointer. |
int pop_count = descriptor->IsJSFunctionCall() |
? static_cast<int>(descriptor->JSParameterCount()) |
: 0; |
__ ret(pop_count * kPointerSize); |
+ } else { |
+ __ ret(0); |
} |
} |