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

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

Issue 865393004: [turbofan] Move GetCommonDominator to BasicBlock. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « src/compiler/scheduler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/compiler/schedule-unittest.cc
diff --git a/test/unittests/compiler/schedule-unittest.cc b/test/unittests/compiler/schedule-unittest.cc
index fc9488456ece72ec70af8b7d8cb3b7e11a716478..22debd3cc58e80e178d5e892140534fbe4e0e21c 100644
--- a/test/unittests/compiler/schedule-unittest.cc
+++ b/test/unittests/compiler/schedule-unittest.cc
@@ -13,6 +13,61 @@ namespace v8 {
namespace internal {
namespace compiler {
+typedef TestWithZone BasicBlockTest;
+
+
+TEST_F(BasicBlockTest, Constructor) {
+ int const id = random_number_generator()->NextInt();
+ BasicBlock b(zone(), BasicBlock::Id::FromInt(id));
+ EXPECT_FALSE(b.deferred());
+ EXPECT_GT(0, b.dominator_depth());
+ EXPECT_EQ(nullptr, b.dominator());
+ EXPECT_EQ(nullptr, b.rpo_next());
+ EXPECT_EQ(id, b.id().ToInt());
+}
+
+
+TEST_F(BasicBlockTest, GetCommonDominator1) {
+ BasicBlock b(zone(), BasicBlock::Id::FromInt(0));
+ EXPECT_EQ(&b, BasicBlock::GetCommonDominator(&b, &b));
+}
+
+
+TEST_F(BasicBlockTest, GetCommonDominator2) {
+ BasicBlock b0(zone(), BasicBlock::Id::FromInt(0));
+ BasicBlock b1(zone(), BasicBlock::Id::FromInt(1));
+ BasicBlock b2(zone(), BasicBlock::Id::FromInt(2));
+ b0.set_dominator_depth(0);
+ b1.set_dominator(&b0);
+ b1.set_dominator_depth(1);
+ b2.set_dominator(&b1);
+ b2.set_dominator_depth(2);
+ EXPECT_EQ(&b0, BasicBlock::GetCommonDominator(&b0, &b1));
+ EXPECT_EQ(&b0, BasicBlock::GetCommonDominator(&b0, &b2));
+ EXPECT_EQ(&b0, BasicBlock::GetCommonDominator(&b1, &b0));
+ EXPECT_EQ(&b0, BasicBlock::GetCommonDominator(&b2, &b0));
+ EXPECT_EQ(&b1, BasicBlock::GetCommonDominator(&b1, &b2));
+ EXPECT_EQ(&b1, BasicBlock::GetCommonDominator(&b2, &b1));
+}
+
+
+TEST_F(BasicBlockTest, GetCommonDominator3) {
+ BasicBlock b0(zone(), BasicBlock::Id::FromInt(0));
+ BasicBlock b1(zone(), BasicBlock::Id::FromInt(1));
+ BasicBlock b2(zone(), BasicBlock::Id::FromInt(2));
+ BasicBlock b3(zone(), BasicBlock::Id::FromInt(3));
+ b0.set_dominator_depth(0);
+ b1.set_dominator(&b0);
+ b1.set_dominator_depth(1);
+ b2.set_dominator(&b0);
+ b2.set_dominator_depth(1);
+ b3.set_dominator(&b2);
+ b3.set_dominator_depth(2);
+ EXPECT_EQ(&b0, BasicBlock::GetCommonDominator(&b1, &b3));
+ EXPECT_EQ(&b0, BasicBlock::GetCommonDominator(&b3, &b1));
+}
+
+
typedef TestWithZone ScheduleTest;
« no previous file with comments | « src/compiler/scheduler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698