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/access-builder.h" | 5 #include "src/compiler/access-builder.h" |
6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
7 #include "src/compiler/node-properties.h" | 7 #include "src/compiler/node-properties.h" |
8 #include "src/compiler/simplified-operator.h" | 8 #include "src/compiler/simplified-operator.h" |
9 #include "src/compiler/simplified-operator-reducer.h" | 9 #include "src/compiler/simplified-operator-reducer.h" |
10 #include "src/conversions-inl.h" | 10 #include "src/conversions-inl.h" |
11 #include "src/types.h" | 11 #include "src/types.h" |
12 #include "test/unittests/compiler/graph-unittest.h" | 12 #include "test/unittests/compiler/graph-unittest.h" |
13 #include "test/unittests/compiler/node-test-utils.h" | 13 #include "test/unittests/compiler/node-test-utils.h" |
14 #include "testing/gmock-support.h" | 14 #include "testing/gmock-support.h" |
15 | 15 |
16 using testing::BitEq; | 16 using testing::BitEq; |
17 | 17 |
18 | 18 |
19 namespace v8 { | 19 namespace v8 { |
20 namespace internal { | 20 namespace internal { |
21 namespace compiler { | 21 namespace compiler { |
22 | 22 |
23 class SimplifiedOperatorReducerTest : public TypedGraphTest { | 23 class SimplifiedOperatorReducerTest : public GraphTest { |
24 public: | 24 public: |
25 explicit SimplifiedOperatorReducerTest(int num_parameters = 1) | 25 explicit SimplifiedOperatorReducerTest(int num_parameters = 1) |
26 : TypedGraphTest(num_parameters), simplified_(zone()) {} | 26 : GraphTest(num_parameters), simplified_(zone()) {} |
27 ~SimplifiedOperatorReducerTest() override {} | 27 ~SimplifiedOperatorReducerTest() override {} |
28 | 28 |
29 protected: | 29 protected: |
30 Reduction Reduce(Node* node) { | 30 Reduction Reduce(Node* node) { |
31 MachineOperatorBuilder machine(zone()); | 31 MachineOperatorBuilder machine(zone()); |
32 JSOperatorBuilder javascript(zone()); | 32 JSOperatorBuilder javascript(zone()); |
33 JSGraph jsgraph(isolate(), graph(), common(), &javascript, simplified(), | 33 JSGraph jsgraph(isolate(), graph(), common(), &javascript, simplified(), |
34 &machine); | 34 &machine); |
35 GraphReducer graph_reducer(zone(), graph()); | 35 GraphReducer graph_reducer(zone(), graph()); |
36 SimplifiedOperatorReducer reducer(&graph_reducer, &jsgraph); | 36 SimplifiedOperatorReducer reducer(&graph_reducer, &jsgraph); |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 Reduction reduction = Reduce( | 449 Reduction reduction = Reduce( |
450 graph()->NewNode(simplified()->ObjectIsSmi(), NumberConstant(n))); | 450 graph()->NewNode(simplified()->ObjectIsSmi(), NumberConstant(n))); |
451 ASSERT_TRUE(reduction.Changed()); | 451 ASSERT_TRUE(reduction.Changed()); |
452 EXPECT_THAT(reduction.replacement(), IsBooleanConstant(IsSmiDouble(n))); | 452 EXPECT_THAT(reduction.replacement(), IsBooleanConstant(IsSmiDouble(n))); |
453 } | 453 } |
454 } | 454 } |
455 | 455 |
456 } // namespace compiler | 456 } // namespace compiler |
457 } // namespace internal | 457 } // namespace internal |
458 } // namespace v8 | 458 } // namespace v8 |
OLD | NEW |