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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 static int CheckLoop(Node* node, Node* i0 = NULL, Node* i1 = NULL, | 45 static int CheckLoop(Node* node, Node* i0 = NULL, Node* i1 = NULL, |
46 Node* i2 = NULL) { | 46 Node* i2 = NULL) { |
47 CHECK_EQ(IrOpcode::kLoop, node->opcode()); | 47 CHECK_EQ(IrOpcode::kLoop, node->opcode()); |
48 int count = CheckInputs(node, i0, i1, i2); | 48 int count = CheckInputs(node, i0, i1, i2); |
49 CHECK_EQ(count, node->op()->ControlInputCount()); | 49 CHECK_EQ(count, node->op()->ControlInputCount()); |
50 return count; | 50 return count; |
51 } | 51 } |
52 | 52 |
53 | 53 |
54 bool IsUsedBy(Node* a, Node* b) { | 54 bool IsUsedBy(Node* a, Node* b) { |
55 for (UseIter i = a->uses().begin(); i != a->uses().end(); ++i) { | 55 auto const uses = a->uses(); |
56 if (b == *i) return true; | 56 return std::find(uses.begin(), uses.end(), b) != uses.end(); |
57 } | |
58 return false; | |
59 } | 57 } |
60 | 58 |
61 | 59 |
62 // A helper for all tests dealing with ControlTester. | 60 // A helper for all tests dealing with ControlTester. |
63 class ControlReducerTester : HandleAndZoneScope { | 61 class ControlReducerTester : HandleAndZoneScope { |
64 public: | 62 public: |
65 ControlReducerTester() | 63 ControlReducerTester() |
66 : isolate(main_isolate()), | 64 : isolate(main_isolate()), |
67 common(main_zone()), | 65 common(main_zone()), |
68 graph(main_zone()), | 66 graph(main_zone()), |
(...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1669 | 1667 |
1670 Node* ret = R.Return(d1.phi, R.start, d1.merge); | 1668 Node* ret = R.Return(d1.phi, R.start, d1.merge); |
1671 | 1669 |
1672 R.ReduceGraph(); // d1 gets folded true. | 1670 R.ReduceGraph(); // d1 gets folded true. |
1673 | 1671 |
1674 CheckInputs(ret, y2, R.start, R.start); | 1672 CheckInputs(ret, y2, R.start, R.start); |
1675 CheckDeadDiamond(d1); | 1673 CheckDeadDiamond(d1); |
1676 CheckDeadDiamond(d2); | 1674 CheckDeadDiamond(d2); |
1677 CheckDeadDiamond(d3); | 1675 CheckDeadDiamond(d3); |
1678 } | 1676 } |
OLD | NEW |