Remove dummy control / effect edges from RMA Call nodes.

Removes the dummy control and effect edges from the RMA Call nodes. This
requires a change to the node matchers to allow them to cope with nodes
which don't have control or effect matchers.

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

Cr-Commit-Position: refs/heads/master@{#32752}
This commit is contained in:
rmcilroy 2015-12-10 05:36:20 -08:00 committed by Commit bot
parent 93d56fde70
commit c4745aa187
4 changed files with 57 additions and 76 deletions

View File

@ -121,15 +121,13 @@ Node* RawMachineAssembler::CallN(CallDescriptor* desc, Node* function,
Node** args) {
int param_count =
static_cast<int>(desc->GetMachineSignature()->parameter_count());
int input_count = param_count + 3;
int input_count = param_count + 1;
Node** buffer = zone()->NewArray<Node*>(input_count);
int index = 0;
buffer[index++] = function;
for (int i = 0; i < param_count; i++) {
buffer[index++] = args[i];
}
buffer[index++] = graph()->start();
buffer[index++] = graph()->start();
return AddNode(common()->Call(desc), input_count, buffer);
}
@ -140,7 +138,7 @@ Node* RawMachineAssembler::CallNWithFrameState(CallDescriptor* desc,
DCHECK(desc->NeedsFrameState());
int param_count =
static_cast<int>(desc->GetMachineSignature()->parameter_count());
int input_count = param_count + 4;
int input_count = param_count + 2;
Node** buffer = zone()->NewArray<Node*>(input_count);
int index = 0;
buffer[index++] = function;
@ -148,8 +146,6 @@ Node* RawMachineAssembler::CallNWithFrameState(CallDescriptor* desc,
buffer[index++] = args[i];
}
buffer[index++] = frame_state;
buffer[index++] = graph()->start();
buffer[index++] = graph()->start();
return AddNode(common()->Call(desc), input_count, buffer);
}
@ -164,8 +160,7 @@ Node* RawMachineAssembler::CallRuntime1(Runtime::FunctionId function,
common()->ExternalConstant(ExternalReference(function, isolate())));
Node* arity = Int32Constant(1);
return AddNode(common()->Call(descriptor), centry, arg1, ref, arity, context,
graph()->start(), graph()->start());
return AddNode(common()->Call(descriptor), centry, arg1, ref, arity, context);
}
@ -180,7 +175,7 @@ Node* RawMachineAssembler::CallRuntime2(Runtime::FunctionId function,
Node* arity = Int32Constant(2);
return AddNode(common()->Call(descriptor), centry, arg1, arg2, ref, arity,
context, graph()->start(), graph()->start());
context);
}
@ -196,7 +191,7 @@ Node* RawMachineAssembler::CallRuntime4(Runtime::FunctionId function,
Node* arity = Int32Constant(4);
return AddNode(common()->Call(descriptor), centry, arg1, arg2, arg3, arg4,
ref, arity, context, graph()->start(), graph()->start());
ref, arity, context);
}
@ -204,15 +199,13 @@ Node* RawMachineAssembler::TailCallN(CallDescriptor* desc, Node* function,
Node** args) {
int param_count =
static_cast<int>(desc->GetMachineSignature()->parameter_count());
int input_count = param_count + 3;
int input_count = param_count + 1;
Node** buffer = zone()->NewArray<Node*>(input_count);
int index = 0;
buffer[index++] = function;
for (int i = 0; i < param_count; i++) {
buffer[index++] = args[i];
}
buffer[index++] = graph()->start();
buffer[index++] = graph()->start();
Node* tail_call = MakeNode(common()->TailCall(desc), input_count, buffer);
NodeProperties::MergeControlToEnd(graph(), common(), tail_call);
schedule()->AddTailCall(CurrentBlock(), tail_call);
@ -233,8 +226,7 @@ Node* RawMachineAssembler::TailCallRuntime1(Runtime::FunctionId function,
common()->ExternalConstant(ExternalReference(function, isolate())));
Node* arity = Int32Constant(kArity);
Node* nodes[] = {centry, arg1, ref, arity, context, graph()->start(),
graph()->start()};
Node* nodes[] = {centry, arg1, ref, arity, context};
Node* tail_call = MakeNode(common()->TailCall(desc), arraysize(nodes), nodes);
NodeProperties::MergeControlToEnd(graph(), common(), tail_call);
@ -257,9 +249,7 @@ Node* RawMachineAssembler::TailCallRuntime2(Runtime::FunctionId function,
common()->ExternalConstant(ExternalReference(function, isolate())));
Node* arity = Int32Constant(kArity);
Node* nodes[] = {
centry, arg1, arg2, ref, arity, context, graph()->start(),
graph()->start()};
Node* nodes[] = {centry, arg1, arg2, ref, arity, context};
Node* tail_call = MakeNode(common()->TailCall(desc), arraysize(nodes), nodes);
NodeProperties::MergeControlToEnd(graph(), common(), tail_call);
@ -276,8 +266,7 @@ Node* RawMachineAssembler::CallCFunction0(MachineType return_type,
const CallDescriptor* descriptor =
Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
return AddNode(common()->Call(descriptor), function, graph()->start(),
graph()->start());
return AddNode(common()->Call(descriptor), function);
}
@ -290,8 +279,7 @@ Node* RawMachineAssembler::CallCFunction1(MachineType return_type,
const CallDescriptor* descriptor =
Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
return AddNode(common()->Call(descriptor), function, arg0, graph()->start(),
graph()->start());
return AddNode(common()->Call(descriptor), function, arg0);
}
@ -306,8 +294,7 @@ Node* RawMachineAssembler::CallCFunction2(MachineType return_type,
const CallDescriptor* descriptor =
Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
return AddNode(common()->Call(descriptor), function, arg0, arg1,
graph()->start(), graph()->start());
return AddNode(common()->Call(descriptor), function, arg0, arg1);
}
@ -327,17 +314,7 @@ Node* RawMachineAssembler::CallCFunction8(
builder.AddParam(arg5_type);
builder.AddParam(arg6_type);
builder.AddParam(arg7_type);
Node* args[] = {function,
arg0,
arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7,
graph()->start(),
graph()->start()};
Node* args[] = {function, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7};
const CallDescriptor* descriptor =
Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
return AddNode(common()->Call(descriptor), arraysize(args), args);

View File

@ -84,14 +84,6 @@ Matcher<Node*> InterpreterAssemblerTest::InterpreterAssemblerForTest::IsStore(
}
template <class... A>
Matcher<Node*> InterpreterAssemblerTest::InterpreterAssemblerForTest::IsCall(
const Matcher<const CallDescriptor*>& descriptor_matcher, A... args) {
return ::i::compiler::IsCall(descriptor_matcher, args..., graph()->start(),
graph()->start());
}
Matcher<Node*>
InterpreterAssemblerTest::InterpreterAssemblerForTest::IsBytecodeOperand(
int offset) {
@ -183,8 +175,7 @@ TARGET_TEST_F(InterpreterAssemblerTest, Dispatch) {
next_bytecode_offset_matcher,
IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
IsParameter(Linkage::kInterpreterDispatchTableParameter),
IsParameter(Linkage::kInterpreterContextParameter),
graph->start(), graph->start()));
IsParameter(Linkage::kInterpreterContextParameter), _, _));
}
}
@ -223,8 +214,7 @@ TARGET_TEST_F(InterpreterAssemblerTest, Jump) {
next_bytecode_offset_matcher,
IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
IsParameter(Linkage::kInterpreterDispatchTableParameter),
IsParameter(Linkage::kInterpreterContextParameter),
graph->start(), graph->start()));
IsParameter(Linkage::kInterpreterContextParameter), _, _));
}
}
}
@ -267,8 +257,7 @@ TARGET_TEST_F(InterpreterAssemblerTest, JumpIfWordEqual) {
next_bytecode_offset_matcher,
IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
IsParameter(Linkage::kInterpreterDispatchTableParameter),
IsParameter(Linkage::kInterpreterContextParameter),
graph->start(), graph->start()));
IsParameter(Linkage::kInterpreterContextParameter), _, _));
}
// TODO(oth): test control flow paths.
@ -298,8 +287,7 @@ TARGET_TEST_F(InterpreterAssemblerTest, Return) {
IsParameter(Linkage::kInterpreterBytecodeOffsetParameter),
IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
IsParameter(Linkage::kInterpreterDispatchTableParameter),
IsParameter(Linkage::kInterpreterContextParameter),
graph->start(), graph->start()));
IsParameter(Linkage::kInterpreterContextParameter), _, _));
}
}
@ -368,7 +356,7 @@ TARGET_TEST_F(InterpreterAssemblerTest, GetSetAccumulator) {
EXPECT_THAT(tail_call_node,
IsTailCall(m.call_descriptor(), _, accumulator_value_2, _, _, _,
_, graph->start(), graph->start()));
_, _, _));
}
}
@ -552,9 +540,10 @@ TARGET_TEST_F(InterpreterAssemblerTest, CallRuntime2) {
Node* arg1 = m.Int32Constant(2);
Node* arg2 = m.Int32Constant(3);
Node* call_runtime = m.CallRuntime(Runtime::kAdd, arg1, arg2);
EXPECT_THAT(call_runtime,
m.IsCall(_, _, arg1, arg2, _, IsInt32Constant(2),
IsParameter(Linkage::kInterpreterContextParameter)));
EXPECT_THAT(
call_runtime,
IsCall(_, _, arg1, arg2, _, IsInt32Constant(2),
IsParameter(Linkage::kInterpreterContextParameter), _, _));
}
}
@ -578,10 +567,11 @@ TARGET_TEST_F(InterpreterAssemblerTest, CallRuntime) {
IsInt32Constant(offsetof(Runtime::Function, entry)));
Node* call_runtime = m.CallRuntime(function_id, first_arg, arg_count);
EXPECT_THAT(call_runtime,
m.IsCall(_, IsHeapConstant(builtin.code()), arg_count,
first_arg, function_entry,
IsParameter(Linkage::kInterpreterContextParameter)));
EXPECT_THAT(
call_runtime,
IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg,
function_entry,
IsParameter(Linkage::kInterpreterContextParameter), _, _));
}
}
@ -596,9 +586,10 @@ TARGET_TEST_F(InterpreterAssemblerTest, CallIC) {
Node* arg3 = m.Int32Constant(4);
Node* arg4 = m.Int32Constant(5);
Node* call_ic = m.CallIC(descriptor, target, arg1, arg2, arg3, arg4);
EXPECT_THAT(call_ic,
m.IsCall(_, target, arg1, arg2, arg3, arg4,
IsParameter(Linkage::kInterpreterContextParameter)));
EXPECT_THAT(
call_ic,
IsCall(_, target, arg1, arg2, arg3, arg4,
IsParameter(Linkage::kInterpreterContextParameter), _, _));
}
}
@ -613,8 +604,9 @@ TARGET_TEST_F(InterpreterAssemblerTest, CallJS) {
Node* call_js = m.CallJS(function, first_arg, arg_count);
EXPECT_THAT(
call_js,
m.IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg,
function, IsParameter(Linkage::kInterpreterContextParameter)));
IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg,
function, IsParameter(Linkage::kInterpreterContextParameter), _,
_));
}
}

View File

@ -36,10 +36,6 @@ class InterpreterAssemblerTest : public TestWithIsolateAndZone {
const Matcher<Node*>& base_matcher,
const Matcher<Node*>& index_matcher,
const Matcher<Node*>& value_matcher);
template <class... A>
Matcher<Node*> IsCall(
const Matcher<const CallDescriptor*>& descriptor_matcher,
A... args);
Matcher<Node*> IsBytecodeOperand(int offset);
Matcher<Node*> IsBytecodeOperandSignExtended(int offset);

View File

@ -708,10 +708,18 @@ class IsCallMatcher final : public NodeMatcher {
return false;
}
}
return (PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
effect_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
"control", control_matcher_, listener));
Node* effect_node = nullptr;
Node* control_node = nullptr;
if (NodeProperties::FirstEffectIndex(node) < node->InputCount()) {
effect_node = NodeProperties::GetEffectInput(node);
}
if (NodeProperties::FirstControlIndex(node) < node->InputCount()) {
control_node = NodeProperties::GetControlInput(node);
}
return (PrintMatchAndExplain(effect_node, "effect", effect_matcher_,
listener) &&
PrintMatchAndExplain(control_node, "control", control_matcher_,
listener));
}
private:
@ -766,10 +774,18 @@ class IsTailCallMatcher final : public NodeMatcher {
return false;
}
}
return (PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
effect_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
"control", control_matcher_, listener));
Node* effect_node = nullptr;
Node* control_node = nullptr;
if (NodeProperties::FirstEffectIndex(node) < node->InputCount()) {
effect_node = NodeProperties::GetEffectInput(node);
}
if (NodeProperties::FirstControlIndex(node) < node->InputCount()) {
control_node = NodeProperties::GetControlInput(node);
}
return (PrintMatchAndExplain(effect_node, "effect", effect_matcher_,
listener) &&
PrintMatchAndExplain(control_node, "control", control_matcher_,
listener));
}
private: