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

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

Issue 892513003: [turbofan] Initial support for Switch. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix Wuschelstudio build. 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/common-operator-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/scheduler-unittest.cc
diff --git a/test/unittests/compiler/scheduler-unittest.cc b/test/unittests/compiler/scheduler-unittest.cc
index 2b46b06cf0ded8055aa0207d0343a190b37ffb5c..66496e2baf0d27b697a0970d3e459eedf966713c 100644
--- a/test/unittests/compiler/scheduler-unittest.cc
+++ b/test/unittests/compiler/scheduler-unittest.cc
@@ -1967,6 +1967,48 @@ TARGET_TEST_F(SchedulerTest, BranchHintFalse) {
CHECK(!schedule->block(f)->deferred());
}
+
+TARGET_TEST_F(SchedulerTest, Switch) {
+ Node* start = graph()->NewNode(common()->Start(1));
+ graph()->SetStart(start);
+
+ Node* p0 = graph()->NewNode(common()->Parameter(0), start);
+ Node* sw = graph()->NewNode(common()->Switch(2), p0, start);
+ Node* c0 = graph()->NewNode(common()->Case(0), sw);
+ Node* v0 = graph()->NewNode(common()->Int32Constant(11));
+ Node* c1 = graph()->NewNode(common()->Case(1), sw);
+ Node* v1 = graph()->NewNode(common()->Int32Constant(22));
+ Node* m = graph()->NewNode(common()->Merge(2), c0, c1);
+ Node* phi = graph()->NewNode(common()->Phi(kMachInt32, 2), v0, v1, m);
+ Node* ret = graph()->NewNode(common()->Return(), phi, start, m);
+ Node* end = graph()->NewNode(common()->End(), ret);
+
+ graph()->SetEnd(end);
+
+ ComputeAndVerifySchedule(13, graph());
+}
+
+
+TARGET_TEST_F(SchedulerTest, FloatingSwitch) {
+ Node* start = graph()->NewNode(common()->Start(1));
+ graph()->SetStart(start);
+
+ Node* p0 = graph()->NewNode(common()->Parameter(0), start);
+ Node* sw = graph()->NewNode(common()->Switch(2), p0, start);
+ Node* c0 = graph()->NewNode(common()->Case(0), sw);
+ Node* v0 = graph()->NewNode(common()->Int32Constant(11));
+ Node* c1 = graph()->NewNode(common()->Case(1), sw);
+ Node* v1 = graph()->NewNode(common()->Int32Constant(22));
+ Node* m = graph()->NewNode(common()->Merge(2), c0, c1);
+ Node* phi = graph()->NewNode(common()->Phi(kMachInt32, 2), v0, v1, m);
+ Node* ret = graph()->NewNode(common()->Return(), phi, start, start);
+ Node* end = graph()->NewNode(common()->End(), ret);
+
+ graph()->SetEnd(end);
+
+ ComputeAndVerifySchedule(13, graph());
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « test/unittests/compiler/common-operator-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698