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

Side by Side Diff: tests/language/try_catch_regress_27483_test.dart

Issue 2390423002: Fix try-catch optimizer. (Closed)
Patch Set: addressed comments Created 4 years, 2 months 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
« no previous file with comments | « runtime/vm/redundancy_elimination.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 // Dart test program for testing try/catch statement without any exceptions
5 // being thrown.
6 // VMOptions=--optimization-counter-threshold=100 --no-background-compilation -- enable-inlining-annotations
7
8 // Test local variables updated inside try-catch.
9
10 import "package:expect/expect.dart";
11
12 const noInline = "NeverInline";
13
14 @noInline
15 m1(int b) {
16 if (b == 1) throw 123;
17 }
18
19
20 @noInline
21 m2(int b) {
22 if (b == 2) throw 456;
23 }
24
25
26 @noInline
27 test(b) {
28 var state = 0;
29 try {
30 state++;
31 m1(b);
32 state++;
33 m2(b);
34 state++;
35 } on dynamic catch (e, s) {
36 if (b == 1 && state != 1) throw "fail1";
37 if (b == 2 && state != 2) throw "fail2";
38 if (b == 3 && state != 3) throw "fail3";
39 return e;
40 }
41 return "no throw";
42 }
43
44 main() {
45 for (var i=0; i<300; i++) {
46 Expect.equals("no throw", test(0));
47 }
48 Expect.equals("no throw", test(0));
49 Expect.equals(123, test(1));
50 Expect.equals(456, test(2));
51 }
OLDNEW
« no previous file with comments | « runtime/vm/redundancy_elimination.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698