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 12d3e75a05e193f874cc01e6babdebd79559d731..1648c5270758ccd02d4c1c5c278323809fe3c3cd 100644 |
--- a/src/compiler/mips/code-generator-mips.cc |
+++ b/src/compiler/mips/code-generator-mips.cc |
@@ -713,7 +713,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
break; |
} |
case kArchRet: |
- AssembleReturn(); |
+ AssembleReturn(instr->InputAt(0)); |
break; |
case kArchStackPointer: |
__ mov(i.OutputRegister(), sp); |
@@ -1964,8 +1964,7 @@ void CodeGenerator::AssembleConstructFrame() { |
} |
} |
- |
-void CodeGenerator::AssembleReturn() { |
+void CodeGenerator::AssembleReturn(InstructionOperand* pop) { |
CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
int pop_count = static_cast<int>(descriptor->StackParameterCount()); |
@@ -1993,6 +1992,15 @@ void CodeGenerator::AssembleReturn() { |
AssembleDeconstructFrame(); |
} |
} |
+ 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); |
+ __ sll(pop_reg, pop_reg, Operand(kPointerSizeLog2)); |
+ __ addu(sp, sp, Operand(pop_reg)); |
+ } |
if (pop_count != 0) { |
__ DropAndRet(pop_count); |
} else { |