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/compiler/graph-unittest.h" | 6 #include "src/compiler/graph-unittest.h" |
| 7 #include "src/compiler/js-graph.h" |
7 #include "src/compiler/machine-operator-reducer.h" | 8 #include "src/compiler/machine-operator-reducer.h" |
| 9 #include "src/compiler/typer.h" |
8 | 10 |
9 namespace v8 { | 11 namespace v8 { |
10 namespace internal { | 12 namespace internal { |
11 namespace compiler { | 13 namespace compiler { |
12 | 14 |
13 class MachineOperatorReducerTest : public GraphTest { | 15 class MachineOperatorReducerTest : public GraphTest { |
14 public: | 16 public: |
15 explicit MachineOperatorReducerTest(int num_parameters = 2) | 17 explicit MachineOperatorReducerTest(int num_parameters = 2) |
16 : GraphTest(num_parameters), machine_(zone()) {} | 18 : GraphTest(num_parameters), machine_(zone()) {} |
17 virtual ~MachineOperatorReducerTest() {} | 19 virtual ~MachineOperatorReducerTest() {} |
18 | 20 |
19 protected: | 21 protected: |
20 Reduction Reduce(Node* node) { | 22 Reduction Reduce(Node* node) { |
21 MachineOperatorReducer reducer(graph()); | 23 Typer typer(zone()); |
| 24 JSGraph jsgraph(graph(), common(), &typer); |
| 25 MachineOperatorReducer reducer(&jsgraph); |
22 return reducer.Reduce(node); | 26 return reducer.Reduce(node); |
23 } | 27 } |
24 | 28 |
25 MachineOperatorBuilder* machine() { return &machine_; } | 29 MachineOperatorBuilder* machine() { return &machine_; } |
26 | 30 |
27 private: | 31 private: |
28 MachineOperatorBuilder machine_; | 32 MachineOperatorBuilder machine_; |
29 }; | 33 }; |
30 | 34 |
31 | 35 |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 EXPECT_TRUE(reduction.Changed()); | 438 EXPECT_TRUE(reduction.Changed()); |
435 EXPECT_THAT(reduction.replacement(), | 439 EXPECT_THAT(reduction.replacement(), |
436 IsInt32Constant(base::bits::RotateRight32(x, y))); | 440 IsInt32Constant(base::bits::RotateRight32(x, y))); |
437 } | 441 } |
438 } | 442 } |
439 } | 443 } |
440 | 444 |
441 } // namespace compiler | 445 } // namespace compiler |
442 } // namespace internal | 446 } // namespace internal |
443 } // namespace v8 | 447 } // namespace v8 |
OLD | NEW |