Index: src/compiler/mips64/code-generator-mips64.cc |
diff --git a/src/compiler/mips64/code-generator-mips64.cc b/src/compiler/mips64/code-generator-mips64.cc |
index 01d7f5d8d9fa5d593aedd5a664478d4d60c9f899..8a055a5f5f420bef5f4f363ff0e10db47e18c854 100644 |
--- a/src/compiler/mips64/code-generator-mips64.cc |
+++ b/src/compiler/mips64/code-generator-mips64.cc |
@@ -722,7 +722,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
break; |
} |
case kArchRet: |
- AssembleReturn(); |
+ AssembleReturn(instr->InputAt(0)); |
break; |
case kArchStackPointer: |
__ mov(i.OutputRegister(), sp); |
@@ -2281,8 +2281,7 @@ void CodeGenerator::AssembleConstructFrame() { |
} |
} |
- |
-void CodeGenerator::AssembleReturn() { |
+void CodeGenerator::AssembleReturn(InstructionOperand* pop) { |
CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
// Restore GP registers. |
@@ -2310,6 +2309,15 @@ void CodeGenerator::AssembleReturn() { |
} |
} |
int pop_count = static_cast<int>(descriptor->StackParameterCount()); |
+ MipsOperandConverter g(this, nullptr); |
+ if (pop->IsImmediate()) { |
+ DCHECK_EQ(Constant::kInt32, g.ToConstant(pop).type()); |
+ pop_count += g.ToConstant(pop).ToInt32(); |
+ } else { |
+ Register pop_reg = g.ToRegister(pop); |
+ __ dsll(pop_reg, pop_reg, kPointerSizeLog2); |
+ __ Daddu(sp, sp, pop_reg); |
+ } |
if (pop_count != 0) { |
__ DropAndRet(pop_count); |
} else { |