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

Side by Side Diff: src/compiler/dead-code-elimination.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 unified diff | Download patch
« no previous file with comments | « src/compiler/control-flow-optimizer.cc ('k') | src/compiler/diamond.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/dead-code-elimination.h" 5 #include "src/compiler/dead-code-elimination.h"
6 6
7 #include "src/compiler/common-operator.h" 7 #include "src/compiler/common-operator.h"
8 #include "src/compiler/graph.h" 8 #include "src/compiler/graph.h"
9 #include "src/compiler/node-properties.h" 9 #include "src/compiler/node-properties.h"
10 #include "src/compiler/operator-properties.h" 10 #include "src/compiler/operator-properties.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 Node* const input = node->InputAt(i); 45 Node* const input = node->InputAt(i);
46 // Skip dead inputs. 46 // Skip dead inputs.
47 if (input->opcode() == IrOpcode::kDead) continue; 47 if (input->opcode() == IrOpcode::kDead) continue;
48 // Compact live inputs. 48 // Compact live inputs.
49 if (i != live_input_count) node->ReplaceInput(live_input_count, input); 49 if (i != live_input_count) node->ReplaceInput(live_input_count, input);
50 ++live_input_count; 50 ++live_input_count;
51 } 51 }
52 if (live_input_count == 0) { 52 if (live_input_count == 0) {
53 return Replace(dead()); 53 return Replace(dead());
54 } else if (live_input_count < input_count) { 54 } else if (live_input_count < input_count) {
55 node->set_op(common()->End(live_input_count));
56 node->TrimInputCount(live_input_count); 55 node->TrimInputCount(live_input_count);
56 NodeProperties::ChangeOp(node, common()->End(live_input_count));
57 return Changed(node); 57 return Changed(node);
58 } 58 }
59 DCHECK_EQ(input_count, live_input_count); 59 DCHECK_EQ(input_count, live_input_count);
60 return NoChange(); 60 return NoChange();
61 } 61 }
62 62
63 63
64 Reduction DeadCodeElimination::ReduceLoopOrMerge(Node* node) { 64 Reduction DeadCodeElimination::ReduceLoopOrMerge(Node* node) {
65 DCHECK(IrOpcode::IsMergeOpcode(node->opcode())); 65 DCHECK(IrOpcode::IsMergeOpcode(node->opcode()));
66 int const input_count = node->InputCount(); 66 int const input_count = node->InputCount();
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 DCHECK_EQ(1, control_input_count); 130 DCHECK_EQ(1, control_input_count);
131 Node* control = NodeProperties::GetControlInput(node); 131 Node* control = NodeProperties::GetControlInput(node);
132 if (control->opcode() == IrOpcode::kDead) return Replace(control); 132 if (control->opcode() == IrOpcode::kDead) return Replace(control);
133 return NoChange(); 133 return NoChange();
134 } 134 }
135 135
136 136
137 void DeadCodeElimination::TrimMergeOrPhi(Node* node, int size) { 137 void DeadCodeElimination::TrimMergeOrPhi(Node* node, int size) {
138 const Operator* const op = common()->ResizeMergeOrPhi(node->op(), size); 138 const Operator* const op = common()->ResizeMergeOrPhi(node->op(), size);
139 node->TrimInputCount(OperatorProperties::GetTotalInputCount(op)); 139 node->TrimInputCount(OperatorProperties::GetTotalInputCount(op));
140 node->set_op(op); 140 NodeProperties::ChangeOp(node, op);
141 } 141 }
142 142
143 } // namespace compiler 143 } // namespace compiler
144 } // namespace internal 144 } // namespace internal
145 } // namespace v8 145 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/control-flow-optimizer.cc ('k') | src/compiler/diamond.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698