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

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

Issue 831133004: Use closure conversion in new dart2js backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed redundant null-check Created 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Tests of interceptors.
6
7 library closures_test;
8
9 import 'js_backend_cps_ir_test.dart';
10
11 const List<TestEntry> tests = const [
12 const TestEntry("""
13 main(x) {
14 a() {
15 return x;
16 }
17 x = x + '1';
18 print(a());
19 }
20 """,
21 r"""
22 function(x) {
23 var box_0, a, v0;
24 box_0 = {};
25 box_0.x_0 = x;
26 a = new V.main_a(box_0);
27 x = box_0.x_0;
28 v0 = "1";
29 box_0.x_0 = J.getInterceptor(x).$add(x, v0);
30 P.print(a.call$0());
31 return null;
32 }"""),
33
34 const TestEntry("""
35 main(x) {
36 a() {
37 return x;
38 }
39 print(a());
40 }
41 """,
42 r"""
43 function(x) {
44 P.print(new V.main_a(x).call$0());
45 return null;
46 }"""),
47
48 const TestEntry("""
49 main() {
50 var x = 122;
51 var a = () => x;
52 x = x + 1;
53 print(a());
54 }
55 """,
56 r"""
57 function() {
58 var box_0, a, x, v0;
59 box_0 = {};
60 box_0.x_0 = 122;
61 a = new V.main_closure(box_0);
62 x = box_0.x_0;
63 v0 = 1;
64 box_0.x_0 = J.getInterceptor(x).$add(x, v0);
65 P.print(a.call$0());
66 return null;
67 }"""),
68
69 const TestEntry("""
70 main() {
71 var x = 122;
72 var a = () {
73 var y = x;
74 return () => y;
75 };
76 x = x + 1;
77 print(a()());
78 }
79 """,
80 r"""
81 function() {
82 var box_0, a, x, v0;
83 box_0 = {};
84 box_0.x_0 = 122;
85 a = new V.main_closure(box_0);
86 x = box_0.x_0;
87 v0 = 1;
88 box_0.x_0 = J.getInterceptor(x).$add(x, v0);
89 P.print(a.call$0().call$0());
90 return null;
91 }"""),
92
93 const TestEntry("""
94 main() {
95 var a;
96 for (var i=0; i<10; i++) {
97 a = () => i;
98 }
99 print(a());
100 }
101 """,
102 r"""
103 function() {
104 var a, box_0, i, v0, box_01, v1;
105 a = null;
106 box_0 = {};
107 box_0.i_0 = 0;
108 while (true) {
109 i = box_0.i_0;
110 v0 = 10;
111 if (P.identical(J.getInterceptor(i).$lt(i, v0), true)) {
112 a = new V.main_closure(box_0);
113 box_01 = {};
114 box_01.i_0 = box_0.i_0;
115 i = box_01.i_0;
116 v1 = 1;
117 box_01.i_0 = J.getInterceptor(i).$add(i, v1);
118 box_0 = box_01;
119 } else {
120 P.print(a.call$0());
121 return null;
122 }
123 }
124 }"""),
125 ];
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart ('k') | tests/compiler/dart2js/js_backend_cps_ir_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698