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

Unified Diff: tests/language/try_catch_optimized5_test.dart

Issue 2388093003: VM: Make optimized try-catch work in DBC. (Closed)
Patch Set: address 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/corelib/corelib.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/try_catch_optimized5_test.dart
diff --git a/tests/language/try_catch_regress_27483_test.dart b/tests/language/try_catch_optimized5_test.dart
similarity index 53%
copy from tests/language/try_catch_regress_27483_test.dart
copy to tests/language/try_catch_optimized5_test.dart
index 4da202f1d6ee2a99c3f81eef5c22b71afdc0cb77..d96b1f0f2ac0ea8383fac0b00c2c9b6e8ba4b3f0 100644
--- a/tests/language/try_catch_regress_27483_test.dart
+++ b/tests/language/try_catch_optimized5_test.dart
@@ -5,7 +5,7 @@
// being thrown.
// VMOptions=--optimization-counter-threshold=100 --no-background-compilation --enable-inlining-annotations
-// Test local variables updated inside try-catch.
+// Test optional parameters updated inside try-catch
import "package:expect/expect.dart";
@@ -24,8 +24,7 @@ m2(int b) {
@noInline
-test(b) {
- var state = 0;
+test1(int b, [int state = 0]) {
try {
state++;
m1(b);
@@ -36,6 +35,26 @@ test(b) {
if (b == 1 && state != 1) throw "fail1";
if (b == 2 && state != 2) throw "fail2";
if (b == 3 && state != 3) throw "fail3";
+ if (s is! StackTrace) throw "fail4";
+ return e;
+ }
+ return "no throw";
+}
+
+@noInline
+test2(int b, [int state]) {
+ state = 0;
+ try {
+ state++;
+ m1(b);
+ state++;
+ m2(b);
+ state++;
+ } on dynamic catch (e, s) {
+ if (b == 1 && state != 1) throw "fail1";
+ if (b == 2 && state != 2) throw "fail2";
+ if (b == 3 && state != 3) throw "fail3";
+ if (s is! StackTrace) throw "fail4";
return e;
}
return "no throw";
@@ -43,9 +62,16 @@ test(b) {
main() {
for (var i=0; i<300; i++) {
- Expect.equals("no throw", test(0));
+ Expect.equals("no throw", test1(0));
+ }
+ Expect.equals("no throw", test1(0));
+ Expect.equals(123, test1(1));
+ Expect.equals(456, test1(2));
+
+ for (var i=0; i<300; i++) {
+ Expect.equals("no throw", test2(0));
}
- Expect.equals("no throw", test(0));
- Expect.equals(123, test(1));
- Expect.equals(456, test(2));
+ Expect.equals("no throw", test2(0));
+ Expect.equals(123, test2(1));
+ Expect.equals(456, test2(2));
}
« no previous file with comments | « tests/corelib/corelib.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698