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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 15 matching lines...) Expand all
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 // Test compilation of loops. 28 // Test compilation of loops.
29 29
30 var n = 1; 30 var n = 1;
31 for (var i = 1; (6 - i); i++) { 31 for (var i = 1; (6 - i); i++) {
32 // Factorial! 32 // Factorial!
33 n = n * i; 33 n = n * i;
34 } 34 }
35 assertEquals(120, n); 35 assertEquals(120, n);
36
37 // Test assignments in the loop condition.
38 function f(i, n) {
39 while((n = n - 1) >= 0) {
40 i = n + 1;
41 }
42 return i;
43 }
44 assertEquals(1, f(0, 42));
45
46
47 // Test do-while loop and continue.
48 function g(a) {
49 var x = 0, c = 0;
50 do {
51 x = x + 1;
52 if (x < 5) continue;
53 c = c + 1;
54 } while(x < a);
55 return c;
56 }
57
58 assertEquals(6, g(10));
59
60 // Test deoptimization in the loop condition.
61 assertEquals(0, g("foo"));
OLDNEW
« 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