Commit 8b56ec9c authored by titzer's avatar titzer Committed by Commit bot

[turbofan] Remove kInterpreterDispatch CallDescriptor kind in favor of flag.

Rationale: The {kind} of a call descriptor describes what the {target} being
called is--i.e. a JSFunction, code object, or address. That kind materially
dictates the instruction(s) generated for an outgoing call.

The other flags on a call descriptor should describe specific properties
(like whether a roots register is valid or not) so that backend logic doesn't
have to switch over the kind, but is informed directly of what it wants to
know.

R=mstarzinger@chromium.org
BUG=

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

Cr-Commit-Position: refs/heads/master@{#30065}
parent 826f8da5
......@@ -1190,7 +1190,6 @@ void InstructionSelector::VisitTailCall(Node* node) {
InstructionCode opcode;
switch (descriptor->kind()) {
case CallDescriptor::kCallCodeObject:
case CallDescriptor::kInterpreterDispatch:
opcode = kArchTailCallCodeObject;
break;
case CallDescriptor::kCallJSFunction:
......
......@@ -1492,7 +1492,6 @@ void InstructionSelector::VisitTailCall(Node* node) {
InstructionCode opcode;
switch (descriptor->kind()) {
case CallDescriptor::kCallCodeObject:
case CallDescriptor::kInterpreterDispatch:
opcode = kArchTailCallCodeObject;
break;
case CallDescriptor::kCallJSFunction:
......
......@@ -247,8 +247,7 @@ bool CodeGenerator::IsMaterializableFromRoot(
Handle<HeapObject> object, Heap::RootListIndex* index_return) {
const CallDescriptor* incoming_descriptor =
linkage()->GetIncomingDescriptor();
if (incoming_descriptor->IsJSFunctionCall() ||
incoming_descriptor->IsInterpreterDispatch()) {
if (incoming_descriptor->flags() & CallDescriptor::kCanUseRoots) {
RootIndexMap map(isolate());
int root_index = map.Lookup(*object);
if (root_index != RootIndexMap::kInvalidRootIndex) {
......
......@@ -921,7 +921,6 @@ void InstructionSelector::VisitTailCall(Node* node) {
InstructionCode opcode;
switch (descriptor->kind()) {
case CallDescriptor::kCallCodeObject:
case CallDescriptor::kInterpreterDispatch:
opcode = kArchTailCallCodeObject;
break;
case CallDescriptor::kCallJSFunction:
......
......@@ -345,9 +345,6 @@ void InstructionSelector::InitializeCallBuffer(Node* call, CallBuffer* buffer,
g.UseLocation(callee, buffer->descriptor->GetInputLocation(0),
buffer->descriptor->GetInputType(0)));
break;
case CallDescriptor::kInterpreterDispatch:
buffer->instruction_args.push_back(g.UseRegister(callee));
break;
}
DCHECK_EQ(1u, buffer->instruction_args.size());
......
......@@ -62,9 +62,6 @@ std::ostream& operator<<(std::ostream& os, const CallDescriptor::Kind& k) {
case CallDescriptor::kCallAddress:
os << "Addr";
break;
case CallDescriptor::kInterpreterDispatch:
os << "InterpreterDispatch";
break;
}
return os;
}
......@@ -390,7 +387,8 @@ CallDescriptor* Linkage::GetJSCallDescriptor(Zone* zone, bool is_osr,
Operator::kNoProperties, // properties
kNoCalleeSaved, // callee-saved
kNoCalleeSaved, // callee-saved fp
flags, // flags
CallDescriptor::kCanUseRoots | // flags
flags, // flags
"js-call");
}
......@@ -413,17 +411,18 @@ CallDescriptor* Linkage::GetInterpreterDispatchDescriptor(Zone* zone) {
locations.AddParam(regloc(kInterpreterDispatchTableRegister));
LinkageLocation target_loc = LinkageLocation::ForAnyRegister();
return new (zone) CallDescriptor( // --
CallDescriptor::kInterpreterDispatch, // kind
kMachNone, // target MachineType
target_loc, // target location
types.Build(), // machine_sig
locations.Build(), // location_sig
0, // stack_parameter_count
Operator::kNoProperties, // properties
kNoCalleeSaved, // callee-saved registers
kNoCalleeSaved, // callee-saved fp regs
CallDescriptor::kSupportsTailCalls, // flags
return new (zone) CallDescriptor( // --
CallDescriptor::kCallCodeObject, // kind
kMachNone, // target MachineType
target_loc, // target location
types.Build(), // machine_sig
locations.Build(), // location_sig
0, // stack_parameter_count
Operator::kNoProperties, // properties
kNoCalleeSaved, // callee-saved registers
kNoCalleeSaved, // callee-saved fp regs
CallDescriptor::kSupportsTailCalls | // flags
CallDescriptor::kCanUseRoots, // flags
"interpreter-dispatch");
}
......
......@@ -112,7 +112,6 @@ class CallDescriptor final : public ZoneObject {
kCallCodeObject, // target is a Code object
kCallJSFunction, // target is a JSFunction object
kCallAddress, // target is a machine pointer
kInterpreterDispatch // target is an interpreter bytecode handler
};
enum Flag {
......@@ -123,6 +122,7 @@ class CallDescriptor final : public ZoneObject {
kHasExceptionHandler = 1u << 3,
kHasLocalCatchHandler = 1u << 4,
kSupportsTailCalls = 1u << 5,
kCanUseRoots = 1u << 6,
kPatchableCallSiteWithNop = kPatchableCallSite | kNeedsNopAfterCall
};
typedef base::Flags<Flag> Flags;
......@@ -158,8 +158,6 @@ class CallDescriptor final : public ZoneObject {
// Returns {true} if this descriptor is a call to a JSFunction.
bool IsJSFunctionCall() const { return kind_ == kCallJSFunction; }
bool IsInterpreterDispatch() const { return kind_ == kInterpreterDispatch; }
// The number of return values from this call.
size_t ReturnCount() const { return machine_sig_->return_count(); }
......
......@@ -610,7 +610,6 @@ void InstructionSelector::VisitTailCall(Node* node) {
InstructionCode opcode;
switch (descriptor->kind()) {
case CallDescriptor::kCallCodeObject:
case CallDescriptor::kInterpreterDispatch:
opcode = kArchTailCallCodeObject;
break;
case CallDescriptor::kCallJSFunction:
......
......@@ -759,7 +759,6 @@ void InstructionSelector::VisitTailCall(Node* node) {
InstructionCode opcode;
switch (descriptor->kind()) {
case CallDescriptor::kCallCodeObject:
case CallDescriptor::kInterpreterDispatch:
opcode = kArchTailCallCodeObject;
break;
case CallDescriptor::kCallJSFunction:
......
......@@ -1547,7 +1547,6 @@ void InstructionSelector::VisitTailCall(Node* node) {
InstructionCode opcode;
switch (descriptor->kind()) {
case CallDescriptor::kCallCodeObject:
case CallDescriptor::kInterpreterDispatch:
opcode = kArchTailCallCodeObject;
break;
case CallDescriptor::kCallJSFunction:
......
......@@ -1129,7 +1129,6 @@ void InstructionSelector::VisitTailCall(Node* node) {
InstructionCode opcode;
switch (descriptor->kind()) {
case CallDescriptor::kCallCodeObject:
case CallDescriptor::kInterpreterDispatch:
opcode = kArchTailCallCodeObject;
break;
case CallDescriptor::kCallJSFunction:
......
......@@ -918,7 +918,6 @@ void InstructionSelector::VisitTailCall(Node* node) {
InstructionCode opcode;
switch (descriptor->kind()) {
case CallDescriptor::kCallCodeObject:
case CallDescriptor::kInterpreterDispatch:
opcode = kArchTailCallCodeObject;
break;
case CallDescriptor::kCallJSFunction:
......
......@@ -88,8 +88,8 @@ TARGET_TEST_F(InterpreterAssemblerTest, Dispatch) {
IsWord32Shl(target_bytecode_matcher,
IsInt32Constant(kPointerSizeLog2)));
EXPECT_EQ(CallDescriptor::kInterpreterDispatch,
m.call_descriptor()->kind());
EXPECT_EQ(CallDescriptor::kCallCodeObject, m.call_descriptor()->kind());
EXPECT_TRUE(m.call_descriptor()->flags() & CallDescriptor::kCanUseRoots);
EXPECT_THAT(
tail_call_node,
IsTailCall(m.call_descriptor(), code_target_matcher,
......@@ -111,8 +111,8 @@ TARGET_TEST_F(InterpreterAssemblerTest, Return) {
EXPECT_EQ(1, end->InputCount());
Node* tail_call_node = end->InputAt(0);
EXPECT_EQ(CallDescriptor::kInterpreterDispatch,
m.call_descriptor()->kind());
EXPECT_EQ(CallDescriptor::kCallCodeObject, m.call_descriptor()->kind());
EXPECT_TRUE(m.call_descriptor()->flags() & CallDescriptor::kCanUseRoots);
Matcher<Unique<HeapObject>> exit_trampoline(
Unique<HeapObject>::CreateImmovable(
isolate()->builtins()->InterpreterExitTrampoline()));
......
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