OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/node.h" | 5 #include "src/compiler/node.h" |
6 #include "src/compiler/operator.h" | 6 #include "src/compiler/operator.h" |
7 #include "test/unittests/test-utils.h" | 7 #include "test/unittests/test-utils.h" |
8 #include "testing/gmock-support.h" | 8 #include "testing/gmock-support.h" |
9 | 9 |
10 using testing::ElementsAre; | 10 using testing::ElementsAre; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 EXPECT_FALSE(n1->OwnedBy(n1)); | 115 EXPECT_FALSE(n1->OwnedBy(n1)); |
116 EXPECT_TRUE(n0->OwnedBy(n1)); | 116 EXPECT_TRUE(n0->OwnedBy(n1)); |
117 Node* n0_n1[] = {n0, n1}; | 117 Node* n0_n1[] = {n0, n1}; |
118 Node* n2 = Node::New(zone(), 2, &kOp2, 2, n0_n1, false); | 118 Node* n2 = Node::New(zone(), 2, &kOp2, 2, n0_n1, false); |
119 EXPECT_FALSE(n0->OwnedBy(n0)); | 119 EXPECT_FALSE(n0->OwnedBy(n0)); |
120 EXPECT_FALSE(n1->OwnedBy(n1)); | 120 EXPECT_FALSE(n1->OwnedBy(n1)); |
121 EXPECT_FALSE(n2->OwnedBy(n2)); | 121 EXPECT_FALSE(n2->OwnedBy(n2)); |
122 EXPECT_FALSE(n0->OwnedBy(n1)); | 122 EXPECT_FALSE(n0->OwnedBy(n1)); |
123 EXPECT_FALSE(n0->OwnedBy(n2)); | 123 EXPECT_FALSE(n0->OwnedBy(n2)); |
124 EXPECT_TRUE(n1->OwnedBy(n2)); | 124 EXPECT_TRUE(n1->OwnedBy(n2)); |
| 125 EXPECT_TRUE(n0->OwnedBy(n1, n2)); |
125 n2->ReplaceInput(0, n2); | 126 n2->ReplaceInput(0, n2); |
126 EXPECT_TRUE(n0->OwnedBy(n1)); | 127 EXPECT_TRUE(n0->OwnedBy(n1)); |
127 EXPECT_TRUE(n1->OwnedBy(n2)); | 128 EXPECT_TRUE(n1->OwnedBy(n2)); |
128 n2->ReplaceInput(1, n0); | 129 n2->ReplaceInput(1, n0); |
129 EXPECT_FALSE(n0->OwnedBy(n1)); | 130 EXPECT_FALSE(n0->OwnedBy(n1)); |
130 EXPECT_FALSE(n1->OwnedBy(n2)); | 131 EXPECT_FALSE(n1->OwnedBy(n2)); |
131 } | 132 } |
132 | 133 |
133 | 134 |
134 TEST_F(NodeTest, ReplaceUsesNone) { | 135 TEST_F(NodeTest, ReplaceUsesNone) { |
(...skipping 26 matching lines...) Expand all Loading... |
161 EXPECT_THAT(node->inputs(), ElementsAre(n0, n1, n0)); | 162 EXPECT_THAT(node->inputs(), ElementsAre(n0, n1, n0)); |
162 node->AppendInput(zone(), n0); | 163 node->AppendInput(zone(), n0); |
163 EXPECT_THAT(node->inputs(), ElementsAre(n0, n1, n0, n0)); | 164 EXPECT_THAT(node->inputs(), ElementsAre(n0, n1, n0, n0)); |
164 node->AppendInput(zone(), n1); | 165 node->AppendInput(zone(), n1); |
165 EXPECT_THAT(node->inputs(), ElementsAre(n0, n1, n0, n0, n1)); | 166 EXPECT_THAT(node->inputs(), ElementsAre(n0, n1, n0, n0, n1)); |
166 } | 167 } |
167 | 168 |
168 } // namespace compiler | 169 } // namespace compiler |
169 } // namespace internal | 170 } // namespace internal |
170 } // namespace v8 | 171 } // namespace v8 |
OLD | NEW |