Commit 1eda962e authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[turbofan][cleanup] Remove Node-use in linkage.cc

The linkage should not have any knowledge about the existance of nodes.

R=mstarzinger@chromium.org

Bug: v8:9396
Change-Id: If10bf113c6ec19c434573a8d9bb7b736caef5dee
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1763532
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63313}
parent fd8fe873
...@@ -2824,7 +2824,7 @@ void InstructionSelector::VisitTailCall(Node* node) { ...@@ -2824,7 +2824,7 @@ void InstructionSelector::VisitTailCall(Node* node) {
auto call_descriptor = CallDescriptorOf(node->op()); auto call_descriptor = CallDescriptorOf(node->op());
CallDescriptor* caller = linkage()->GetIncomingDescriptor(); CallDescriptor* caller = linkage()->GetIncomingDescriptor();
DCHECK(caller->CanTailCall(node)); DCHECK(caller->CanTailCall(CallDescriptorOf(node->op())));
const CallDescriptor* callee = CallDescriptorOf(node->op()); const CallDescriptor* callee = CallDescriptorOf(node->op());
int stack_param_delta = callee->GetStackParameterDelta(caller); int stack_param_delta = callee->GetStackParameterDelta(caller);
CallBuffer buffer(zone(), call_descriptor, nullptr); CallBuffer buffer(zone(), call_descriptor, nullptr);
......
...@@ -7,9 +7,7 @@ ...@@ -7,9 +7,7 @@
#include "src/codegen/assembler-inl.h" #include "src/codegen/assembler-inl.h"
#include "src/codegen/macro-assembler.h" #include "src/codegen/macro-assembler.h"
#include "src/codegen/optimized-compilation-info.h" #include "src/codegen/optimized-compilation-info.h"
#include "src/compiler/common-operator.h"
#include "src/compiler/frame.h" #include "src/compiler/frame.h"
#include "src/compiler/node.h"
#include "src/compiler/osr.h" #include "src/compiler/osr.h"
#include "src/compiler/pipeline.h" #include "src/compiler/pipeline.h"
...@@ -130,8 +128,8 @@ int CallDescriptor::GetTaggedParameterSlots() const { ...@@ -130,8 +128,8 @@ int CallDescriptor::GetTaggedParameterSlots() const {
return result; return result;
} }
bool CallDescriptor::CanTailCall(const Node* node) const { bool CallDescriptor::CanTailCall(const CallDescriptor* callee) const {
return HasSameReturnLocationsAs(CallDescriptorOf(node->op())); return HasSameReturnLocationsAs(callee);
} }
// TODO(jkummerow, sigurds): Arguably frame size calculation should be // TODO(jkummerow, sigurds): Arguably frame size calculation should be
......
...@@ -28,7 +28,6 @@ namespace compiler { ...@@ -28,7 +28,6 @@ namespace compiler {
const RegList kNoCalleeSaved = 0; const RegList kNoCalleeSaved = 0;
class Node;
class OsrHelper; class OsrHelper;
// Describes the location for a parameter or a return value to a call. // Describes the location for a parameter or a return value to a call.
...@@ -327,7 +326,7 @@ class V8_EXPORT_PRIVATE CallDescriptor final ...@@ -327,7 +326,7 @@ class V8_EXPORT_PRIVATE CallDescriptor final
int GetTaggedParameterSlots() const; int GetTaggedParameterSlots() const;
bool CanTailCall(const Node* call) const; bool CanTailCall(const CallDescriptor* callee) const;
int CalculateFixedFrameSize(Code::Kind code_kind) const; int CalculateFixedFrameSize(Code::Kind code_kind) const;
......
...@@ -55,8 +55,8 @@ TEST_F(LinkageTailCall, EmptyToEmpty) { ...@@ -55,8 +55,8 @@ TEST_F(LinkageTailCall, EmptyToEmpty) {
CommonOperatorBuilder common(zone()); CommonOperatorBuilder common(zone());
const Operator* op = common.Call(desc); const Operator* op = common.Call(desc);
Node* const node = Node::New(zone(), 1, op, 0, nullptr, false); Node* const node = Node::New(zone(), 1, op, 0, nullptr, false);
EXPECT_TRUE(desc->CanTailCall(node));
const CallDescriptor* callee = CallDescriptorOf(node->op()); const CallDescriptor* callee = CallDescriptorOf(node->op());
EXPECT_TRUE(desc->CanTailCall(callee));
int stack_param_delta = callee->GetStackParameterDelta(desc); int stack_param_delta = callee->GetStackParameterDelta(desc);
EXPECT_EQ(0, stack_param_delta); EXPECT_EQ(0, stack_param_delta);
} }
...@@ -74,7 +74,7 @@ TEST_F(LinkageTailCall, SameReturn) { ...@@ -74,7 +74,7 @@ TEST_F(LinkageTailCall, SameReturn) {
CommonOperatorBuilder common(zone()); CommonOperatorBuilder common(zone());
const Operator* op = common.Call(desc2); const Operator* op = common.Call(desc2);
Node* const node = Node::New(zone(), 1, op, 0, nullptr, false); Node* const node = Node::New(zone(), 1, op, 0, nullptr, false);
EXPECT_TRUE(desc1->CanTailCall(node)); EXPECT_TRUE(desc1->CanTailCall(CallDescriptorOf(node->op())));
int stack_param_delta = desc2->GetStackParameterDelta(desc1); int stack_param_delta = desc2->GetStackParameterDelta(desc1);
EXPECT_EQ(0, stack_param_delta); EXPECT_EQ(0, stack_param_delta);
} }
...@@ -94,7 +94,7 @@ TEST_F(LinkageTailCall, DifferingReturn) { ...@@ -94,7 +94,7 @@ TEST_F(LinkageTailCall, DifferingReturn) {
CommonOperatorBuilder common(zone()); CommonOperatorBuilder common(zone());
const Operator* op = common.Call(desc2); const Operator* op = common.Call(desc2);
Node* const node = Node::New(zone(), 1, op, 0, nullptr, false); Node* const node = Node::New(zone(), 1, op, 0, nullptr, false);
EXPECT_TRUE(!desc1->CanTailCall(node)); EXPECT_FALSE(desc1->CanTailCall(CallDescriptorOf(node->op())));
} }
...@@ -113,7 +113,7 @@ TEST_F(LinkageTailCall, MoreRegisterParametersCallee) { ...@@ -113,7 +113,7 @@ TEST_F(LinkageTailCall, MoreRegisterParametersCallee) {
CommonOperatorBuilder common(zone()); CommonOperatorBuilder common(zone());
const Operator* op = common.Call(desc2); const Operator* op = common.Call(desc2);
Node* const node = Node::New(zone(), 1, op, 0, nullptr, false); Node* const node = Node::New(zone(), 1, op, 0, nullptr, false);
EXPECT_TRUE(desc1->CanTailCall(node)); EXPECT_TRUE(desc1->CanTailCall(CallDescriptorOf(node->op())));
int stack_param_delta = desc2->GetStackParameterDelta(desc1); int stack_param_delta = desc2->GetStackParameterDelta(desc1);
EXPECT_EQ(0, stack_param_delta); EXPECT_EQ(0, stack_param_delta);
} }
...@@ -134,7 +134,7 @@ TEST_F(LinkageTailCall, MoreRegisterParametersCaller) { ...@@ -134,7 +134,7 @@ TEST_F(LinkageTailCall, MoreRegisterParametersCaller) {
CommonOperatorBuilder common(zone()); CommonOperatorBuilder common(zone());
const Operator* op = common.Call(desc2); const Operator* op = common.Call(desc2);
Node* const node = Node::New(zone(), 1, op, 0, nullptr, false); Node* const node = Node::New(zone(), 1, op, 0, nullptr, false);
EXPECT_TRUE(desc1->CanTailCall(node)); EXPECT_TRUE(desc1->CanTailCall(CallDescriptorOf(node->op())));
int stack_param_delta = desc2->GetStackParameterDelta(desc1); int stack_param_delta = desc2->GetStackParameterDelta(desc1);
EXPECT_EQ(0, stack_param_delta); EXPECT_EQ(0, stack_param_delta);
} }
...@@ -155,7 +155,7 @@ TEST_F(LinkageTailCall, MoreRegisterAndStackParametersCallee) { ...@@ -155,7 +155,7 @@ TEST_F(LinkageTailCall, MoreRegisterAndStackParametersCallee) {
CommonOperatorBuilder common(zone()); CommonOperatorBuilder common(zone());
const Operator* op = common.Call(desc2); const Operator* op = common.Call(desc2);
Node* const node = Node::New(zone(), 1, op, 0, nullptr, false); Node* const node = Node::New(zone(), 1, op, 0, nullptr, false);
EXPECT_TRUE(desc1->CanTailCall(node)); EXPECT_TRUE(desc1->CanTailCall(CallDescriptorOf(node->op())));
int stack_param_delta = desc2->GetStackParameterDelta(desc1); int stack_param_delta = desc2->GetStackParameterDelta(desc1);
// We might need to add one slot of padding to the callee arguments. // We might need to add one slot of padding to the callee arguments.
int expected = kPadArguments ? 2 : 1; int expected = kPadArguments ? 2 : 1;
...@@ -178,7 +178,7 @@ TEST_F(LinkageTailCall, MoreRegisterAndStackParametersCaller) { ...@@ -178,7 +178,7 @@ TEST_F(LinkageTailCall, MoreRegisterAndStackParametersCaller) {
CommonOperatorBuilder common(zone()); CommonOperatorBuilder common(zone());
const Operator* op = common.Call(desc2); const Operator* op = common.Call(desc2);
Node* const node = Node::New(zone(), 1, op, 0, nullptr, false); Node* const node = Node::New(zone(), 1, op, 0, nullptr, false);
EXPECT_TRUE(desc1->CanTailCall(node)); EXPECT_TRUE(desc1->CanTailCall(CallDescriptorOf(node->op())));
int stack_param_delta = desc2->GetStackParameterDelta(desc1); int stack_param_delta = desc2->GetStackParameterDelta(desc1);
// We might need to drop one slot of padding from the caller's arguments. // We might need to drop one slot of padding from the caller's arguments.
int expected = kPadArguments ? -2 : -1; int expected = kPadArguments ? -2 : -1;
...@@ -206,7 +206,7 @@ TEST_F(LinkageTailCall, MatchingStackParameters) { ...@@ -206,7 +206,7 @@ TEST_F(LinkageTailCall, MatchingStackParameters) {
const Operator* op = common.Call(desc2); const Operator* op = common.Call(desc2);
Node* const node = Node* const node =
Node::New(zone(), 1, op, arraysize(parameters), parameters, false); Node::New(zone(), 1, op, arraysize(parameters), parameters, false);
EXPECT_TRUE(desc1->CanTailCall(node)); EXPECT_TRUE(desc1->CanTailCall(CallDescriptorOf(node->op())));
int stack_param_delta = desc2->GetStackParameterDelta(desc1); int stack_param_delta = desc2->GetStackParameterDelta(desc1);
EXPECT_EQ(0, stack_param_delta); EXPECT_EQ(0, stack_param_delta);
} }
...@@ -232,7 +232,7 @@ TEST_F(LinkageTailCall, NonMatchingStackParameters) { ...@@ -232,7 +232,7 @@ TEST_F(LinkageTailCall, NonMatchingStackParameters) {
const Operator* op = common.Call(desc2); const Operator* op = common.Call(desc2);
Node* const node = Node* const node =
Node::New(zone(), 1, op, arraysize(parameters), parameters, false); Node::New(zone(), 1, op, arraysize(parameters), parameters, false);
EXPECT_TRUE(desc1->CanTailCall(node)); EXPECT_TRUE(desc1->CanTailCall(CallDescriptorOf(node->op())));
int stack_param_delta = desc2->GetStackParameterDelta(desc1); int stack_param_delta = desc2->GetStackParameterDelta(desc1);
EXPECT_EQ(0, stack_param_delta); EXPECT_EQ(0, stack_param_delta);
} }
...@@ -259,7 +259,7 @@ TEST_F(LinkageTailCall, MatchingStackParametersExtraCallerRegisters) { ...@@ -259,7 +259,7 @@ TEST_F(LinkageTailCall, MatchingStackParametersExtraCallerRegisters) {
const Operator* op = common.Call(desc2); const Operator* op = common.Call(desc2);
Node* const node = Node* const node =
Node::New(zone(), 1, op, arraysize(parameters), parameters, false); Node::New(zone(), 1, op, arraysize(parameters), parameters, false);
EXPECT_TRUE(desc1->CanTailCall(node)); EXPECT_TRUE(desc1->CanTailCall(CallDescriptorOf(node->op())));
int stack_param_delta = desc2->GetStackParameterDelta(desc1); int stack_param_delta = desc2->GetStackParameterDelta(desc1);
EXPECT_EQ(0, stack_param_delta); EXPECT_EQ(0, stack_param_delta);
} }
...@@ -287,7 +287,7 @@ TEST_F(LinkageTailCall, MatchingStackParametersExtraCalleeRegisters) { ...@@ -287,7 +287,7 @@ TEST_F(LinkageTailCall, MatchingStackParametersExtraCalleeRegisters) {
const Operator* op = common.Call(desc2); const Operator* op = common.Call(desc2);
Node* const node = Node* const node =
Node::New(zone(), 1, op, arraysize(parameters), parameters, false); Node::New(zone(), 1, op, arraysize(parameters), parameters, false);
EXPECT_TRUE(desc1->CanTailCall(node)); EXPECT_TRUE(desc1->CanTailCall(CallDescriptorOf(node->op())));
int stack_param_delta = desc2->GetStackParameterDelta(desc1); int stack_param_delta = desc2->GetStackParameterDelta(desc1);
EXPECT_EQ(0, stack_param_delta); EXPECT_EQ(0, stack_param_delta);
} }
...@@ -315,7 +315,7 @@ TEST_F(LinkageTailCall, MatchingStackParametersExtraCallerRegistersAndStack) { ...@@ -315,7 +315,7 @@ TEST_F(LinkageTailCall, MatchingStackParametersExtraCallerRegistersAndStack) {
const Operator* op = common.Call(desc2); const Operator* op = common.Call(desc2);
Node* const node = Node* const node =
Node::New(zone(), 1, op, arraysize(parameters), parameters, false); Node::New(zone(), 1, op, arraysize(parameters), parameters, false);
EXPECT_TRUE(desc1->CanTailCall(node)); EXPECT_TRUE(desc1->CanTailCall(CallDescriptorOf(node->op())));
int stack_param_delta = desc2->GetStackParameterDelta(desc1); int stack_param_delta = desc2->GetStackParameterDelta(desc1);
// We might need to add one slot of padding to the callee arguments. // We might need to add one slot of padding to the callee arguments.
int expected = kPadArguments ? 0 : -1; int expected = kPadArguments ? 0 : -1;
...@@ -345,7 +345,7 @@ TEST_F(LinkageTailCall, MatchingStackParametersExtraCalleeRegistersAndStack) { ...@@ -345,7 +345,7 @@ TEST_F(LinkageTailCall, MatchingStackParametersExtraCalleeRegistersAndStack) {
const Operator* op = common.Call(desc2); const Operator* op = common.Call(desc2);
Node* const node = Node* const node =
Node::New(zone(), 1, op, arraysize(parameters), parameters, false); Node::New(zone(), 1, op, arraysize(parameters), parameters, false);
EXPECT_TRUE(desc1->CanTailCall(node)); EXPECT_TRUE(desc1->CanTailCall(CallDescriptorOf(node->op())));
int stack_param_delta = desc2->GetStackParameterDelta(desc1); int stack_param_delta = desc2->GetStackParameterDelta(desc1);
// We might need to drop one slot of padding from the caller's arguments. // We might need to drop one slot of padding from the caller's arguments.
int expected = kPadArguments ? 0 : 1; int expected = kPadArguments ? 0 : 1;
......
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