Index: test/unittests/compiler/schedule-unittest.cc |
diff --git a/test/unittests/compiler/schedule-unittest.cc b/test/unittests/compiler/schedule-unittest.cc |
index 70fd4d50ad135aaaf44e7e6539a2d2e00bb27237..bc825353c4abc8c7a43d70a830362a5ac1c61444 100644 |
--- a/test/unittests/compiler/schedule-unittest.cc |
+++ b/test/unittests/compiler/schedule-unittest.cc |
@@ -73,8 +73,10 @@ typedef TestWithZone ScheduleTest; |
namespace { |
+const Operator kCallOperator(IrOpcode::kCall, Operator::kNoProperties, |
+ "MockCall", 0, 0, 0, 0, 0, 0); |
const Operator kBranchOperator(IrOpcode::kBranch, Operator::kNoProperties, |
- "Branch", 0, 0, 0, 0, 0, 0); |
+ "MockBranch", 0, 0, 0, 0, 0, 0); |
const Operator kDummyOperator(IrOpcode::kParameter, Operator::kNoProperties, |
"Dummy", 0, 0, 0, 0, 0, 0); |
@@ -135,6 +137,35 @@ TEST_F(ScheduleTest, AddGoto) { |
} |
+TEST_F(ScheduleTest, AddCall) { |
+ Schedule schedule(zone()); |
+ BasicBlock* start = schedule.start(); |
+ |
+ Node* call = Node::New(zone(), 0, &kCallOperator, 0, nullptr, false); |
+ BasicBlock* sblock = schedule.NewBasicBlock(); |
+ BasicBlock* eblock = schedule.NewBasicBlock(); |
+ schedule.AddCall(start, call, sblock, eblock); |
+ |
+ EXPECT_EQ(start, schedule.block(call)); |
+ |
+ EXPECT_EQ(0u, start->PredecessorCount()); |
+ EXPECT_EQ(2u, start->SuccessorCount()); |
+ EXPECT_EQ(sblock, start->SuccessorAt(0)); |
+ EXPECT_EQ(eblock, start->SuccessorAt(1)); |
+ EXPECT_THAT(start->successors(), ElementsAre(sblock, eblock)); |
+ |
+ EXPECT_EQ(1u, sblock->PredecessorCount()); |
+ EXPECT_EQ(0u, sblock->SuccessorCount()); |
+ EXPECT_EQ(start, sblock->PredecessorAt(0)); |
+ EXPECT_THAT(sblock->predecessors(), ElementsAre(start)); |
+ |
+ EXPECT_EQ(1u, eblock->PredecessorCount()); |
+ EXPECT_EQ(0u, eblock->SuccessorCount()); |
+ EXPECT_EQ(start, eblock->PredecessorAt(0)); |
+ EXPECT_THAT(eblock->predecessors(), ElementsAre(start)); |
+} |
+ |
+ |
TEST_F(ScheduleTest, AddBranch) { |
Schedule schedule(zone()); |
BasicBlock* start = schedule.start(); |