OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Check that our SSA graph does have the try body a predecessor of a | 4 // Check that our SSA graph does have the try body a predecessor of a |
5 // try/finally. | 5 // try/finally. |
6 // VMOptions=--optimization-counter-threshold=10 | 6 // VMOptions=--optimization-counter-threshold=10 |
7 | 7 |
8 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
9 | 9 |
10 var a; | 10 var a; |
11 | 11 |
12 foo1() { | 12 foo1() { |
13 var b = false; | 13 var b = false; |
14 var entered = false; | 14 var entered = false; |
15 while (true) { | 15 while (true) { |
16 if (entered) return b; //# static warning | 16 if (entered) return b; //# static warning |
17 b = 8 == a; // This expression should not be GVN'ed. | 17 b = 8 == a; // This expression should not be GVN'ed. |
18 try { | 18 try { |
19 a = 8; | 19 a = 8; |
20 return; //# static warning | 20 return; //# static warning |
21 } finally { | 21 } finally { |
22 b = 8 == a; | 22 b = 8 == a; |
23 entered = true; | 23 entered = true; |
24 continue; | 24 continue; |
25 } | 25 } |
26 } | 26 } |
27 } | 27 } |
28 | 28 |
29 doThrow() { | 29 doThrow() { throw 2; } |
30 throw 2; | |
31 } | |
32 | 30 |
33 foo2() { | 31 foo2() { |
34 var b = false; | 32 var b = false; |
35 var entered = false; | 33 var entered = false; |
36 while (true) { | 34 while (true) { |
37 if (entered) return b; //# static warning | 35 if (entered) return b; //# static warning |
38 b = 8 == a; // This expression should not be GVN'ed. | 36 b = 8 == a; // This expression should not be GVN'ed. |
39 try { | 37 try { |
40 a = 8; | 38 a = 8; |
41 doThrow(); | 39 doThrow(); |
42 return; //# static warning | 40 return; //# static warning |
43 } catch (e) { | 41 } catch(e) { |
44 b = 8 == a; | 42 b = 8 == a; |
45 entered = true; | 43 entered = true; |
46 continue; | 44 continue; |
47 } | 45 } |
48 } | 46 } |
49 } | 47 } |
50 | 48 |
51 foo3() { | 49 foo3() { |
52 var b = false; | 50 var b = false; |
53 var entered = false; | 51 var entered = false; |
54 while (true) { | 52 while (true) { |
55 if (entered) return b; //# static warning | 53 if (entered) return b; //# static warning |
56 b = 8 == a; // This expression should not be GVN'ed. | 54 b = 8 == a; // This expression should not be GVN'ed. |
57 try { | 55 try { |
58 doThrow(); | 56 doThrow(); |
59 } catch (e) { | 57 } catch(e) { |
60 a = 8; | 58 a = 8; |
61 entered = true; | 59 entered = true; |
62 return; //# static warning | 60 return; //# static warning |
63 } finally { | 61 } finally { |
64 b = 8 == a; | 62 b = 8 == a; |
65 entered = true; | 63 entered = true; |
66 continue; | 64 continue; |
67 } | 65 } |
68 } | 66 } |
69 } | 67 } |
(...skipping 18 matching lines...) Expand all Loading... |
88 foo5() { | 86 foo5() { |
89 var b = false; | 87 var b = false; |
90 var entered = false; | 88 var entered = false; |
91 while (true) { | 89 while (true) { |
92 if (entered) return b; | 90 if (entered) return b; |
93 b = 8 == a; // This expression should not be GVN'ed. | 91 b = 8 == a; // This expression should not be GVN'ed. |
94 try { | 92 try { |
95 a = 8; | 93 a = 8; |
96 doThrow(); | 94 doThrow(); |
97 break; | 95 break; |
98 } catch (e) { | 96 } catch(e) { |
99 b = 8 == a; | 97 b = 8 == a; |
100 entered = true; | 98 entered = true; |
101 continue; | 99 continue; |
102 } | 100 } |
103 } | 101 } |
104 } | 102 } |
105 | 103 |
106 foo6() { | 104 foo6() { |
107 var b = false; | 105 var b = false; |
108 var entered = false; | 106 var entered = false; |
109 while (true) { | 107 while (true) { |
110 if (entered) return b; | 108 if (entered) return b; |
111 b = 8 == a; // This expression should not be GVN'ed. | 109 b = 8 == a; // This expression should not be GVN'ed. |
112 try { | 110 try { |
113 doThrow(); | 111 doThrow(); |
114 } catch (e) { | 112 } catch(e) { |
115 a = 8; | 113 a = 8; |
116 entered = true; | 114 entered = true; |
117 break; | 115 break; |
118 } finally { | 116 } finally { |
119 b = 8 == a; | 117 b = 8 == a; |
120 entered = true; | 118 entered = true; |
121 continue; | 119 continue; |
122 } | 120 } |
123 } | 121 } |
124 } | 122 } |
(...skipping 18 matching lines...) Expand all Loading... |
143 foo8() { | 141 foo8() { |
144 var b = false; | 142 var b = false; |
145 var entered = false; | 143 var entered = false; |
146 while (true) { | 144 while (true) { |
147 if (entered) return b; | 145 if (entered) return b; |
148 b = 8 == a; // This expression should not be GVN'ed. | 146 b = 8 == a; // This expression should not be GVN'ed. |
149 try { | 147 try { |
150 a = 8; | 148 a = 8; |
151 doThrow(); | 149 doThrow(); |
152 continue; | 150 continue; |
153 } catch (e) { | 151 } catch(e) { |
154 b = 8 == a; | 152 b = 8 == a; |
155 entered = true; | 153 entered = true; |
156 continue; | 154 continue; |
157 } | 155 } |
158 } | 156 } |
159 } | 157 } |
160 | 158 |
161 foo9() { | 159 foo9() { |
162 var b = false; | 160 var b = false; |
163 var entered = false; | 161 var entered = false; |
164 while (true) { | 162 while (true) { |
165 if (entered) return b; | 163 if (entered) return b; |
166 b = 8 == a; // This expression should not be GVN'ed. | 164 b = 8 == a; // This expression should not be GVN'ed. |
167 try { | 165 try { |
168 doThrow(); | 166 doThrow(); |
169 } catch (e) { | 167 } catch(e) { |
170 a = 8; | 168 a = 8; |
171 entered = true; | 169 entered = true; |
172 continue; | 170 continue; |
173 } finally { | 171 } finally { |
174 b = 8 == a; | 172 b = 8 == a; |
175 entered = true; | 173 entered = true; |
176 continue; | 174 continue; |
177 } | 175 } |
178 } | 176 } |
179 } | 177 } |
(...skipping 17 matching lines...) Expand all Loading... |
197 Expect.isTrue(foo8()); | 195 Expect.isTrue(foo8()); |
198 a = 0; | 196 a = 0; |
199 Expect.isTrue(foo9()); | 197 Expect.isTrue(foo9()); |
200 } | 198 } |
201 | 199 |
202 main() { | 200 main() { |
203 for (var i = 0; i < 20; i++) { | 201 for (var i = 0; i < 20; i++) { |
204 main_test(); | 202 main_test(); |
205 } | 203 } |
206 } | 204 } |
OLD | NEW |