| 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/state-values-utils.h" | 5 #include "src/compiler/state-values-utils.h" |
| 6 #include "test/unittests/compiler/graph-unittest.h" | 6 #include "test/unittests/compiler/graph-unittest.h" |
| 7 #include "test/unittests/compiler/node-test-utils.h" | 7 #include "test/unittests/compiler/node-test-utils.h" |
| 8 #include "test/unittests/test-utils.h" | 8 #include "test/unittests/test-utils.h" |
| 9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
| 10 | 10 |
| 11 namespace v8 { | 11 namespace v8 { |
| 12 namespace internal { | 12 namespace internal { |
| 13 namespace compiler { | 13 namespace compiler { |
| 14 | 14 |
| 15 class StateValuesIteratorTest : public GraphTest { | 15 class StateValuesIteratorTest : public GraphTest { |
| 16 public: | 16 public: |
| 17 StateValuesIteratorTest() : GraphTest(3) {} | 17 StateValuesIteratorTest() : GraphTest(3) {} |
| 18 | 18 |
| 19 Node* StateValuesFromVector(NodeVector* nodes) { | 19 Node* StateValuesFromVector(NodeVector* nodes) { |
| 20 int count = static_cast<int>(nodes->size()); | 20 int count = static_cast<int>(nodes->size()); |
| 21 return graph()->NewNode(common()->StateValues(count), count, | 21 return graph()->NewNode(common()->StateValues(count, 0u), count, |
| 22 count == 0 ? nullptr : &(nodes->front())); | 22 count == 0 ? nullptr : &(nodes->front())); |
| 23 } | 23 } |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 | 26 |
| 27 TEST_F(StateValuesIteratorTest, SimpleIteration) { | 27 TEST_F(StateValuesIteratorTest, SimpleIteration) { |
| 28 NodeVector inputs(zone()); | 28 NodeVector inputs(zone()); |
| 29 const int count = 10; | 29 const int count = 10; |
| 30 for (int i = 0; i < count; i++) { | 30 for (int i = 0; i < count; i++) { |
| 31 inputs.push_back(Int32Constant(i)); | 31 inputs.push_back(Int32Constant(i)); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 inputs.size() == 0 ? nullptr : &(inputs.front()), inputs.size()); | 142 inputs.size() == 0 ? nullptr : &(inputs.front()), inputs.size()); |
| 143 | 143 |
| 144 // The trees should be equal since the data was the same. | 144 // The trees should be equal since the data was the same. |
| 145 EXPECT_EQ(node1, node2); | 145 EXPECT_EQ(node1, node2); |
| 146 } | 146 } |
| 147 } | 147 } |
| 148 | 148 |
| 149 } // namespace compiler | 149 } // namespace compiler |
| 150 } // namespace internal | 150 } // namespace internal |
| 151 } // namespace v8 | 151 } // namespace v8 |
| OLD | NEW |