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

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: Use Deque. 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
« no previous file with comments | « test/cctest/compiler/test-control-reducer.cc ('k') | test/mjsunit/asm/do-while-false.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7a4a0b335b44e9b44c66171ea444cee9c9f3fe41 100644
--- a/test/cctest/compiler/test-run-jsbranches.cc
+++ b/test/cctest/compiler/test-run-jsbranches.cc
@@ -280,3 +280,78 @@ 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));
+}
+
+
+TEST(EmptyFor) {
+ FunctionTester T("(function(a,b) { if (a) for(;;) ; return b; })");
+
+ T.CheckCall(T.Val(8126.1), T.Val(0.0), T.Val(8126.1));
+ T.CheckCall(T.Val(1123.1), T.Val(0.0), T.Val(1123.1));
+}
« no previous file with comments | « test/cctest/compiler/test-control-reducer.cc ('k') | test/mjsunit/asm/do-while-false.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698