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

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

Issue 979173002: [turbofan] Preserve pending message while inside finally-block. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Followup fixes. Created 5 years, 9 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 | « src/compiler/simplified-lowering.cc ('k') | no next file » | 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 5cafc34fdcffe12a17adeef6830e2b6a2452bd02..9b31fe09be15837c4b6df313437eb0a4f5b9f45f 100644
--- a/test/cctest/compiler/test-run-jsexceptions.cc
+++ b/test/cctest/compiler/test-run-jsexceptions.cc
@@ -18,7 +18,7 @@ TEST(Throw) {
}
-TEST(ThrowSourcePosition) {
+TEST(ThrowMessagePosition) {
i::FLAG_turbo_exceptions = true;
static const char* src =
"(function(a, b) { \n"
@@ -47,6 +47,48 @@ TEST(ThrowSourcePosition) {
}
+TEST(ThrowMessageDirectly) {
+ i::FLAG_turbo_exceptions = true;
+ static const char* src =
+ "(function(a, b) {"
+ " if (a) { throw b; } else { throw new Error(b); }"
+ "})";
+ FunctionTester T(src);
+ v8::Handle<v8::Message> message;
+
+ message = T.CheckThrowsReturnMessage(T.false_value(), T.Val("Wat?"));
+ CHECK(!message.IsEmpty());
+ CHECK(message->Get()->Equals(v8_str("Uncaught Error: Wat?")));
+
+ message = T.CheckThrowsReturnMessage(T.true_value(), T.Val("Kaboom!"));
+ CHECK(!message.IsEmpty());
+ CHECK(message->Get()->Equals(v8_str("Uncaught Kaboom!")));
+}
+
+
+TEST(ThrowMessageIndirectly) {
+ i::FLAG_turbo_exceptions = true;
+ static const char* src =
+ "(function(a, b) {"
+ " try {"
+ " if (a) { throw b; } else { throw new Error(b); }"
+ " } finally {"
+ " try { throw 'clobber'; } catch (e) { 'unclobber'; }"
+ " }"
+ "})";
+ FunctionTester T(src);
+ v8::Handle<v8::Message> message;
+
+ message = T.CheckThrowsReturnMessage(T.false_value(), T.Val("Wat?"));
+ CHECK(!message.IsEmpty());
+ CHECK(message->Get()->Equals(v8_str("Uncaught Error: Wat?")));
+
+ message = T.CheckThrowsReturnMessage(T.true_value(), T.Val("Kaboom!"));
+ CHECK(!message.IsEmpty());
+ CHECK(message->Get()->Equals(v8_str("Uncaught Kaboom!")));
+}
+
+
// TODO(mstarzinger): Increase test coverage by having similar tests within the
// mjsunit suite to also test integration with other components (e.g. OSR).
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698