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

Unified Diff: test/cctest/compiler/test-run-jsbranches.cc

Issue 661923002: Implement graph trimming in ControlReducer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Test status for mjsunit/asm/infinite-loops.asm. Created 6 years, 2 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/cctest/compiler/test-run-jsbranches.cc
diff --git a/test/cctest/compiler/test-run-jsbranches.cc b/test/cctest/compiler/test-run-jsbranches.cc
index df2fcdcb6d68c5573a175e95eac8d5062a52b6e2..51de4ca1e5d5f4a2c60c969624c6a73acb700f26 100644
--- a/test/cctest/compiler/test-run-jsbranches.cc
+++ b/test/cctest/compiler/test-run-jsbranches.cc
@@ -280,3 +280,70 @@ TEST(NestedForConditional) {
T.CheckCall(T.Val(2), T.Val(2), T.false_value());
T.CheckCall(T.undefined(), T.Val(1), T.null());
}
+
+
+TEST(IfTrue) {
+ FunctionTester T("(function(a,b) { if (true) return a; return b; })");
+
+ T.CheckCall(T.Val(55), T.Val(55), T.Val(11));
+ T.CheckCall(T.Val(666), T.Val(666), T.Val(-444));
+}
+
+
+TEST(TernaryTrue) {
+ FunctionTester T("(function(a,b) { return true ? a : b; })");
+
+ T.CheckCall(T.Val(77), T.Val(77), T.Val(11));
+ T.CheckCall(T.Val(111), T.Val(111), T.Val(-444));
+}
+
+
+TEST(IfFalse) {
+ FunctionTester T("(function(a,b) { if (false) return a; return b; })");
+
+ T.CheckCall(T.Val(11), T.Val(22), T.Val(11));
+ T.CheckCall(T.Val(-555), T.Val(333), T.Val(-555));
+}
+
+
+TEST(TernaryFalse) {
+ FunctionTester T("(function(a,b) { return false ? a : b; })");
+
+ T.CheckCall(T.Val(99), T.Val(33), T.Val(99));
+ T.CheckCall(T.Val(-99), T.Val(-33), T.Val(-99));
+}
+
+
+TEST(WhileTrue) {
+ FunctionTester T("(function(a,b) { while (true) return a; return b; })");
+
+ T.CheckCall(T.Val(551), T.Val(551), T.Val(111));
+ T.CheckCall(T.Val(661), T.Val(661), T.Val(-444));
+}
+
+
+TEST(WhileFalse) {
+ FunctionTester T("(function(a,b) { while (false) return a; return b; })");
+
+ T.CheckCall(T.Val(115), T.Val(551), T.Val(115));
+ T.CheckCall(T.Val(-445), T.Val(661), T.Val(-445));
+}
+
+
+TEST(DoWhileTrue) {
+ FunctionTester T(
+ "(function(a,b) { do { return a; } while (true); return b; })");
+
+ T.CheckCall(T.Val(7551), T.Val(7551), T.Val(7111));
+ T.CheckCall(T.Val(7661), T.Val(7661), T.Val(-7444));
+}
+
+
+TEST(DoWhileFalse) {
+ FunctionTester T(
+ "(function(a,b) { do { "
+ "; } while (false); return b; })");
+
+ T.CheckCall(T.Val(8115), T.Val(8551), T.Val(8115));
+ T.CheckCall(T.Val(-8445), T.Val(8661), T.Val(-8445));
+}

Powered by Google App Engine
This is Rietveld 408576698