Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Unified Diff: src/compiler/common-operator-reducer.cc

Issue 1366753003: [turbofan] Make Node::set_op safer via wrapper. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/bytecode-graph-builder.cc ('k') | src/compiler/control-flow-optimizer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/common-operator-reducer.cc
diff --git a/src/compiler/common-operator-reducer.cc b/src/compiler/common-operator-reducer.cc
index 02f99ced847de756451ff01eb5cf15da776e1f64..e4af2ad1f9b352a7654bdb1ea93f6f9cc775ddf9 100644
--- a/src/compiler/common-operator-reducer.cc
+++ b/src/compiler/common-operator-reducer.cc
@@ -85,10 +85,10 @@ Reduction CommonOperatorReducer::ReduceBranch(Node* node) {
for (Node* const use : node->uses()) {
switch (use->opcode()) {
case IrOpcode::kIfTrue:
- use->set_op(common()->IfFalse());
+ NodeProperties::ChangeOp(use, common()->IfFalse());
break;
case IrOpcode::kIfFalse:
- use->set_op(common()->IfTrue());
+ NodeProperties::ChangeOp(use, common()->IfTrue());
break;
default:
UNREACHABLE();
@@ -99,7 +99,8 @@ Reduction CommonOperatorReducer::ReduceBranch(Node* node) {
// graph reduction logic will ensure that the uses are revisited properly.
node->ReplaceInput(0, cond->InputAt(0));
// Negate the hint for {branch}.
- node->set_op(common()->Branch(NegateBranchHint(BranchHintOf(node->op()))));
+ NodeProperties::ChangeOp(
+ node, common()->Branch(NegateBranchHint(BranchHintOf(node->op()))));
return Changed(node);
}
Decision const decision = DecideCondition(cond);
@@ -148,8 +149,8 @@ Reduction CommonOperatorReducer::ReduceMerge(Node* node) {
DCHECK(branch->OwnedBy(if_true, if_false));
Node* const control = branch->InputAt(1);
// Mark the {branch} as {Dead}.
- branch->set_op(common()->Dead());
branch->TrimInputCount(0);
+ NodeProperties::ChangeOp(branch, common()->Dead());
return Replace(control);
}
}
@@ -280,9 +281,8 @@ Reduction CommonOperatorReducer::ReduceReturn(Node* node) {
DCHECK_NE(0, control_input_count);
DCHECK_EQ(control_input_count, value->InputCount() - 1);
DCHECK_EQ(control_input_count, effect->InputCount() - 1);
- Node* const end = graph()->end();
- DCHECK_EQ(IrOpcode::kEnd, end->opcode());
- DCHECK_NE(0, end->InputCount());
+ DCHECK_EQ(IrOpcode::kEnd, graph()->end()->opcode());
+ DCHECK_NE(0, graph()->end()->InputCount());
for (int i = 0; i < control_input_count; ++i) {
// Create a new {Return} and connect it to {end}. We don't need to mark
// {end} as revisit, because we mark {node} as {Dead} below, which was
@@ -290,8 +290,7 @@ Reduction CommonOperatorReducer::ReduceReturn(Node* node) {
// the reducer logic will visit {end} again.
Node* ret = graph()->NewNode(common()->Return(), value->InputAt(i),
effect->InputAt(i), control->InputAt(i));
- end->set_op(common()->End(end->InputCount() + 1));
- end->AppendInput(graph()->zone(), ret);
+ NodeProperties::MergeControlToEnd(graph(), common(), ret);
}
// Mark the merge {control} and return {node} as {dead}.
Replace(control, dead());
@@ -361,19 +360,19 @@ Reduction CommonOperatorReducer::ReduceSelect(Node* node) {
Reduction CommonOperatorReducer::Change(Node* node, Operator const* op,
Node* a) {
- node->set_op(op);
node->ReplaceInput(0, a);
node->TrimInputCount(1);
+ NodeProperties::ChangeOp(node, op);
return Changed(node);
}
Reduction CommonOperatorReducer::Change(Node* node, Operator const* op, Node* a,
Node* b) {
- node->set_op(op);
node->ReplaceInput(0, a);
node->ReplaceInput(1, b);
node->TrimInputCount(2);
+ NodeProperties::ChangeOp(node, op);
return Changed(node);
}
« no previous file with comments | « src/compiler/bytecode-graph-builder.cc ('k') | src/compiler/control-flow-optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698