OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016, 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 // VMOptions=--optimization_counter_threshold=100 --no-use-osr --no-background_c
ompilation |
| 5 |
| 6 // Test CHA-based optimizations in presence of try-catch. |
| 7 |
| 8 import "package:expect/expect.dart"; |
| 9 |
| 10 bar(i) { |
| 11 if (i == 11) throw 123; |
| 12 } |
| 13 |
| 14 class A { |
| 15 var f = 42; |
| 16 |
| 17 foo(i) { |
| 18 do { |
| 19 try { |
| 20 bar(i); |
| 21 } catch (e, s) { |
| 22 Expect.equals(123, e); |
| 23 } |
| 24 } while (i < 0); |
| 25 return f; |
| 26 } |
| 27 } |
| 28 |
| 29 class B extends A { |
| 30 |
| 31 } |
| 32 |
| 33 main() { |
| 34 var result; |
| 35 for (var i = 0; i < 200; i++) { |
| 36 try { |
| 37 result = new B().foo(i); |
| 38 } catch (e) { } |
| 39 } |
| 40 Expect.equals(42, result); |
| 41 } |
OLD | NEW |