| 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/compiler/js-graph.h" | 5 #include "src/compiler/js-graph.h" |
| 6 #include "src/compiler/simplified-operator.h" | 6 #include "src/compiler/simplified-operator.h" |
| 7 #include "src/compiler/simplified-operator-reducer.h" | 7 #include "src/compiler/simplified-operator-reducer.h" |
| 8 #include "src/compiler/typer.h" | |
| 9 #include "src/conversions.h" | 8 #include "src/conversions.h" |
| 10 #include "test/unittests/compiler/graph-unittest.h" | 9 #include "test/unittests/compiler/graph-unittest.h" |
| 11 | 10 |
| 12 namespace v8 { | 11 namespace v8 { |
| 13 namespace internal { | 12 namespace internal { |
| 14 namespace compiler { | 13 namespace compiler { |
| 15 | 14 |
| 16 class SimplifiedOperatorReducerTest : public GraphTest { | 15 class SimplifiedOperatorReducerTest : public GraphTest { |
| 17 public: | 16 public: |
| 18 explicit SimplifiedOperatorReducerTest(int num_parameters = 1) | 17 explicit SimplifiedOperatorReducerTest(int num_parameters = 1) |
| 19 : GraphTest(num_parameters), simplified_(zone()) {} | 18 : GraphTest(num_parameters), simplified_(zone()) {} |
| 20 virtual ~SimplifiedOperatorReducerTest() {} | 19 virtual ~SimplifiedOperatorReducerTest() {} |
| 21 | 20 |
| 22 protected: | 21 protected: |
| 23 Reduction Reduce(Node* node) { | 22 Reduction Reduce(Node* node) { |
| 24 Typer typer(zone()); | |
| 25 MachineOperatorBuilder machine; | 23 MachineOperatorBuilder machine; |
| 26 JSOperatorBuilder javascript(zone()); | 24 JSOperatorBuilder javascript(zone()); |
| 27 JSGraph jsgraph(graph(), common(), &javascript, &typer, &machine); | 25 JSGraph jsgraph(graph(), common(), &javascript, &machine); |
| 28 SimplifiedOperatorReducer reducer(&jsgraph); | 26 SimplifiedOperatorReducer reducer(&jsgraph); |
| 29 return reducer.Reduce(node); | 27 return reducer.Reduce(node); |
| 30 } | 28 } |
| 31 | 29 |
| 32 SimplifiedOperatorBuilder* simplified() { return &simplified_; } | 30 SimplifiedOperatorBuilder* simplified() { return &simplified_; } |
| 33 | 31 |
| 34 private: | 32 private: |
| 35 SimplifiedOperatorBuilder simplified_; | 33 SimplifiedOperatorBuilder simplified_; |
| 36 }; | 34 }; |
| 37 | 35 |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 Reduce(graph()->NewNode(simplified()->ChangeUint32ToTagged(), | 472 Reduce(graph()->NewNode(simplified()->ChangeUint32ToTagged(), |
| 475 Int32Constant(bit_cast<int32_t>(n)))); | 473 Int32Constant(bit_cast<int32_t>(n)))); |
| 476 ASSERT_TRUE(reduction.Changed()); | 474 ASSERT_TRUE(reduction.Changed()); |
| 477 EXPECT_THAT(reduction.replacement(), IsNumberConstant(FastUI2D(n))); | 475 EXPECT_THAT(reduction.replacement(), IsNumberConstant(FastUI2D(n))); |
| 478 } | 476 } |
| 479 } | 477 } |
| 480 | 478 |
| 481 } // namespace compiler | 479 } // namespace compiler |
| 482 } // namespace internal | 480 } // namespace internal |
| 483 } // namespace v8 | 481 } // namespace v8 |
| OLD | NEW |