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/base/bits.h" | 5 #include "src/base/bits.h" |
6 #include "src/base/division-by-constant.h" | 6 #include "src/base/division-by-constant.h" |
7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
8 #include "src/compiler/machine-operator-reducer.h" | 8 #include "src/compiler/machine-operator-reducer.h" |
9 #include "src/compiler/typer.h" | 9 #include "src/compiler/typer.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 using testing::AllOf; | 14 using testing::AllOf; |
15 using testing::Capture; | 15 using testing::Capture; |
16 using testing::CaptureEq; | 16 using testing::CaptureEq; |
17 | 17 |
18 namespace v8 { | 18 namespace v8 { |
19 namespace internal { | 19 namespace internal { |
20 namespace compiler { | 20 namespace compiler { |
21 | 21 |
22 class MachineOperatorReducerTest : public TypedGraphTest { | 22 class MachineOperatorReducerTest : public TypedGraphTest { |
23 public: | 23 public: |
24 explicit MachineOperatorReducerTest(int num_parameters = 2) | 24 explicit MachineOperatorReducerTest(int num_parameters = 2) |
25 : TypedGraphTest(num_parameters) {} | 25 : TypedGraphTest(num_parameters), machine_(zone()) {} |
26 | 26 |
27 protected: | 27 protected: |
28 Reduction Reduce(Node* node) { | 28 Reduction Reduce(Node* node) { |
29 JSOperatorBuilder javascript(zone()); | 29 JSOperatorBuilder javascript(zone()); |
30 JSGraph jsgraph(graph(), common(), &javascript, &machine_); | 30 JSGraph jsgraph(graph(), common(), &javascript, &machine_); |
31 MachineOperatorReducer reducer(&jsgraph); | 31 MachineOperatorReducer reducer(&jsgraph); |
32 return reducer.Reduce(node); | 32 return reducer.Reduce(node); |
33 } | 33 } |
34 | 34 |
35 Matcher<Node*> IsTruncatingDiv(const Matcher<Node*>& dividend_matcher, | 35 Matcher<Node*> IsTruncatingDiv(const Matcher<Node*>& dividend_matcher, |
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1218 Reduction r = Reduce(node); | 1218 Reduction r = Reduce(node); |
1219 ASSERT_TRUE(r.Changed()); | 1219 ASSERT_TRUE(r.Changed()); |
1220 EXPECT_THAT(r.replacement(), | 1220 EXPECT_THAT(r.replacement(), |
1221 IsStore(rep, base, index, value, effect, control)); | 1221 IsStore(rep, base, index, value, effect, control)); |
1222 } | 1222 } |
1223 } | 1223 } |
1224 | 1224 |
1225 } // namespace compiler | 1225 } // namespace compiler |
1226 } // namespace internal | 1226 } // namespace internal |
1227 } // namespace v8 | 1227 } // namespace v8 |
OLD | NEW |