Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Unified Diff: test/unittests/compiler/node-unittest.cc

Issue 1022783002: [turbofan] Remove last_use_ field from Node. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/unittests/compiler/node-unittest.cc
diff --git a/test/unittests/compiler/node-unittest.cc b/test/unittests/compiler/node-unittest.cc
index f56d7d6f8c9fd09a91037f0911a0003f202bb9ca..08da84d8876a4995f9077ef51447ec3a8a1945a8 100644
--- a/test/unittests/compiler/node-unittest.cc
+++ b/test/unittests/compiler/node-unittest.cc
@@ -42,21 +42,30 @@ TEST_F(NodeTest, New) {
}
+// TODO(titzer): stupid test is stupid.
+static Node* UseAt(Node* node, int index) {
Benedikt Meurer 2015/03/19 09:46:23 There should be no need for this helper method.
titzer 2015/03/19 10:10:31 Done.
+ for (Node* use : node->uses()) {
+ if (index-- <= 0) return use;
+ }
+ return nullptr;
+}
+
+
TEST_F(NodeTest, NewWithInputs) {
Node* n0 = Node::New(zone(), 0, &kOp0, 0, nullptr, false);
EXPECT_EQ(0, n0->UseCount());
EXPECT_EQ(0, n0->InputCount());
Node* n1 = Node::New(zone(), 1, &kOp1, 1, &n0, false);
EXPECT_EQ(1, n0->UseCount());
- EXPECT_EQ(n1, n0->UseAt(0));
+ EXPECT_EQ(n1, UseAt(n0, 0));
Michael Starzinger 2015/03/19 09:40:09 Can we use EXPECT_THAT(n1->uses(), ElementsAre(n0)
titzer 2015/03/19 10:10:31 Done.
EXPECT_EQ(0, n1->UseCount());
EXPECT_EQ(1, n1->InputCount());
EXPECT_EQ(n0, n1->InputAt(0));
Node* n0_n1[] = {n0, n1};
Node* n2 = Node::New(zone(), 2, &kOp2, 2, n0_n1, false);
EXPECT_EQ(2, n0->UseCount());
- EXPECT_EQ(n1, n0->UseAt(0));
- EXPECT_EQ(n2, n0->UseAt(1));
+ EXPECT_EQ(n1, UseAt(n0, 1));
Michael Starzinger 2015/03/19 09:40:08 Can we use EXPECT_THAT(n0->uses(), ElementsAre(n0,
titzer 2015/03/19 10:10:31 Done.
+ EXPECT_EQ(n2, UseAt(n1, 0));
EXPECT_EQ(2, n2->InputCount());
EXPECT_EQ(n0, n2->InputAt(0));
EXPECT_EQ(n1, n2->InputAt(1));
« test/unittests/compiler/node-test-utils.cc ('K') | « test/unittests/compiler/node-test-utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698