Index: src/compiler/arm64/code-generator-arm64.cc |
diff --git a/src/compiler/arm64/code-generator-arm64.cc b/src/compiler/arm64/code-generator-arm64.cc |
index 8281b7b13cca6de6494156f7ae850044800a48d4..f80161678630278ecd01c2d224999f529f177c65 100644 |
--- a/src/compiler/arm64/code-generator-arm64.cc |
+++ b/src/compiler/arm64/code-generator-arm64.cc |
@@ -887,6 +887,7 @@ static int AlignedStackSlots(int stack_slots) { |
void CodeGenerator::AssemblePrologue() { |
CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
+ int stack_slots = frame()->GetSpillSlotCount(); |
if (descriptor->kind() == CallDescriptor::kCallAddress) { |
__ SetStackPointer(csp); |
__ Push(lr, fp); |
@@ -900,13 +901,12 @@ void CodeGenerator::AssemblePrologue() { |
__ Prologue(info->IsCodePreAgingActive()); |
frame()->SetRegisterSaveAreaSize( |
StandardFrameConstants::kFixedFrameSizeFromFp); |
- } else { |
+ } else if (stack_slots > 0) { |
__ SetStackPointer(jssp); |
__ StubPrologue(); |
frame()->SetRegisterSaveAreaSize( |
StandardFrameConstants::kFixedFrameSizeFromFp); |
} |
- int stack_slots = frame()->GetSpillSlotCount(); |
if (info()->is_osr()) { |
// TurboFan OSR-compiled functions cannot be entered directly. |
@@ -934,10 +934,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) { |
__ Add(csp, csp, AlignedStackSlots(stack_slots) * kPointerSize); |
} |
@@ -948,7 +948,7 @@ void CodeGenerator::AssembleReturn() { |
__ Mov(csp, fp); |
__ Pop(fp, lr); |
__ Ret(); |
- } else { |
+ } else if (descriptor->IsJSFunctionCall() || stack_slots > 0) { |
__ Mov(jssp, fp); |
__ Pop(fp, lr); |
int pop_count = descriptor->IsJSFunctionCall() |
@@ -956,6 +956,8 @@ void CodeGenerator::AssembleReturn() { |
: 0; |
__ Drop(pop_count); |
__ Ret(); |
+ } else { |
+ __ Ret(); |
} |
} |