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 --no-background-compilation | 6 // VMOptions=--optimization-counter-threshold=10 --no-background-compilation |
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; | 16 if (entered) return b; |
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; | 20 return; |
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() { throw 2; } | 29 doThrow() { |
| 30 throw 2; |
| 31 } |
30 | 32 |
31 foo2() { | 33 foo2() { |
32 var b = false; | 34 var b = false; |
33 var entered = false; | 35 var entered = false; |
34 while (true) { | 36 while (true) { |
35 if (entered) return b; | 37 if (entered) return b; |
36 b = 8 == a; // This expression should not be GVN'ed. | 38 b = 8 == a; // This expression should not be GVN'ed. |
37 try { | 39 try { |
38 a = 8; | 40 a = 8; |
39 doThrow(); | 41 doThrow(); |
40 return; | 42 return; |
41 } catch(e) { | 43 } catch (e) { |
42 b = 8 == a; | 44 b = 8 == a; |
43 entered = true; | 45 entered = true; |
44 continue; | 46 continue; |
45 } | 47 } |
46 } | 48 } |
47 } | 49 } |
48 | 50 |
49 foo3() { | 51 foo3() { |
50 var b = false; | 52 var b = false; |
51 var entered = false; | 53 var entered = false; |
52 while (true) { | 54 while (true) { |
53 if (entered) return b; | 55 if (entered) return b; |
54 b = 8 == a; // This expression should not be GVN'ed. | 56 b = 8 == a; // This expression should not be GVN'ed. |
55 try { | 57 try { |
56 doThrow(); | 58 doThrow(); |
57 } catch(e) { | 59 } catch (e) { |
58 a = 8; | 60 a = 8; |
59 entered = true; | 61 entered = true; |
60 return; | 62 return; |
61 } finally { | 63 } finally { |
62 b = 8 == a; | 64 b = 8 == a; |
63 entered = true; | 65 entered = true; |
64 continue; | 66 continue; |
65 } | 67 } |
66 } | 68 } |
67 } | 69 } |
(...skipping 18 matching lines...) Expand all Loading... |
86 foo5() { | 88 foo5() { |
87 var b = false; | 89 var b = false; |
88 var entered = false; | 90 var entered = false; |
89 while (true) { | 91 while (true) { |
90 if (entered) return b; | 92 if (entered) return b; |
91 b = 8 == a; // This expression should not be GVN'ed. | 93 b = 8 == a; // This expression should not be GVN'ed. |
92 try { | 94 try { |
93 a = 8; | 95 a = 8; |
94 doThrow(); | 96 doThrow(); |
95 break; | 97 break; |
96 } catch(e) { | 98 } catch (e) { |
97 b = 8 == a; | 99 b = 8 == a; |
98 entered = true; | 100 entered = true; |
99 continue; | 101 continue; |
100 } | 102 } |
101 } | 103 } |
102 } | 104 } |
103 | 105 |
104 foo6() { | 106 foo6() { |
105 var b = false; | 107 var b = false; |
106 var entered = false; | 108 var entered = false; |
107 while (true) { | 109 while (true) { |
108 if (entered) return b; | 110 if (entered) return b; |
109 b = 8 == a; // This expression should not be GVN'ed. | 111 b = 8 == a; // This expression should not be GVN'ed. |
110 try { | 112 try { |
111 doThrow(); | 113 doThrow(); |
112 } catch(e) { | 114 } catch (e) { |
113 a = 8; | 115 a = 8; |
114 entered = true; | 116 entered = true; |
115 break; | 117 break; |
116 } finally { | 118 } finally { |
117 b = 8 == a; | 119 b = 8 == a; |
118 entered = true; | 120 entered = true; |
119 continue; | 121 continue; |
120 } | 122 } |
121 } | 123 } |
122 } | 124 } |
(...skipping 18 matching lines...) Expand all Loading... |
141 foo8() { | 143 foo8() { |
142 var b = false; | 144 var b = false; |
143 var entered = false; | 145 var entered = false; |
144 while (true) { | 146 while (true) { |
145 if (entered) return b; | 147 if (entered) return b; |
146 b = 8 == a; // This expression should not be GVN'ed. | 148 b = 8 == a; // This expression should not be GVN'ed. |
147 try { | 149 try { |
148 a = 8; | 150 a = 8; |
149 doThrow(); | 151 doThrow(); |
150 continue; | 152 continue; |
151 } catch(e) { | 153 } catch (e) { |
152 b = 8 == a; | 154 b = 8 == a; |
153 entered = true; | 155 entered = true; |
154 continue; | 156 continue; |
155 } | 157 } |
156 } | 158 } |
157 } | 159 } |
158 | 160 |
159 foo9() { | 161 foo9() { |
160 var b = false; | 162 var b = false; |
161 var entered = false; | 163 var entered = false; |
162 while (true) { | 164 while (true) { |
163 if (entered) return b; | 165 if (entered) return b; |
164 b = 8 == a; // This expression should not be GVN'ed. | 166 b = 8 == a; // This expression should not be GVN'ed. |
165 try { | 167 try { |
166 doThrow(); | 168 doThrow(); |
167 } catch(e) { | 169 } catch (e) { |
168 a = 8; | 170 a = 8; |
169 entered = true; | 171 entered = true; |
170 continue; | 172 continue; |
171 } finally { | 173 } finally { |
172 b = 8 == a; | 174 b = 8 == a; |
173 entered = true; | 175 entered = true; |
174 continue; | 176 continue; |
175 } | 177 } |
176 } | 178 } |
177 } | 179 } |
(...skipping 17 matching lines...) Expand all Loading... |
195 Expect.isTrue(foo8()); | 197 Expect.isTrue(foo8()); |
196 a = 0; | 198 a = 0; |
197 Expect.isTrue(foo9()); | 199 Expect.isTrue(foo9()); |
198 } | 200 } |
199 | 201 |
200 main() { | 202 main() { |
201 for (var i = 0; i < 20; i++) { | 203 for (var i = 0; i < 20; i++) { |
202 main_test(); | 204 main_test(); |
203 } | 205 } |
204 } | 206 } |
OLD | NEW |