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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 893193004: Propagate the stack trace of the inner-most throw when using async/await. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
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
Index: runtime/vm/flow_graph_builder.cc
diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc
index 64a4fed0abf9835cc33de948ff7805e2c2c32643..b192d111fbb6b69e87d26a50110dc7b9cdb1398c 100644
--- a/runtime/vm/flow_graph_builder.cc
+++ b/runtime/vm/flow_graph_builder.cc
@@ -1484,6 +1484,7 @@ AssertAssignableInstr* EffectGraphVisitor::BuildAssertAssignable(
void EffectGraphVisitor::BuildAwaitJump(LocalVariable* old_context,
LocalVariable* continuation_result,
LocalVariable* continuation_error,
+ LocalVariable* continuation_stack_trace,
const intptr_t old_ctx_level,
JoinEntryInstr* target) {
// Building a jump consists of the following actions:
@@ -1500,6 +1501,8 @@ void EffectGraphVisitor::BuildAwaitJump(LocalVariable* old_context,
Bind(BuildLoadLocal(*continuation_result)));
LocalVariable* temp_error_var = EnterTempLocalScope(
Bind(BuildLoadLocal(*continuation_error)));
+ LocalVariable* temp_stack_trace_var = EnterTempLocalScope(
+ Bind(BuildLoadLocal(*continuation_stack_trace)));
// Restore the saved continuation context.
BuildRestoreContext(*old_context);
@@ -1538,7 +1541,18 @@ void EffectGraphVisitor::BuildAwaitJump(LocalVariable* old_context,
Scanner::kNoSourcePos);
Do(store2);
+ context_val = Bind(new(I) LoadLocalInstr(*temp_context_var));
+ store_val = Bind(new(I) LoadLocalInstr(*temp_stack_trace_var));
+ StoreInstanceFieldInstr* store3 = new(I) StoreInstanceFieldInstr(
+ Context::variable_offset(continuation_stack_trace->index()),
+ context_val,
+ store_val,
+ kEmitStoreBarrier,
+ Scanner::kNoSourcePos);
+ Do(store3);
+
Do(ExitTempLocalScope(temp_context_var));
+ Do(ExitTempLocalScope(temp_stack_trace_var));
Do(ExitTempLocalScope(temp_error_var));
Do(ExitTempLocalScope(temp_result_var));
@@ -3901,6 +3915,8 @@ void EffectGraphVisitor::VisitSequenceNode(SequenceNode* node) {
Symbols::AsyncOperationParam(), false);
LocalVariable* continuation_error = top_scope->LookupVariable(
Symbols::AsyncOperationErrorParam(), false);
+ LocalVariable* continuation_stack_trace = top_scope->LookupVariable(
+ Symbols::AsyncOperationStackTraceParam(), false);
for (intptr_t i = 0; i < num_await_states; i++) {
check_jump_count = new(I) ComparisonNode(
Scanner::kNoSourcePos,
@@ -3916,6 +3932,7 @@ void EffectGraphVisitor::VisitSequenceNode(SequenceNode* node) {
for_true.BuildAwaitJump(old_context,
continuation_result,
continuation_error,
+ continuation_stack_trace,
(*owner()->await_levels())[i],
(*owner()->await_joins())[i]);
Join(for_test, for_true, for_false);
« no previous file with comments | « runtime/vm/flow_graph_builder.h ('k') | runtime/vm/parser.cc » ('j') | runtime/vm/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698