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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 226 |
227 node->AppendInput(zone(), n8); | 227 node->AppendInput(zone(), n8); |
228 EXPECT_FALSE(node->inputs().empty()); | 228 EXPECT_FALSE(node->inputs().empty()); |
229 EXPECT_THAT(node->inputs(), ElementsAre(n1, n3, n4, n5, n8)); | 229 EXPECT_THAT(node->inputs(), ElementsAre(n1, n3, n4, n5, n8)); |
230 | 230 |
231 node->AppendInput(zone(), n9); | 231 node->AppendInput(zone(), n9); |
232 EXPECT_FALSE(node->inputs().empty()); | 232 EXPECT_FALSE(node->inputs().empty()); |
233 EXPECT_THAT(node->inputs(), ElementsAre(n1, n3, n4, n5, n8, n9)); | 233 EXPECT_THAT(node->inputs(), ElementsAre(n1, n3, n4, n5, n8, n9)); |
234 } | 234 } |
235 | 235 |
| 236 |
| 237 TEST_F(NodeTest, BigNodes) { |
| 238 static const int kMaxSize = 512; |
| 239 Node* inputs[kMaxSize]; |
| 240 |
| 241 Node* n0 = Node::New(zone(), 0, &kOp0, 0, nullptr, false); |
| 242 Node* n1 = Node::New(zone(), 1, &kOp1, 1, &n0, false); |
| 243 |
| 244 for (int i = 0; i < kMaxSize; i++) { |
| 245 inputs[i] = i & 1 ? n0 : n1; |
| 246 } |
| 247 |
| 248 for (int size = 13; size <= kMaxSize; size += 9) { |
| 249 Node* node = Node::New(zone(), 12345, &kOp0, size, inputs, false); |
| 250 EXPECT_EQ(size, node->InputCount()); |
| 251 |
| 252 for (int i = 0; i < size; i++) { |
| 253 EXPECT_EQ(inputs[i], node->InputAt(i)); |
| 254 } |
| 255 } |
| 256 } |
| 257 |
| 258 |
236 } // namespace compiler | 259 } // namespace compiler |
237 } // namespace internal | 260 } // namespace internal |
238 } // namespace v8 | 261 } // namespace v8 |
OLD | NEW |