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 <limits> | 5 #include <limits> |
6 | 6 |
7 #include "src/compiler/graph.h" | 7 #include "src/compiler/graph.h" |
8 #include "src/compiler/node.h" | 8 #include "src/compiler/node.h" |
9 #include "src/compiler/operator.h" | 9 #include "src/compiler/operator.h" |
10 #include "src/compiler/value-numbering-reducer.h" | 10 #include "src/compiler/value-numbering-reducer.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 0) {} | 21 0) {} |
22 }; | 22 }; |
23 | 23 |
24 | 24 |
25 static const TestOperator kOp0(0, Operator::kIdempotent, 0, 1); | 25 static const TestOperator kOp0(0, Operator::kIdempotent, 0, 1); |
26 static const TestOperator kOp1(1, Operator::kIdempotent, 1, 1); | 26 static const TestOperator kOp1(1, Operator::kIdempotent, 1, 1); |
27 | 27 |
28 | 28 |
29 class ValueNumberingReducerTest : public TestWithZone { | 29 class ValueNumberingReducerTest : public TestWithZone { |
30 public: | 30 public: |
31 ValueNumberingReducerTest() : graph_(zone()), reducer_(zone()) {} | 31 ValueNumberingReducerTest() |
| 32 : graph_(zone()), reducer_(zone(), graph()->zone()) {} |
32 | 33 |
33 protected: | 34 protected: |
34 Reduction Reduce(Node* node) { return reducer_.Reduce(node); } | 35 Reduction Reduce(Node* node) { return reducer_.Reduce(node); } |
35 | 36 |
36 Graph* graph() { return &graph_; } | 37 Graph* graph() { return &graph_; } |
37 | 38 |
38 private: | 39 private: |
39 Graph graph_; | 40 Graph graph_; |
40 ValueNumberingReducer reducer_; | 41 ValueNumberingReducer reducer_; |
41 }; | 42 }; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 122 |
122 TEST_F(ValueNumberingReducerTest, WontReplaceNodeWithItself) { | 123 TEST_F(ValueNumberingReducerTest, WontReplaceNodeWithItself) { |
123 Node* n = graph()->NewNode(&kOp0); | 124 Node* n = graph()->NewNode(&kOp0); |
124 EXPECT_FALSE(Reduce(n).Changed()); | 125 EXPECT_FALSE(Reduce(n).Changed()); |
125 EXPECT_FALSE(Reduce(n).Changed()); | 126 EXPECT_FALSE(Reduce(n).Changed()); |
126 } | 127 } |
127 | 128 |
128 } // namespace compiler | 129 } // namespace compiler |
129 } // namespace internal | 130 } // namespace internal |
130 } // namespace v8 | 131 } // namespace v8 |
OLD | NEW |