| 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/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 | 10 |
| 11 namespace v8 { | 11 namespace v8 { |
| 12 namespace internal { | 12 namespace internal { |
| 13 namespace compiler { | 13 namespace compiler { |
| 14 | 14 |
| 15 class MachineOperatorReducerTest : public GraphTest { | 15 class MachineOperatorReducerTest : public GraphTest { |
| 16 public: | 16 public: |
| 17 explicit MachineOperatorReducerTest(int num_parameters = 2) | 17 explicit MachineOperatorReducerTest(int num_parameters = 2) |
| 18 : GraphTest(num_parameters) {} | 18 : GraphTest(num_parameters) {} |
| 19 | 19 |
| 20 protected: | 20 protected: |
| 21 Reduction Reduce(Node* node) { | 21 Reduction Reduce(Node* node) { |
| 22 Typer typer(zone()); | 22 Typer typer(zone()); |
| 23 JSGraph jsgraph(graph(), common(), &typer); | 23 JSOperatorBuilder javascript(zone()); |
| 24 JSGraph jsgraph(graph(), common(), &javascript, &typer, &machine_); |
| 24 MachineOperatorReducer reducer(&jsgraph); | 25 MachineOperatorReducer reducer(&jsgraph); |
| 25 return reducer.Reduce(node); | 26 return reducer.Reduce(node); |
| 26 } | 27 } |
| 27 | 28 |
| 28 MachineOperatorBuilder* machine() { return &machine_; } | 29 MachineOperatorBuilder* machine() { return &machine_; } |
| 29 | 30 |
| 30 private: | 31 private: |
| 31 MachineOperatorBuilder machine_; | 32 MachineOperatorBuilder machine_; |
| 32 }; | 33 }; |
| 33 | 34 |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 r = Reduce(graph()->NewNode(common()->Projection(0), add)); | 531 r = Reduce(graph()->NewNode(common()->Projection(0), add)); |
| 531 ASSERT_TRUE(r.Changed()); | 532 ASSERT_TRUE(r.Changed()); |
| 532 EXPECT_THAT(r.replacement(), IsInt32Constant(z)); | 533 EXPECT_THAT(r.replacement(), IsInt32Constant(z)); |
| 533 } | 534 } |
| 534 } | 535 } |
| 535 } | 536 } |
| 536 | 537 |
| 537 } // namespace compiler | 538 } // namespace compiler |
| 538 } // namespace internal | 539 } // namespace internal |
| 539 } // namespace v8 | 540 } // namespace v8 |
| OLD | NEW |