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

Side by Side Diff: tests/compiler/dart2js_extra/ssa_inlining_test.dart

Issue 108333007: tests for inlining between IR and AST functions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix comments Created 7 years 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) 2013, 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 import '../dart2js_native/compiler_test_internals.dart';
6 import 'package:expect/expect.dart';
7
8 // The function ast01 is built by an SsaFromAstBuilder.
9 // Ir functions are inlined by an SsaFromIrInliner.
10
11 @NoInline()
12 @IrRepresentation(false)
13 ast01() {
14 checkAst01(JS('', 'arguments.callee'));
15 print(ir01());
16 print(ir02());
17 return ast02(11);
18 }
19
20 @IrRepresentation(true)
21 ir01() => ir04();
22
23 @IrRepresentation(true)
24 ir02() => ast06(10, 20);
25
26 @IrRepresentation(false)
27 ast06(a,b) {
28 JS('', 'String("in ast06")');
29 return 3*a + b;
30 }
31
32 @IrRepresentation(true)
33 ir04() => ir05();
34
35 @IrRepresentation(true)
36 ir05() => ast07(1, 22);
37
38 @IrRepresentation(false)
39 ast07(i, j) {
40 var x = 0;
41 return ast08(i,j) ? i : j;
42 }
43
44 @IrRepresentation(false)
45 ast08(x,y) {
46 JS('', 'String("in ast08")');
47 return x - y < 0;
48 }
49
50 @IrRepresentation(false)
51 ast02(x) {
52 print(x);
53 ir06();
54 print(ir07());
55 }
56
57 @IrRepresentation(true)
58 ir06() => ast04(1,2,3);
59
60 @IrRepresentation(false)
61 ast04(a, b, c) {
62 print(a + b - c);
63 JS('', 'String("in ast04")');
64 }
65
66 @IrRepresentation(true)
67 ir07() => ir03();
68
69 @IrRepresentation(true)
70 ir03() => ast05(1,3);
71
72 @IrRepresentation(false)
73 ast05(a, b) {
74 JS('', 'String("in ast05")');
75 return (a+b)/2;
76 }
77
78 // The function ir08 is built by an SsaFromIrBuilder.
79 // Ast functions are inlined by an SsaFromAstInliner.
80
81 @NoInline()
82 @IrRepresentation(true)
83 ir08() => ir09();
84
85 ir09() => ast09();
86
87 ast09() {
88 checkIr08(JS('', 'arguments.callee'));
89 JS('', 'String("in ast09")');
90 print(ir01());
91 print(ir02());
92 print(ast02(11));
93 }
94
95 main() {
96 ast01();
97 ir08();
98 }
99
100 @NoInline()
101 check(func, names) {
102 var source = JS('String', 'String(#)', func);
103 print(source);
104 for (var f in names) {
105 Expect.isTrue(source.contains('"in $f"'), "should inline '$f'");
106 }
107 }
108
109 @NoInline
110 checkAst01(func) {
111 var names = ["ast04", "ast05", "ast06", "ast08"];
112 check(func, names);
113 }
114
115 checkIr08(func) {
116 var names = ["ast09", "ast04", "ast05", "ast06", "ast08"];
117 check(func, names);
118 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js_extra/ir_representation_test.dart ('k') | tests/compiler/dart2js_native/compiler_test_internals.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698