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

Unified Diff: test/cctest/compiler/test-run-jsexceptions.cc

Issue 972943004: [turbofan] Add test coverage for deopt within try-catch. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | test/mjsunit/compiler/try-deopt.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/test-run-jsexceptions.cc
diff --git a/test/cctest/compiler/test-run-jsexceptions.cc b/test/cctest/compiler/test-run-jsexceptions.cc
index 172f0f8914855fb634133ce9787e8c08d5b1a2a9..b1c1e4d63e9af5a690cec9a1378aa466493e0923 100644
--- a/test/cctest/compiler/test-run-jsexceptions.cc
+++ b/test/cctest/compiler/test-run-jsexceptions.cc
@@ -182,3 +182,78 @@ TEST(FinallyBreak) {
T.CheckCall(T.Val("-A-B-D-"), T.false_value(), T.true_value());
T.CheckCall(T.Val("-A-B-C-D-"), T.false_value(), T.false_value());
}
+
+
+TEST(DeoptTry) {
+ i::FLAG_turbo_exceptions = true;
+ i::FLAG_turbo_deoptimization = true;
+ const char* src =
+ "(function f(a) {"
+ " try {"
+ " %DeoptimizeFunction(f);"
+ " throw a;"
+ " } catch (e) {"
+ " return e + 1;"
+ " }"
+ "})";
+ FunctionTester T(src);
+
+#if 0 // TODO(mstarzinger): Enable once we can.
+ T.CheckCall(T.Val(2), T.Val(1));
+#endif
+}
+
+
+TEST(DeoptCatch) {
+ i::FLAG_turbo_exceptions = true;
+ i::FLAG_turbo_deoptimization = true;
+ const char* src =
+ "(function f(a) {"
+ " try {"
+ " throw a;"
+ " } catch (e) {"
+ " %DeoptimizeFunction(f);"
+ " return e + 1;"
+ " }"
+ "})";
+ FunctionTester T(src);
+
+ T.CheckCall(T.Val(2), T.Val(1));
+}
+
+
+TEST(DeoptFinallyReturn) {
+ i::FLAG_turbo_exceptions = true;
+ i::FLAG_turbo_deoptimization = true;
+ const char* src =
+ "(function f(a) {"
+ " try {"
+ " throw a;"
+ " } finally {"
+ " %DeoptimizeFunction(f);"
+ " return a + 1;"
+ " }"
+ "})";
+ FunctionTester T(src);
+
+ T.CheckCall(T.Val(2), T.Val(1));
+}
+
+
+TEST(DeoptFinallyReThrow) {
+ i::FLAG_turbo_exceptions = true;
+ i::FLAG_turbo_deoptimization = true;
+ const char* src =
+ "(function f(a) {"
+ " try {"
+ " throw a;"
+ " } finally {"
+ " %DeoptimizeFunction(f);"
+ " }"
+ "})";
+ FunctionTester T(src);
+
+#if 0 // TODO(mstarzinger): Enable once we can.
+ T.CheckThrows(T.NewObject("new Error"), T.Val(1));
+#endif
+}
« no previous file with comments | « no previous file | test/mjsunit/compiler/try-deopt.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698