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

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

Issue 2446543002: [turbofan] Support variable size argument popping in TF-generated functions (Closed)
Patch Set: Fix x64 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/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 {

Powered by Google App Engine
This is Rietveld 408576698