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

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

Issue 918653002: Propagate pseudo-constants expressions separately in tree rewriter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Comment, bugfix, and test case Created 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 // VMOptions=-DUSE_CPS_IR=true 4 // VMOptions=-DUSE_CPS_IR=true
5 5
6 // Tests of interceptors. 6 // Tests of interceptors.
7 7
8 library interceptors_tests; 8 library interceptors_tests;
9 9
10 import 'js_backend_cps_ir.dart'; 10 import 'js_backend_cps_ir.dart';
11 11
12 const List<TestEntry> tests = const [ 12 const List<TestEntry> tests = const [
13 const TestEntry(""" 13 const TestEntry("""
14 main() { 14 main() {
15 var g = 1; 15 var g = 1;
16 16
17 var x = g + 3; 17 var x = g + 3;
18 print(x); 18 print(x);
19 }""", 19 }""",
20 r""" 20 r"""
21 function() { 21 function() {
22 var g, v0; 22 var g;
23 g = 1; 23 g = 1;
24 v0 = 3; 24 P.print(J.getInterceptor$ns(g).$add(g, 3));
25 P.print(J.getInterceptor$ns(g).$add(g, v0));
26 return null; 25 return null;
27 }"""), 26 }"""),
28 const TestEntry(""" 27 const TestEntry("""
29 main() { 28 main() {
30 var l = ['hest', ['h', 'e', 's', 't']]; 29 var l = ['hest', ['h', 'e', 's', 't']];
31 print(l.length); 30 print(l.length);
32 for (int i = 0; i < l.length; i++) { 31 for (int i = 0; i < l.length; i++) {
33 var x = l[i]; 32 var x = l[i];
34 for (int j = 0; j < x.length; j++) { 33 for (int j = 0; j < x.length; j++) {
35 print(x[j]); 34 print(x[j]);
36 } 35 }
37 } 36 }
38 }""", 37 }""",
39 r""" 38 r"""
40 function() { 39 function() {
41 var l, i, v0, x, j, v1, v2, v3; 40 var l, i, v0, x, j, v1;
42 l = ["hest", ["h", "e", "s", "t"]]; 41 l = ["hest", ["h", "e", "s", "t"]];
43 P.print(J.getInterceptor$as(l).get$length(l)); 42 P.print(J.getInterceptor$as(l).get$length(l));
44 i = 0; 43 i = 0;
45 L0: 44 L0:
46 while (true) { 45 while (true) {
47 v0 = J.getInterceptor$as(l).get$length(l); 46 v0 = J.getInterceptor$as(l).get$length(l);
48 if (P.identical(J.getInterceptor$n(i).$lt(i, v0), true)) { 47 if (P.identical(J.getInterceptor$n(i).$lt(i, v0), true)) {
49 x = J.getInterceptor$as(l).$index(l, i); 48 x = J.getInterceptor$as(l).$index(l, i);
50 j = 0; 49 j = 0;
51 while (true) { 50 while (true) {
52 v1 = J.getInterceptor$as(x).get$length(x); 51 v1 = J.getInterceptor$as(x).get$length(x);
53 if (P.identical(J.getInterceptor$n(j).$lt(j, v1), true)) { 52 if (P.identical(J.getInterceptor$n(j).$lt(j, v1), true)) {
54 P.print(J.getInterceptor$as(x).$index(x, j)); 53 P.print(J.getInterceptor$as(x).$index(x, j));
55 v2 = 1; 54 j = J.getInterceptor$ns(j).$add(j, 1);
56 j = J.getInterceptor$ns(j).$add(j, v2);
57 } else { 55 } else {
58 v3 = 1; 56 i = J.getInterceptor$ns(i).$add(i, 1);
59 i = J.getInterceptor$ns(i).$add(i, v3);
60 continue L0; 57 continue L0;
61 } 58 }
62 } 59 }
63 } else 60 } else
64 return null; 61 return null;
65 } 62 }
66 }"""), 63 }"""),
67 ]; 64 ];
68 65
69 66
70 void main() { 67 void main() {
71 runTests(tests); 68 runTests(tests);
72 } 69 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698