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

Side by Side Diff: test/cctest/compiler/test-control-reducer.cc

Issue 765983002: Clean up node iteration (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix windows build Created 6 years 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/verifier.cc ('k') | test/cctest/compiler/test-node.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/v8.h" 5 #include "src/v8.h"
6 #include "test/cctest/cctest.h" 6 #include "test/cctest/cctest.h"
7 7
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/compiler/common-operator.h" 9 #include "src/compiler/common-operator.h"
10 #include "src/compiler/control-reducer.h" 10 #include "src/compiler/control-reducer.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 Node* EffectPhi(Node* a, Node* b, Node* c) { 124 Node* EffectPhi(Node* a, Node* b, Node* c) {
125 return SetSelfReferences(graph.NewNode(op(3, true), a, b, c, start)); 125 return SetSelfReferences(graph.NewNode(op(3, true), a, b, c, start));
126 } 126 }
127 127
128 Node* EffectPhi(Node* a, Node* b, Node* c, Node* d) { 128 Node* EffectPhi(Node* a, Node* b, Node* c, Node* d) {
129 return SetSelfReferences(graph.NewNode(op(4, true), a, b, c, d, start)); 129 return SetSelfReferences(graph.NewNode(op(4, true), a, b, c, d, start));
130 } 130 }
131 131
132 Node* SetSelfReferences(Node* node) { 132 Node* SetSelfReferences(Node* node) {
133 Node::Inputs inputs = node->inputs(); 133 for (Edge edge : node->input_edges()) {
134 for (Node::Inputs::iterator iter(inputs.begin()); iter != inputs.end(); 134 if (edge.to() == self) node->ReplaceInput(edge.index(), node);
135 ++iter) {
136 Node* input = *iter;
137 if (input == self) node->ReplaceInput(iter.index(), node);
138 } 135 }
139 return node; 136 return node;
140 } 137 }
141 138
142 const Operator* op(int count, bool effect) { 139 const Operator* op(int count, bool effect) {
143 return effect ? common.EffectPhi(count) : common.Phi(kMachAnyTagged, count); 140 return effect ? common.EffectPhi(count) : common.Phi(kMachAnyTagged, count);
144 } 141 }
145 142
146 void Trim() { ControlReducer::TrimGraph(main_zone(), &jsgraph); } 143 void Trim() { ControlReducer::TrimGraph(main_zone(), &jsgraph); }
147 144
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 1669
1673 Node* ret = R.Return(d1.phi, R.start, d1.merge); 1670 Node* ret = R.Return(d1.phi, R.start, d1.merge);
1674 1671
1675 R.ReduceGraph(); // d1 gets folded true. 1672 R.ReduceGraph(); // d1 gets folded true.
1676 1673
1677 CheckInputs(ret, y2, R.start, R.start); 1674 CheckInputs(ret, y2, R.start, R.start);
1678 CheckDeadDiamond(d1); 1675 CheckDeadDiamond(d1);
1679 CheckDeadDiamond(d2); 1676 CheckDeadDiamond(d2);
1680 CheckDeadDiamond(d3); 1677 CheckDeadDiamond(d3);
1681 } 1678 }
OLDNEW
« no previous file with comments | « src/compiler/verifier.cc ('k') | test/cctest/compiler/test-node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698