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

Unified Diff: tests/language/vm/lazy_deopt_with_exception_test.dart

Issue 2357343003: Fix lazy deoptimization in the presence of exceptions (Closed)
Patch Set: Ensure space for patching on ARM/MIPS archs Created 4 years, 3 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 | « runtime/vm/stub_code_x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/vm/lazy_deopt_with_exception_test.dart
diff --git a/tests/language/vm/lazy_deopt_with_exception_test.dart b/tests/language/vm/lazy_deopt_with_exception_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..a4943661bb63d035d61dfd6e7fc267ea1ad46d65
--- /dev/null
+++ b/tests/language/vm/lazy_deopt_with_exception_test.dart
@@ -0,0 +1,64 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// Test deoptimization on an optimistically hoisted smi check.
+// VMOptions=--optimization-counter-threshold=10 --no-background-compilation --enable-inlining-annotations
+
+// Test that lazy deoptimization works if the program returns to a function
+// that is scheduled for lazy deoptimization via an exception.
+
+import 'package:expect/expect.dart';
+
+class C {
+ var x = 42;
+}
+
+
+const NeverInline = "NeverInline";
+
+@NeverInline
+AA(C c, bool b) {
+ if (b) {
+ c.x = 2.5;
+ throw 123;
+ }
+}
+
+@NeverInline
+T1(C c, bool b) {
+ try {
+ AA(c, b);
+ } on dynamic {
+ }
+ return c.x + 1;
+}
+
+
+@NeverInline
+T2(C c, bool b) {
+ try {
+ AA(c, b);
+ } on String {
+ Expect.isTrue(false);
+ } on int catch(e) {
+ Expect.equals(e, 123);
+ Expect.equals(b, true);
+ Expect.equals(c.x, 2.5);
+ }
+ return c.x + 1;
+}
+
+
+main() {
+ var c = new C();
+ for (var i = 0; i < 10000; ++i) {
+ T1(c, false);
+ T2(c, false);
+ }
+ Expect.equals(43, T1(c, false));
+ Expect.equals(43, T2(c, false));
+ Expect.equals(3.5, T1(c, true));
+ Expect.equals(3.5, T2(c, true));
+}
+
+
« no previous file with comments | « runtime/vm/stub_code_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698