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

Unified Diff: runtime/vm/object.cc

Issue 2692803006: Track the 'awaiter return' call stack use it to detect uncaught exceptions in async functions (Closed)
Patch Set: rmacnak review Created 3 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
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index e09af298e4f2d5f263e741b2b3d5ba59f737ddf1..005fcef1f9758b03faaceb55760ca349b2bd1b46 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -12493,7 +12493,9 @@ void ExceptionHandlers::SetHandlerInfo(intptr_t try_index,
intptr_t outer_try_index,
uword handler_pc_offset,
bool needs_stacktrace,
- bool has_catch_all) const {
+ bool has_catch_all,
+ TokenPosition token_pos,
+ bool is_generated) const {
ASSERT((try_index >= 0) && (try_index < num_entries()));
NoSafepointScope no_safepoint;
ExceptionHandlerInfo* info =
@@ -12506,6 +12508,7 @@ void ExceptionHandlers::SetHandlerInfo(intptr_t try_index,
info->handler_pc_offset = handler_pc_offset;
info->needs_stacktrace = needs_stacktrace;
info->has_catch_all = has_catch_all;
+ info->is_generated = is_generated;
}
void ExceptionHandlers::GetHandlerInfo(intptr_t try_index,
@@ -12534,6 +12537,12 @@ bool ExceptionHandlers::NeedsStackTrace(intptr_t try_index) const {
}
+bool ExceptionHandlers::IsGenerated(intptr_t try_index) const {
+ ASSERT((try_index >= 0) && (try_index < num_entries()));
+ return raw_ptr()->data()[try_index].is_generated;
+}
+
+
bool ExceptionHandlers::HasCatchAll(intptr_t try_index) const {
ASSERT((try_index >= 0) && (try_index < num_entries()));
return raw_ptr()->data()[try_index].has_catch_all;
@@ -12612,7 +12621,7 @@ RawExceptionHandlers* ExceptionHandlers::New(const Array& handled_types_data) {
const char* ExceptionHandlers::ToCString() const {
-#define FORMAT1 "%" Pd " => %#x (%" Pd " types) (outer %d)\n"
+#define FORMAT1 "%" Pd " => %#x (%" Pd " types) (outer %d) %s\n"
#define FORMAT2 " %d. %s\n"
if (num_entries() == 0) {
return "empty ExceptionHandlers\n";
@@ -12628,7 +12637,8 @@ const char* ExceptionHandlers::ToCString() const {
const intptr_t num_types =
handled_types.IsNull() ? 0 : handled_types.Length();
len += OS::SNPrint(NULL, 0, FORMAT1, i, info.handler_pc_offset, num_types,
- info.outer_try_index);
+ info.outer_try_index,
+ info.is_generated ? "(generated)" : "");
for (int k = 0; k < num_types; k++) {
type ^= handled_types.At(k);
ASSERT(!type.IsNull());
@@ -12646,7 +12656,8 @@ const char* ExceptionHandlers::ToCString() const {
handled_types.IsNull() ? 0 : handled_types.Length();
num_chars +=
OS::SNPrint((buffer + num_chars), (len - num_chars), FORMAT1, i,
- info.handler_pc_offset, num_types, info.outer_try_index);
+ info.handler_pc_offset, num_types, info.outer_try_index,
+ info.is_generated ? "(generated)" : "");
for (int k = 0; k < num_types; k++) {
type ^= handled_types.At(k);
num_chars += OS::SNPrint((buffer + num_chars), (len - num_chars), FORMAT2,

Powered by Google App Engine
This is Rietveld 408576698