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

Side by Side Diff: tests/compiler/dart2js/js_backend_cps_ir_gvn_test.dart

Issue 1562893002: dart2js cps: Generate increment and compound operators. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Also compound string concatenation Created 4 years, 11 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Test that the GVN optimization pass works as expected. 5 // Test that the GVN optimization pass works as expected.
6 6
7 library gvn_tests; 7 library gvn_tests;
8 8
9 import 'js_backend_cps_ir.dart'; 9 import 'js_backend_cps_ir.dart';
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 var x3 = new Leaf(20); 46 var x3 = new Leaf(20);
47 var x4 = new Leaf(-10); 47 var x4 = new Leaf(-10);
48 var y1 = new Branch(x1, x2); 48 var y1 = new Branch(x1, x2);
49 var y2 = new Branch(x3, x4); 49 var y2 = new Branch(x3, x4);
50 var z = new Root(y1, y2); 50 var z = new Root(y1, y2);
51 print(foo(z, [1,2,3,4,5,6,7,8,9,10])); 51 print(foo(z, [1,2,3,4,5,6,7,8,9,10]));
52 } 52 }
53 """,r""" 53 """,r"""
54 function() { 54 function() {
55 var v0 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], sum = 0, k = 0, i, v1; 55 var v0 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], sum = 0, k = 0, i, v1;
56 for (; k < 10; sum = sum + (i + v0[v1]), k = k + 1) { 56 for (; k < 10; sum += i + v0[v1], ++k) {
57 i = 1 + 20; 57 i = 1 + 20;
58 v1 = i * (10 + -10); 58 v1 = i * (10 + -10);
59 if (v1 < 0 || v1 >= 10) 59 if (v1 < 0 || v1 >= 10)
60 return H.ioore(v0, v1); 60 return H.ioore(v0, v1);
61 } 61 }
62 v0 = H.S(sum); 62 v0 = H.S(sum);
63 if (typeof dartPrint == "function") 63 if (typeof dartPrint == "function")
64 dartPrint(v0); 64 dartPrint(v0);
65 else if (typeof console == "object" && typeof console.log != "undefined") 65 else if (typeof console == "object" && typeof console.log != "undefined")
66 console.log(v0); 66 console.log(v0);
67 else if (!(typeof window == "object")) { 67 else if (!(typeof window == "object")) {
68 if (!(typeof print == "function")) 68 if (!(typeof print == "function"))
69 throw "Unable to print message: " + String(v0); 69 throw "Unable to print message: " + String(v0);
70 print(v0); 70 print(v0);
71 } 71 }
72 }"""), 72 }"""),
73 ]; 73 ];
74 74
75 void main() { 75 void main() {
76 runTests(tests); 76 runTests(tests);
77 } 77 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698