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

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

Issue 1455833004: [turbofan]: Implement tail calls with more callee than caller parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Improve comment Created 5 years, 1 month 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
« no previous file with comments | « src/compiler/mips64/code-generator-mips64.cc ('k') | test/unittests/compiler/linkage-tail-call-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/x64/code-generator-x64.cc
diff --git a/src/compiler/x64/code-generator-x64.cc b/src/compiler/x64/code-generator-x64.cc
index 1c80ad85baa8fd6eb5eec196ea8e00fa17f47782..2c38e7e8e9bcd9d075c826f581339cd50ffdf78a 100644
--- a/src/compiler/x64/code-generator-x64.cc
+++ b/src/compiler/x64/code-generator-x64.cc
@@ -574,18 +574,23 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
void CodeGenerator::AssembleDeconstructActivationRecord(int stack_param_delta) {
+ int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta);
+ if (sp_slot_delta > 0) {
+ __ addq(rsp, Immediate(sp_slot_delta * kPointerSize));
+ }
CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
- int stack_slots = frame()->GetSpillSlotCount();
- if (descriptor->IsJSFunctionCall() || stack_slots > 0) {
- __ movq(rsp, rbp);
+ int spill_slots = frame()->GetSpillSlotCount();
+ bool has_frame = descriptor->IsJSFunctionCall() || spill_slots > 0;
+ if (has_frame) {
__ popq(rbp);
}
- if (stack_param_delta < 0) {
- int offset = -(stack_param_delta + 1) * kPointerSize;
- __ popq(Operand(rsp, offset));
- if (offset != 0) {
- __ addq(rsp, Immediate(offset));
- }
+}
+
+
+void CodeGenerator::AssemblePrepareTailCall(int stack_param_delta) {
+ int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta);
+ if (sp_slot_delta < 0) {
+ __ subq(rsp, Immediate(-sp_slot_delta * kPointerSize));
}
}
@@ -655,6 +660,9 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
__ PrepareCallCFunction(num_parameters);
break;
}
+ case kArchPrepareTailCall:
+ AssemblePrepareTailCall(i.InputInt32(instr->InputCount() - 1));
+ break;
case kArchCallCFunction: {
int const num_parameters = MiscField::decode(instr->opcode());
if (HasImmediateInput(instr, 0)) {
« no previous file with comments | « src/compiler/mips64/code-generator-mips64.cc ('k') | test/unittests/compiler/linkage-tail-call-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698