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() { throw 2; } | 29 doThrow() { throw 2; } |
30 | 30 |
31 foo2() { | 31 foo2() { |
32 var b = false; | 32 var b = false; |
33 var entered = false; | 33 var entered = false; |
34 while (true) { | 34 while (true) { |
35 if (entered) return b; /// static warning | 35 if (entered) return b; //# static warning |
36 b = 8 == a; // This expression should not be GVN'ed. | 36 b = 8 == a; // This expression should not be GVN'ed. |
37 try { | 37 try { |
38 a = 8; | 38 a = 8; |
39 doThrow(); | 39 doThrow(); |
40 return; /// static warning | 40 return; //# static warning |
41 } catch(e) { | 41 } catch(e) { |
42 b = 8 == a; | 42 b = 8 == a; |
43 entered = true; | 43 entered = true; |
44 continue; | 44 continue; |
45 } | 45 } |
46 } | 46 } |
47 } | 47 } |
48 | 48 |
49 foo3() { | 49 foo3() { |
50 var b = false; | 50 var b = false; |
51 var entered = false; | 51 var entered = false; |
52 while (true) { | 52 while (true) { |
53 if (entered) return b; /// static warning | 53 if (entered) return b; //# static warning |
54 b = 8 == a; // This expression should not be GVN'ed. | 54 b = 8 == a; // This expression should not be GVN'ed. |
55 try { | 55 try { |
56 doThrow(); | 56 doThrow(); |
57 } catch(e) { | 57 } catch(e) { |
58 a = 8; | 58 a = 8; |
59 entered = true; | 59 entered = true; |
60 return; /// static warning | 60 return; //# static warning |
61 } finally { | 61 } finally { |
62 b = 8 == a; | 62 b = 8 == a; |
63 entered = true; | 63 entered = true; |
64 continue; | 64 continue; |
65 } | 65 } |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 foo4() { | 69 foo4() { |
70 var b = false; | 70 var b = false; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 Expect.isTrue(foo8()); | 195 Expect.isTrue(foo8()); |
196 a = 0; | 196 a = 0; |
197 Expect.isTrue(foo9()); | 197 Expect.isTrue(foo9()); |
198 } | 198 } |
199 | 199 |
200 main() { | 200 main() { |
201 for (var i = 0; i < 20; i++) { | 201 for (var i = 0; i < 20; i++) { |
202 main_test(); | 202 main_test(); |
203 } | 203 } |
204 } | 204 } |
OLD | NEW |