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/compiler-unittests/graph-unittest.h" | 9 #include "test/compiler-unittests/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(zone()); | 23 MachineOperatorBuilder machine(zone()); |
26 JSGraph jsgraph(graph(), common(), &typer); | 24 JSGraph jsgraph(graph(), common()); |
27 SimplifiedOperatorReducer reducer(&jsgraph, &machine); | 25 SimplifiedOperatorReducer reducer(&jsgraph, &machine); |
28 return reducer.Reduce(node); | 26 return reducer.Reduce(node); |
29 } | 27 } |
30 | 28 |
31 SimplifiedOperatorBuilder* simplified() { return &simplified_; } | 29 SimplifiedOperatorBuilder* simplified() { return &simplified_; } |
32 | 30 |
33 private: | 31 private: |
34 SimplifiedOperatorBuilder simplified_; | 32 SimplifiedOperatorBuilder simplified_; |
35 }; | 33 }; |
36 | 34 |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 Reduce(graph()->NewNode(simplified()->ChangeUint32ToTagged(), | 470 Reduce(graph()->NewNode(simplified()->ChangeUint32ToTagged(), |
473 Int32Constant(BitCast<int32_t>(n)))); | 471 Int32Constant(BitCast<int32_t>(n)))); |
474 ASSERT_TRUE(reduction.Changed()); | 472 ASSERT_TRUE(reduction.Changed()); |
475 EXPECT_THAT(reduction.replacement(), IsNumberConstant(FastUI2D(n))); | 473 EXPECT_THAT(reduction.replacement(), IsNumberConstant(FastUI2D(n))); |
476 } | 474 } |
477 } | 475 } |
478 | 476 |
479 } // namespace compiler | 477 } // namespace compiler |
480 } // namespace internal | 478 } // namespace internal |
481 } // namespace v8 | 479 } // namespace v8 |
OLD | NEW |