OLD | NEW |
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/branch-elimination.h" | 5 #include "src/compiler/branch-elimination.h" |
6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
7 #include "src/compiler/linkage.h" | 7 #include "src/compiler/linkage.h" |
8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
9 #include "test/unittests/compiler/compiler-test-utils.h" | 9 #include "test/unittests/compiler/compiler-test-utils.h" |
10 #include "test/unittests/compiler/graph-unittest.h" | 10 #include "test/unittests/compiler/graph-unittest.h" |
11 #include "test/unittests/compiler/node-test-utils.h" | 11 #include "test/unittests/compiler/node-test-utils.h" |
12 #include "testing/gmock-support.h" | 12 #include "testing/gmock-support.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 namespace compiler { | 16 namespace compiler { |
17 | 17 |
18 class BranchEliminationTest : public TypedGraphTest { | 18 class BranchEliminationTest : public GraphTest { |
19 public: | 19 public: |
20 BranchEliminationTest() | 20 BranchEliminationTest() |
21 : machine_(zone(), MachineType::PointerRepresentation(), | 21 : machine_(zone(), MachineType::PointerRepresentation(), |
22 MachineOperatorBuilder::kNoFlags) {} | 22 MachineOperatorBuilder::kNoFlags) {} |
23 | 23 |
24 MachineOperatorBuilder* machine() { return &machine_; } | 24 MachineOperatorBuilder* machine() { return &machine_; } |
25 | 25 |
26 void Reduce() { | 26 void Reduce() { |
27 JSOperatorBuilder javascript(zone()); | 27 JSOperatorBuilder javascript(zone()); |
28 JSGraph jsgraph(isolate(), graph(), common(), &javascript, nullptr, | 28 JSGraph jsgraph(isolate(), graph(), common(), &javascript, nullptr, |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 Reduce(); | 200 Reduce(); |
201 | 201 |
202 // Outer branch should not be rewritten, the inner branch should be discarded. | 202 // Outer branch should not be rewritten, the inner branch should be discarded. |
203 EXPECT_THAT(outer_branch, IsBranch(condition, graph()->start())); | 203 EXPECT_THAT(outer_branch, IsBranch(condition, graph()->start())); |
204 EXPECT_THAT(ret1, IsReturn(IsInt32Constant(2), effect, loop)); | 204 EXPECT_THAT(ret1, IsReturn(IsInt32Constant(2), effect, loop)); |
205 } | 205 } |
206 | 206 |
207 } // namespace compiler | 207 } // namespace compiler |
208 } // namespace internal | 208 } // namespace internal |
209 } // namespace v8 | 209 } // namespace v8 |
OLD | NEW |