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

Unified Diff: test/mjsunit/compiler/try-osr.js

Issue 1165103003: [turbofan] Add mjsunit tests for try-catch-finally and OSR. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_trycatch-flag
Patch Set: Tiny cleanup. Created 5 years, 6 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 | « test/cctest/compiler/test-run-jsexceptions.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/compiler/try-osr.js
diff --git a/test/mjsunit/compiler/try-osr.js b/test/mjsunit/compiler/try-osr.js
new file mode 100644
index 0000000000000000000000000000000000000000..e4eb8dd9fa1621b0314389201f7252fed36423a6
--- /dev/null
+++ b/test/mjsunit/compiler/try-osr.js
@@ -0,0 +1,51 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax --turbo-osr
+
+function OSRInsideTry(x) {
+ try {
+ for (var i = 0; i < 10; i++) { if (i == 5) %OptimizeOsr(); }
+ throw x;
+ } catch (e) {
+ return e + 1;
+ }
+ return x + 2;
+}
+assertEquals(24, OSRInsideTry(23));
+
+
+function OSRInsideCatch(x) {
+ try {
+ throw x;
+ } catch (e) {
+ for (var i = 0; i < 10; i++) { if (i == 5) %OptimizeOsr(); }
+ return e + 1;
+ }
+ return x + 2;
+}
+assertEquals(24, OSRInsideCatch(23));
+
+
+function OSRInsideFinally_Return(x) {
+ try {
+ throw x;
+ } finally {
+ for (var i = 0; i < 10; i++) { if (i == 5) %OptimizeOsr(); }
+ return x + 1;
+ }
+ return x + 2;
+}
+assertEquals(24, OSRInsideFinally_Return(23));
+
+
+function OSRInsideFinally_ReThrow(x) {
+ try {
+ throw x;
+ } finally {
+ for (var i = 0; i < 10; i++) { if (i == 5) %OptimizeOsr(); }
+ }
+ return x + 2;
+}
+assertThrows("OSRInsideFinally_ReThrow(new Error)", Error);
« no previous file with comments | « test/cctest/compiler/test-run-jsexceptions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698