From: titzer Date: Fri, 7 Aug 2015 11:46:07 +0000 (-0700) Subject: [turbofan] Remove kInterpreterDispatch CallDescriptor kind in favor of flag. X-Git-Tag: upstream/4.7.83~975 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8b56ec9ccc66496d631ca32d372480f0964cbb7d;p=platform%2Fupstream%2Fv8.git [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} --- diff --git a/src/compiler/arm/instruction-selector-arm.cc b/src/compiler/arm/instruction-selector-arm.cc index 6c1baa2..8855388 100644 --- a/src/compiler/arm/instruction-selector-arm.cc +++ b/src/compiler/arm/instruction-selector-arm.cc @@ -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: diff --git a/src/compiler/arm64/instruction-selector-arm64.cc b/src/compiler/arm64/instruction-selector-arm64.cc index f025bf2..76b1059 100644 --- a/src/compiler/arm64/instruction-selector-arm64.cc +++ b/src/compiler/arm64/instruction-selector-arm64.cc @@ -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: diff --git a/src/compiler/code-generator.cc b/src/compiler/code-generator.cc index a705189..0f54729 100644 --- a/src/compiler/code-generator.cc +++ b/src/compiler/code-generator.cc @@ -247,8 +247,7 @@ bool CodeGenerator::IsMaterializableFromRoot( Handle 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) { diff --git a/src/compiler/ia32/instruction-selector-ia32.cc b/src/compiler/ia32/instruction-selector-ia32.cc index 460384c..105ca82 100644 --- a/src/compiler/ia32/instruction-selector-ia32.cc +++ b/src/compiler/ia32/instruction-selector-ia32.cc @@ -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: diff --git a/src/compiler/instruction-selector.cc b/src/compiler/instruction-selector.cc index fde7ba3..434ea0e 100644 --- a/src/compiler/instruction-selector.cc +++ b/src/compiler/instruction-selector.cc @@ -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()); diff --git a/src/compiler/linkage.cc b/src/compiler/linkage.cc index c2973b1..93b9a66 100644 --- a/src/compiler/linkage.cc +++ b/src/compiler/linkage.cc @@ -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"); } diff --git a/src/compiler/linkage.h b/src/compiler/linkage.h index e103614..363261e 100644 --- a/src/compiler/linkage.h +++ b/src/compiler/linkage.h @@ -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 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(); } diff --git a/src/compiler/mips/instruction-selector-mips.cc b/src/compiler/mips/instruction-selector-mips.cc index 7c0876d..c2420ac 100644 --- a/src/compiler/mips/instruction-selector-mips.cc +++ b/src/compiler/mips/instruction-selector-mips.cc @@ -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: diff --git a/src/compiler/mips64/instruction-selector-mips64.cc b/src/compiler/mips64/instruction-selector-mips64.cc index e25e7d7..e4d8795 100644 --- a/src/compiler/mips64/instruction-selector-mips64.cc +++ b/src/compiler/mips64/instruction-selector-mips64.cc @@ -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: diff --git a/src/compiler/ppc/instruction-selector-ppc.cc b/src/compiler/ppc/instruction-selector-ppc.cc index 3499fe4..0fe2acb 100644 --- a/src/compiler/ppc/instruction-selector-ppc.cc +++ b/src/compiler/ppc/instruction-selector-ppc.cc @@ -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: diff --git a/src/compiler/x64/instruction-selector-x64.cc b/src/compiler/x64/instruction-selector-x64.cc index 8a0615c..6d7fca4 100644 --- a/src/compiler/x64/instruction-selector-x64.cc +++ b/src/compiler/x64/instruction-selector-x64.cc @@ -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: diff --git a/src/compiler/x87/instruction-selector-x87.cc b/src/compiler/x87/instruction-selector-x87.cc index 8355963..d350738 100644 --- a/src/compiler/x87/instruction-selector-x87.cc +++ b/src/compiler/x87/instruction-selector-x87.cc @@ -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: diff --git a/test/unittests/compiler/interpreter-assembler-unittest.cc b/test/unittests/compiler/interpreter-assembler-unittest.cc index 19e8036..ebc2e65 100644 --- a/test/unittests/compiler/interpreter-assembler-unittest.cc +++ b/test/unittests/compiler/interpreter-assembler-unittest.cc @@ -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> exit_trampoline( Unique::CreateImmovable( isolate()->builtins()->InterpreterExitTrampoline()));