| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |