Index: src/compiler/mips/code-generator-mips.cc |
diff --git a/src/compiler/mips/code-generator-mips.cc b/src/compiler/mips/code-generator-mips.cc |
index 3353aabca395226a9a9a13245152be28400cf7f0..8f03f7bbb2b350e682751d47a9519910dd7c4ad0 100644 |
--- a/src/compiler/mips/code-generator-mips.cc |
+++ b/src/compiler/mips/code-generator-mips.cc |
@@ -913,6 +913,7 @@ void CodeGenerator::AssembleDeoptimizerCall(int deoptimization_id) { |
void CodeGenerator::AssemblePrologue() { |
CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
+ int stack_slots = frame()->GetSpillSlotCount(); |
if (descriptor->kind() == CallDescriptor::kCallAddress) { |
__ Push(ra, fp); |
__ mov(fp, sp); |
@@ -932,12 +933,11 @@ void CodeGenerator::AssemblePrologue() { |
__ Prologue(info->IsCodePreAgingActive()); |
frame()->SetRegisterSaveAreaSize( |
StandardFrameConstants::kFixedFrameSizeFromFp); |
- } else { |
+ } else if (stack_slots > 0) { |
__ StubPrologue(); |
frame()->SetRegisterSaveAreaSize( |
StandardFrameConstants::kFixedFrameSizeFromFp); |
} |
- int stack_slots = frame()->GetSpillSlotCount(); |
if (info()->is_osr()) { |
// TurboFan OSR-compiled functions cannot be entered directly. |
@@ -961,10 +961,10 @@ void CodeGenerator::AssemblePrologue() { |
void CodeGenerator::AssembleReturn() { |
CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
+ int stack_slots = frame()->GetSpillSlotCount(); |
if (descriptor->kind() == CallDescriptor::kCallAddress) { |
if (frame()->GetRegisterSaveAreaSize() > 0) { |
// Remove this frame's spill slots first. |
- int stack_slots = frame()->GetSpillSlotCount(); |
if (stack_slots > 0) { |
__ Addu(sp, sp, Operand(stack_slots * kPointerSize)); |
} |
@@ -977,13 +977,15 @@ void CodeGenerator::AssembleReturn() { |
__ mov(sp, fp); |
__ Pop(ra, fp); |
__ Ret(); |
- } else { |
+ } else if (descriptor->IsJSFunctionCall() || stack_slots > 0) { |
__ mov(sp, fp); |
__ Pop(ra, fp); |
int pop_count = descriptor->IsJSFunctionCall() |
? static_cast<int>(descriptor->JSParameterCount()) |
: 0; |
__ DropAndRet(pop_count); |
+ } else { |
+ __ Ret(); |
} |
} |