Reviewers: danno, dstence, michael_dawson,
Description:
PPC: [turbofan] Enable tail calls for %_CallRuntime.
Port 1fa4285e1ce16cfadf8c40a0993491ec4e2bbbe0
Original commit message:
This involves:
- Enabling the tail call optimization reducer in all cases.
- Adding an addition flag to CallFunctionParameters to mark call sites
that can be tail-called enabled.
- Only set the tail-call flag for %_CallFunction.
[email protected], [email protected], [email protected]
BUG=
Please review this at https://codereview.chromium.org/1224533002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+8, -10 lines):
M src/compiler/ppc/code-generator-ppc.cc
M src/compiler/ppc/instruction-selector-ppc.cc
Index: src/compiler/ppc/code-generator-ppc.cc
diff --git a/src/compiler/ppc/code-generator-ppc.cc
b/src/compiler/ppc/code-generator-ppc.cc
index
75b4c1f55417e9102b30203672e1fed5f51588f3..cdc1424cc5e72a7f63a8efa2db56911971f95311
100644
--- a/src/compiler/ppc/code-generator-ppc.cc
+++ b/src/compiler/ppc/code-generator-ppc.cc
@@ -585,10 +585,7 @@ void
CodeGenerator::AssembleDeconstructActivationRecord() {
CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
int stack_slots = frame()->GetSpillSlotCount();
if (descriptor->IsJSFunctionCall() || stack_slots > 0) {
- int pop_count = descriptor->IsJSFunctionCall()
- ? static_cast<int>(descriptor->JSParameterCount())
- : 0;
- __ LeaveFrame(StackFrame::MANUAL, pop_count * kPointerSize);
+ __ LeaveFrame(StackFrame::MANUAL);
}
}
@@ -620,6 +617,9 @@ void
CodeGenerator::AssembleArchInstruction(Instruction* instr) {
Operand(Code::kHeaderSize - kHeapObjectTag));
__ Jump(ip);
} else {
+ // We cannot use the constant pool to load the target since
+ // we've already restored the caller's frame.
+ ConstantPoolUnavailableScope constant_pool_unavailable(masm());
__ Jump(Handle<Code>::cast(i.InputHeapObject(0)),
RelocInfo::CODE_TARGET);
}
@@ -1379,7 +1379,9 @@ void CodeGenerator::AssembleReturn() {
__ bind(&return_label_);
int pop_count = descriptor->IsJSFunctionCall()
?
static_cast<int>(descriptor->JSParameterCount())
- : 0;
+ : (info()->IsStub()
+ ?
info()->code_stub()->GetStackParameterCount()
+ : 0);
__ LeaveFrame(StackFrame::MANUAL, pop_count * kPointerSize);
__ Ret();
}
Index: src/compiler/ppc/instruction-selector-ppc.cc
diff --git a/src/compiler/ppc/instruction-selector-ppc.cc
b/src/compiler/ppc/instruction-selector-ppc.cc
index
300e27fe6f07aca3be7d0981566000132a3e55d7..339184d193106270f2c22f965b4ff7edb867ed2c
100644
--- a/src/compiler/ppc/instruction-selector-ppc.cc
+++ b/src/compiler/ppc/instruction-selector-ppc.cc
@@ -1520,9 +1520,7 @@ void InstructionSelector::VisitTailCall(Node* node) {
DCHECK_EQ(0, descriptor->flags() & CallDescriptor::kNeedsNopAfterCall);
// TODO(turbofan): Relax restriction for stack parameters.
- if (descriptor->UsesOnlyRegisters() &&
- descriptor->HasSameReturnLocationsAs(
- linkage()->GetIncomingDescriptor())) {
+ if (linkage()->GetIncomingDescriptor()->CanTailCall(node)) {
CallBuffer buffer(zone(), descriptor, nullptr);
// Compute InstructionOperands for inputs and outputs.
@@ -1531,8 +1529,6 @@ void InstructionSelector::VisitTailCall(Node* node) {
// heuristics in the register allocator for where to emit constants.
InitializeCallBuffer(node, &buffer, true, false);
- DCHECK_EQ(0u, buffer.pushed_nodes.size());
-
// Select the appropriate opcode based on the call type.
InstructionCode opcode;
switch (descriptor->kind()) {
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.