Commit 19e53974 authored by cdai2's avatar cdai2

X87: [turbofan] Enable tail calls for %_CallRuntime.

port 1fa4285e (r29436).

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.

BUG=
R=weiliang.lin@intel.com

Review URL: https://codereview.chromium.org/1228463003

Cr-Commit-Position: refs/heads/master@{#29504}
parent c59da8b9
......@@ -297,13 +297,6 @@ void CodeGenerator::AssembleDeconstructActivationRecord() {
if (descriptor->IsJSFunctionCall() || stack_slots > 0) {
__ mov(esp, ebp);
__ pop(ebp);
int32_t bytes_to_pop =
descriptor->IsJSFunctionCall()
? static_cast<int32_t>(descriptor->JSParameterCount() *
kPointerSize)
: 0;
__ pop(Operand(esp, bytes_to_pop));
__ add(esp, Immediate(bytes_to_pop));
}
}
......@@ -1604,8 +1597,14 @@ void CodeGenerator::AssembleReturn() {
__ pop(ebp); // Pop caller's frame pointer.
int pop_count = descriptor->IsJSFunctionCall()
? static_cast<int>(descriptor->JSParameterCount())
: 0;
__ Ret(pop_count * kPointerSize, ebx);
: (info()->IsStub()
? info()->code_stub()->GetStackParameterCount()
: 0);
if (pop_count == 0) {
__ ret(0);
} else {
__ Ret(pop_count * kPointerSize, ebx);
}
}
} else {
__ ret(0);
......
......@@ -890,16 +890,13 @@ 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.
InitializeCallBuffer(node, &buffer, true, true);
DCHECK_EQ(0u, buffer.pushed_nodes.size());
// Select the appropriate opcode based on the call type.
InstructionCode opcode;
switch (descriptor->kind()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment