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

Unified Diff: test/mjsunit/compiler/loops.js

Issue 6529055: [Isolates] Merge crankshaft (r5922 from bleeding_edge). (Closed)
Patch Set: Win32 port Created 9 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/mjsunit/compiler/logical-or.js ('k') | test/mjsunit/compiler/null-compare.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/compiler/loops.js
diff --git a/test/mjsunit/compiler/loops.js b/test/mjsunit/compiler/loops.js
index 4de45e7f88dc3394a508ecb7e24bf75932ed2e06..2195c6c9373fc345a898cbf12cf454fcbbf70a71 100644
--- a/test/mjsunit/compiler/loops.js
+++ b/test/mjsunit/compiler/loops.js
@@ -33,3 +33,29 @@ for (var i = 1; (6 - i); i++) {
n = n * i;
}
assertEquals(120, n);
+
+// Test assignments in the loop condition.
+function f(i, n) {
+ while((n = n - 1) >= 0) {
+ i = n + 1;
+ }
+ return i;
+}
+assertEquals(1, f(0, 42));
+
+
+// Test do-while loop and continue.
+function g(a) {
+ var x = 0, c = 0;
+ do {
+ x = x + 1;
+ if (x < 5) continue;
+ c = c + 1;
+ } while(x < a);
+ return c;
+}
+
+assertEquals(6, g(10));
+
+// Test deoptimization in the loop condition.
+assertEquals(0, g("foo"));
« no previous file with comments | « test/mjsunit/compiler/logical-or.js ('k') | test/mjsunit/compiler/null-compare.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698