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

Unified Diff: runtime/vm/kernel_binary_flowgraph.cc

Issue 2949533003: Revert "Proper sequencing of _asyncStackTraceHelper in Kernel" (Closed)
Patch Set: Created 3 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 | « runtime/observatory/tests/service/service_kernel.status ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/kernel_binary_flowgraph.cc
diff --git a/runtime/vm/kernel_binary_flowgraph.cc b/runtime/vm/kernel_binary_flowgraph.cc
index 6d0725dce7990bae6ea00ea0de7bee9da9899048..37f596c4fa2535ec5c15ee3e6198bac1a1ef6388 100644
--- a/runtime/vm/kernel_binary_flowgraph.cc
+++ b/runtime/vm/kernel_binary_flowgraph.cc
@@ -3287,6 +3287,32 @@ FlowGraph* StreamingFlowGraphBuilder::BuildGraphOfFunction(
SkipDartType(); // read return type.
+ if (FLAG_causal_async_stacks &&
+ (dart_function.IsAsyncFunction() || dart_function.IsAsyncGenerator())) {
+ LocalScope* scope = parsed_function()->node_sequence()->scope();
+ // :async_stack_trace = _asyncStackTraceHelper(:async_op);
+ const dart::Library& async_lib =
+ dart::Library::Handle(dart::Library::AsyncLibrary());
+ const Function& target = Function::ZoneHandle(
+ Z,
+ async_lib.LookupFunctionAllowPrivate(Symbols::AsyncStackTraceHelper()));
+ ASSERT(!target.IsNull());
+
+ // TODO(johnmccutchan): Why does this have the null value?
+ LocalVariable* async_op =
+ scope->child()->LookupVariable(Symbols::AsyncOperation(), false);
+ ASSERT(async_op != NULL);
+ ASSERT(async_op->is_captured());
+ body += LoadLocal(async_op);
+ body += PushArgument();
+ body += StaticCall(TokenPosition::kNoSource, target, 1);
+ LocalVariable* async_stack_trace_var =
+ scope->LookupVariable(Symbols::AsyncStackTraceVar(), false);
+ ASSERT(async_stack_trace_var != NULL);
+ body += StoreLocal(TokenPosition::kNoSource, async_stack_trace_var);
+ body += Drop();
+ }
+
bool has_body = ReadTag() == kSomething; // read first part of body.
if (dart_function.is_native()) {
« no previous file with comments | « runtime/observatory/tests/service/service_kernel.status ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698