Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Unified Diff: src/compiler/mips64/code-generator-mips64.cc

Issue 2446543002: [turbofan] Support variable size argument popping in TF-generated functions (Closed)
Patch Set: Fix bugs Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 {

Powered by Google App Engine
This is Rietveld 408576698