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

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

Issue 928213003: Model exceptional edges from call nodes in TurboFan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. Created 5 years, 10 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 | « test/unittests/compiler/node-properties-unittest.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 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();
« no previous file with comments | « test/unittests/compiler/node-properties-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698