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 26 matching lines...) Expand all Loading... |
37 | 37 |
38 private: | 38 private: |
39 Graph graph_; | 39 Graph graph_; |
40 ValueNumberingReducer reducer_; | 40 ValueNumberingReducer reducer_; |
41 }; | 41 }; |
42 | 42 |
43 | 43 |
44 TEST_F(ValueNumberingReducerTest, AllInputsAreChecked) { | 44 TEST_F(ValueNumberingReducerTest, AllInputsAreChecked) { |
45 Node* na = graph()->NewNode(&kOp0); | 45 Node* na = graph()->NewNode(&kOp0); |
46 Node* nb = graph()->NewNode(&kOp0); | 46 Node* nb = graph()->NewNode(&kOp0); |
47 Node* n1 = graph()->NewNode(&kOp1, na); | 47 Node* n1 = graph()->NewNode(&kOp0, na); |
48 Node* n2 = graph()->NewNode(&kOp1, nb); | 48 Node* n2 = graph()->NewNode(&kOp0, nb); |
49 EXPECT_FALSE(Reduce(n1).Changed()); | 49 EXPECT_FALSE(Reduce(n1).Changed()); |
50 EXPECT_FALSE(Reduce(n2).Changed()); | 50 EXPECT_FALSE(Reduce(n2).Changed()); |
51 } | 51 } |
52 | 52 |
53 | 53 |
54 TEST_F(ValueNumberingReducerTest, DeadNodesAreNeverReturned) { | 54 TEST_F(ValueNumberingReducerTest, DeadNodesAreNeverReturned) { |
55 Node* n0 = graph()->NewNode(&kOp0); | 55 Node* n0 = graph()->NewNode(&kOp0); |
56 Node* n1 = graph()->NewNode(&kOp1, n0); | 56 Node* n1 = graph()->NewNode(&kOp1, n0); |
57 EXPECT_FALSE(Reduce(n1).Changed()); | 57 EXPECT_FALSE(Reduce(n1).Changed()); |
58 n1->Kill(); | 58 n1->Kill(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 TEST_F(ValueNumberingReducerTest, WontReplaceNodeWithItself) { | 124 TEST_F(ValueNumberingReducerTest, WontReplaceNodeWithItself) { |
125 Node* n = graph()->NewNode(&kOp0); | 125 Node* n = graph()->NewNode(&kOp0); |
126 EXPECT_FALSE(Reduce(n).Changed()); | 126 EXPECT_FALSE(Reduce(n).Changed()); |
127 EXPECT_FALSE(Reduce(n).Changed()); | 127 EXPECT_FALSE(Reduce(n).Changed()); |
128 } | 128 } |
129 | 129 |
130 } // namespace compiler | 130 } // namespace compiler |
131 } // namespace internal | 131 } // namespace internal |
132 } // namespace v8 | 132 } // namespace v8 |
OLD | NEW |