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

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

Issue 694063005: Introduce Diamond, a helper for building diamond-shaped control patterns. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: newline Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | test/unittests/compiler/diamond-unittest.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 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 966
967 Branch(ControlReducerTester& R, Node* cond, Node* control = NULL) { 967 Branch(ControlReducerTester& R, Node* cond, Node* control = NULL) {
968 if (control == NULL) control = R.start; 968 if (control == NULL) control = R.start;
969 branch = R.graph.NewNode(R.common.Branch(), cond, control); 969 branch = R.graph.NewNode(R.common.Branch(), cond, control);
970 if_true = R.graph.NewNode(R.common.IfTrue(), branch); 970 if_true = R.graph.NewNode(R.common.IfTrue(), branch);
971 if_false = R.graph.NewNode(R.common.IfFalse(), branch); 971 if_false = R.graph.NewNode(R.common.IfFalse(), branch);
972 } 972 }
973 }; 973 };
974 974
975 975
976 // TODO(titzer): use the diamonds from src/compiler/diamond.h here.
976 struct Diamond { 977 struct Diamond {
977 Node* branch; 978 Node* branch;
978 Node* if_true; 979 Node* if_true;
979 Node* if_false; 980 Node* if_false;
980 Node* merge; 981 Node* merge;
981 Node* phi; 982 Node* phi;
982 983
983 Diamond(ControlReducerTester& R, Node* cond) { 984 Diamond(ControlReducerTester& R, Node* cond) {
984 branch = R.graph.NewNode(R.common.Branch(), cond, R.start); 985 branch = R.graph.NewNode(R.common.Branch(), cond, R.start);
985 if_true = R.graph.NewNode(R.common.IfTrue(), branch); 986 if_true = R.graph.NewNode(R.common.IfTrue(), branch);
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
1671 1672
1672 Node* ret = R.Return(d1.phi, R.start, d1.merge); 1673 Node* ret = R.Return(d1.phi, R.start, d1.merge);
1673 1674
1674 R.ReduceGraph(); // d1 gets folded true. 1675 R.ReduceGraph(); // d1 gets folded true.
1675 1676
1676 CheckInputs(ret, y2, R.start, R.start); 1677 CheckInputs(ret, y2, R.start, R.start);
1677 CheckDeadDiamond(d1); 1678 CheckDeadDiamond(d1);
1678 CheckDeadDiamond(d2); 1679 CheckDeadDiamond(d2);
1679 CheckDeadDiamond(d3); 1680 CheckDeadDiamond(d3);
1680 } 1681 }
OLDNEW
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | test/unittests/compiler/diamond-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698