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:
parent
93d56fde70
commit
c4745aa187
@ -121,15 +121,13 @@ Node* RawMachineAssembler::CallN(CallDescriptor* desc, Node* function,
|
|||||||
Node** args) {
|
Node** args) {
|
||||||
int param_count =
|
int param_count =
|
||||||
static_cast<int>(desc->GetMachineSignature()->parameter_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);
|
Node** buffer = zone()->NewArray<Node*>(input_count);
|
||||||
int index = 0;
|
int index = 0;
|
||||||
buffer[index++] = function;
|
buffer[index++] = function;
|
||||||
for (int i = 0; i < param_count; i++) {
|
for (int i = 0; i < param_count; i++) {
|
||||||
buffer[index++] = args[i];
|
buffer[index++] = args[i];
|
||||||
}
|
}
|
||||||
buffer[index++] = graph()->start();
|
|
||||||
buffer[index++] = graph()->start();
|
|
||||||
return AddNode(common()->Call(desc), input_count, buffer);
|
return AddNode(common()->Call(desc), input_count, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,7 +138,7 @@ Node* RawMachineAssembler::CallNWithFrameState(CallDescriptor* desc,
|
|||||||
DCHECK(desc->NeedsFrameState());
|
DCHECK(desc->NeedsFrameState());
|
||||||
int param_count =
|
int param_count =
|
||||||
static_cast<int>(desc->GetMachineSignature()->parameter_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);
|
Node** buffer = zone()->NewArray<Node*>(input_count);
|
||||||
int index = 0;
|
int index = 0;
|
||||||
buffer[index++] = function;
|
buffer[index++] = function;
|
||||||
@ -148,8 +146,6 @@ Node* RawMachineAssembler::CallNWithFrameState(CallDescriptor* desc,
|
|||||||
buffer[index++] = args[i];
|
buffer[index++] = args[i];
|
||||||
}
|
}
|
||||||
buffer[index++] = frame_state;
|
buffer[index++] = frame_state;
|
||||||
buffer[index++] = graph()->start();
|
|
||||||
buffer[index++] = graph()->start();
|
|
||||||
return AddNode(common()->Call(desc), input_count, buffer);
|
return AddNode(common()->Call(desc), input_count, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,8 +160,7 @@ Node* RawMachineAssembler::CallRuntime1(Runtime::FunctionId function,
|
|||||||
common()->ExternalConstant(ExternalReference(function, isolate())));
|
common()->ExternalConstant(ExternalReference(function, isolate())));
|
||||||
Node* arity = Int32Constant(1);
|
Node* arity = Int32Constant(1);
|
||||||
|
|
||||||
return AddNode(common()->Call(descriptor), centry, arg1, ref, arity, context,
|
return AddNode(common()->Call(descriptor), centry, arg1, ref, arity, context);
|
||||||
graph()->start(), graph()->start());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -180,7 +175,7 @@ Node* RawMachineAssembler::CallRuntime2(Runtime::FunctionId function,
|
|||||||
Node* arity = Int32Constant(2);
|
Node* arity = Int32Constant(2);
|
||||||
|
|
||||||
return AddNode(common()->Call(descriptor), centry, arg1, arg2, ref, arity,
|
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);
|
Node* arity = Int32Constant(4);
|
||||||
|
|
||||||
return AddNode(common()->Call(descriptor), centry, arg1, arg2, arg3, arg4,
|
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) {
|
Node** args) {
|
||||||
int param_count =
|
int param_count =
|
||||||
static_cast<int>(desc->GetMachineSignature()->parameter_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);
|
Node** buffer = zone()->NewArray<Node*>(input_count);
|
||||||
int index = 0;
|
int index = 0;
|
||||||
buffer[index++] = function;
|
buffer[index++] = function;
|
||||||
for (int i = 0; i < param_count; i++) {
|
for (int i = 0; i < param_count; i++) {
|
||||||
buffer[index++] = args[i];
|
buffer[index++] = args[i];
|
||||||
}
|
}
|
||||||
buffer[index++] = graph()->start();
|
|
||||||
buffer[index++] = graph()->start();
|
|
||||||
Node* tail_call = MakeNode(common()->TailCall(desc), input_count, buffer);
|
Node* tail_call = MakeNode(common()->TailCall(desc), input_count, buffer);
|
||||||
NodeProperties::MergeControlToEnd(graph(), common(), tail_call);
|
NodeProperties::MergeControlToEnd(graph(), common(), tail_call);
|
||||||
schedule()->AddTailCall(CurrentBlock(), tail_call);
|
schedule()->AddTailCall(CurrentBlock(), tail_call);
|
||||||
@ -233,8 +226,7 @@ Node* RawMachineAssembler::TailCallRuntime1(Runtime::FunctionId function,
|
|||||||
common()->ExternalConstant(ExternalReference(function, isolate())));
|
common()->ExternalConstant(ExternalReference(function, isolate())));
|
||||||
Node* arity = Int32Constant(kArity);
|
Node* arity = Int32Constant(kArity);
|
||||||
|
|
||||||
Node* nodes[] = {centry, arg1, ref, arity, context, graph()->start(),
|
Node* nodes[] = {centry, arg1, ref, arity, context};
|
||||||
graph()->start()};
|
|
||||||
Node* tail_call = MakeNode(common()->TailCall(desc), arraysize(nodes), nodes);
|
Node* tail_call = MakeNode(common()->TailCall(desc), arraysize(nodes), nodes);
|
||||||
|
|
||||||
NodeProperties::MergeControlToEnd(graph(), common(), tail_call);
|
NodeProperties::MergeControlToEnd(graph(), common(), tail_call);
|
||||||
@ -257,9 +249,7 @@ Node* RawMachineAssembler::TailCallRuntime2(Runtime::FunctionId function,
|
|||||||
common()->ExternalConstant(ExternalReference(function, isolate())));
|
common()->ExternalConstant(ExternalReference(function, isolate())));
|
||||||
Node* arity = Int32Constant(kArity);
|
Node* arity = Int32Constant(kArity);
|
||||||
|
|
||||||
Node* nodes[] = {
|
Node* nodes[] = {centry, arg1, arg2, ref, arity, context};
|
||||||
centry, arg1, arg2, ref, arity, context, graph()->start(),
|
|
||||||
graph()->start()};
|
|
||||||
Node* tail_call = MakeNode(common()->TailCall(desc), arraysize(nodes), nodes);
|
Node* tail_call = MakeNode(common()->TailCall(desc), arraysize(nodes), nodes);
|
||||||
|
|
||||||
NodeProperties::MergeControlToEnd(graph(), common(), tail_call);
|
NodeProperties::MergeControlToEnd(graph(), common(), tail_call);
|
||||||
@ -276,8 +266,7 @@ Node* RawMachineAssembler::CallCFunction0(MachineType return_type,
|
|||||||
const CallDescriptor* descriptor =
|
const CallDescriptor* descriptor =
|
||||||
Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
|
Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
|
||||||
|
|
||||||
return AddNode(common()->Call(descriptor), function, graph()->start(),
|
return AddNode(common()->Call(descriptor), function);
|
||||||
graph()->start());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -290,8 +279,7 @@ Node* RawMachineAssembler::CallCFunction1(MachineType return_type,
|
|||||||
const CallDescriptor* descriptor =
|
const CallDescriptor* descriptor =
|
||||||
Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
|
Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
|
||||||
|
|
||||||
return AddNode(common()->Call(descriptor), function, arg0, graph()->start(),
|
return AddNode(common()->Call(descriptor), function, arg0);
|
||||||
graph()->start());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -306,8 +294,7 @@ Node* RawMachineAssembler::CallCFunction2(MachineType return_type,
|
|||||||
const CallDescriptor* descriptor =
|
const CallDescriptor* descriptor =
|
||||||
Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
|
Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
|
||||||
|
|
||||||
return AddNode(common()->Call(descriptor), function, arg0, arg1,
|
return AddNode(common()->Call(descriptor), function, arg0, arg1);
|
||||||
graph()->start(), graph()->start());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -327,17 +314,7 @@ Node* RawMachineAssembler::CallCFunction8(
|
|||||||
builder.AddParam(arg5_type);
|
builder.AddParam(arg5_type);
|
||||||
builder.AddParam(arg6_type);
|
builder.AddParam(arg6_type);
|
||||||
builder.AddParam(arg7_type);
|
builder.AddParam(arg7_type);
|
||||||
Node* args[] = {function,
|
Node* args[] = {function, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7};
|
||||||
arg0,
|
|
||||||
arg1,
|
|
||||||
arg2,
|
|
||||||
arg3,
|
|
||||||
arg4,
|
|
||||||
arg5,
|
|
||||||
arg6,
|
|
||||||
arg7,
|
|
||||||
graph()->start(),
|
|
||||||
graph()->start()};
|
|
||||||
const CallDescriptor* descriptor =
|
const CallDescriptor* descriptor =
|
||||||
Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
|
Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
|
||||||
return AddNode(common()->Call(descriptor), arraysize(args), args);
|
return AddNode(common()->Call(descriptor), arraysize(args), args);
|
||||||
|
@ -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*>
|
Matcher<Node*>
|
||||||
InterpreterAssemblerTest::InterpreterAssemblerForTest::IsBytecodeOperand(
|
InterpreterAssemblerTest::InterpreterAssemblerForTest::IsBytecodeOperand(
|
||||||
int offset) {
|
int offset) {
|
||||||
@ -183,8 +175,7 @@ TARGET_TEST_F(InterpreterAssemblerTest, Dispatch) {
|
|||||||
next_bytecode_offset_matcher,
|
next_bytecode_offset_matcher,
|
||||||
IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
||||||
IsParameter(Linkage::kInterpreterDispatchTableParameter),
|
IsParameter(Linkage::kInterpreterDispatchTableParameter),
|
||||||
IsParameter(Linkage::kInterpreterContextParameter),
|
IsParameter(Linkage::kInterpreterContextParameter), _, _));
|
||||||
graph->start(), graph->start()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,8 +214,7 @@ TARGET_TEST_F(InterpreterAssemblerTest, Jump) {
|
|||||||
next_bytecode_offset_matcher,
|
next_bytecode_offset_matcher,
|
||||||
IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
||||||
IsParameter(Linkage::kInterpreterDispatchTableParameter),
|
IsParameter(Linkage::kInterpreterDispatchTableParameter),
|
||||||
IsParameter(Linkage::kInterpreterContextParameter),
|
IsParameter(Linkage::kInterpreterContextParameter), _, _));
|
||||||
graph->start(), graph->start()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -267,8 +257,7 @@ TARGET_TEST_F(InterpreterAssemblerTest, JumpIfWordEqual) {
|
|||||||
next_bytecode_offset_matcher,
|
next_bytecode_offset_matcher,
|
||||||
IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
||||||
IsParameter(Linkage::kInterpreterDispatchTableParameter),
|
IsParameter(Linkage::kInterpreterDispatchTableParameter),
|
||||||
IsParameter(Linkage::kInterpreterContextParameter),
|
IsParameter(Linkage::kInterpreterContextParameter), _, _));
|
||||||
graph->start(), graph->start()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(oth): test control flow paths.
|
// TODO(oth): test control flow paths.
|
||||||
@ -298,8 +287,7 @@ TARGET_TEST_F(InterpreterAssemblerTest, Return) {
|
|||||||
IsParameter(Linkage::kInterpreterBytecodeOffsetParameter),
|
IsParameter(Linkage::kInterpreterBytecodeOffsetParameter),
|
||||||
IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
||||||
IsParameter(Linkage::kInterpreterDispatchTableParameter),
|
IsParameter(Linkage::kInterpreterDispatchTableParameter),
|
||||||
IsParameter(Linkage::kInterpreterContextParameter),
|
IsParameter(Linkage::kInterpreterContextParameter), _, _));
|
||||||
graph->start(), graph->start()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,7 +356,7 @@ TARGET_TEST_F(InterpreterAssemblerTest, GetSetAccumulator) {
|
|||||||
|
|
||||||
EXPECT_THAT(tail_call_node,
|
EXPECT_THAT(tail_call_node,
|
||||||
IsTailCall(m.call_descriptor(), _, accumulator_value_2, _, _, _,
|
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* arg1 = m.Int32Constant(2);
|
||||||
Node* arg2 = m.Int32Constant(3);
|
Node* arg2 = m.Int32Constant(3);
|
||||||
Node* call_runtime = m.CallRuntime(Runtime::kAdd, arg1, arg2);
|
Node* call_runtime = m.CallRuntime(Runtime::kAdd, arg1, arg2);
|
||||||
EXPECT_THAT(call_runtime,
|
EXPECT_THAT(
|
||||||
m.IsCall(_, _, arg1, arg2, _, IsInt32Constant(2),
|
call_runtime,
|
||||||
IsParameter(Linkage::kInterpreterContextParameter)));
|
IsCall(_, _, arg1, arg2, _, IsInt32Constant(2),
|
||||||
|
IsParameter(Linkage::kInterpreterContextParameter), _, _));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -578,10 +567,11 @@ TARGET_TEST_F(InterpreterAssemblerTest, CallRuntime) {
|
|||||||
IsInt32Constant(offsetof(Runtime::Function, entry)));
|
IsInt32Constant(offsetof(Runtime::Function, entry)));
|
||||||
|
|
||||||
Node* call_runtime = m.CallRuntime(function_id, first_arg, arg_count);
|
Node* call_runtime = m.CallRuntime(function_id, first_arg, arg_count);
|
||||||
EXPECT_THAT(call_runtime,
|
EXPECT_THAT(
|
||||||
m.IsCall(_, IsHeapConstant(builtin.code()), arg_count,
|
call_runtime,
|
||||||
first_arg, function_entry,
|
IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg,
|
||||||
IsParameter(Linkage::kInterpreterContextParameter)));
|
function_entry,
|
||||||
|
IsParameter(Linkage::kInterpreterContextParameter), _, _));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -596,9 +586,10 @@ TARGET_TEST_F(InterpreterAssemblerTest, CallIC) {
|
|||||||
Node* arg3 = m.Int32Constant(4);
|
Node* arg3 = m.Int32Constant(4);
|
||||||
Node* arg4 = m.Int32Constant(5);
|
Node* arg4 = m.Int32Constant(5);
|
||||||
Node* call_ic = m.CallIC(descriptor, target, arg1, arg2, arg3, arg4);
|
Node* call_ic = m.CallIC(descriptor, target, arg1, arg2, arg3, arg4);
|
||||||
EXPECT_THAT(call_ic,
|
EXPECT_THAT(
|
||||||
m.IsCall(_, target, arg1, arg2, arg3, arg4,
|
call_ic,
|
||||||
IsParameter(Linkage::kInterpreterContextParameter)));
|
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);
|
Node* call_js = m.CallJS(function, first_arg, arg_count);
|
||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
call_js,
|
call_js,
|
||||||
m.IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg,
|
IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg,
|
||||||
function, IsParameter(Linkage::kInterpreterContextParameter)));
|
function, IsParameter(Linkage::kInterpreterContextParameter), _,
|
||||||
|
_));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,10 +36,6 @@ class InterpreterAssemblerTest : public TestWithIsolateAndZone {
|
|||||||
const Matcher<Node*>& base_matcher,
|
const Matcher<Node*>& base_matcher,
|
||||||
const Matcher<Node*>& index_matcher,
|
const Matcher<Node*>& index_matcher,
|
||||||
const Matcher<Node*>& value_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*> IsBytecodeOperand(int offset);
|
||||||
Matcher<Node*> IsBytecodeOperandSignExtended(int offset);
|
Matcher<Node*> IsBytecodeOperandSignExtended(int offset);
|
||||||
|
@ -708,10 +708,18 @@ class IsCallMatcher final : public NodeMatcher {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
|
Node* effect_node = nullptr;
|
||||||
effect_matcher_, listener) &&
|
Node* control_node = nullptr;
|
||||||
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
if (NodeProperties::FirstEffectIndex(node) < node->InputCount()) {
|
||||||
"control", control_matcher_, listener));
|
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:
|
private:
|
||||||
@ -766,10 +774,18 @@ class IsTailCallMatcher final : public NodeMatcher {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
|
Node* effect_node = nullptr;
|
||||||
effect_matcher_, listener) &&
|
Node* control_node = nullptr;
|
||||||
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
if (NodeProperties::FirstEffectIndex(node) < node->InputCount()) {
|
||||||
"control", control_matcher_, listener));
|
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:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user