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

Unified Diff: pkg/kernel/lib/transformations/continuation.dart

Issue 2936793003: Proper sequencing of _asyncStackTraceHelper in Kernel (Closed)
Patch Set: Rebase before landing. 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 | « pkg/kernel/lib/core_types.dart ('k') | runtime/lib/stacktrace.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/lib/transformations/continuation.dart
diff --git a/pkg/kernel/lib/transformations/continuation.dart b/pkg/kernel/lib/transformations/continuation.dart
index 632731756d68c6aaebf3d8dd38724047df8416e9..cce8f561545bc3868f5151863a16786620517ac9 100644
--- a/pkg/kernel/lib/transformations/continuation.dart
+++ b/pkg/kernel/lib/transformations/continuation.dart
@@ -215,6 +215,8 @@ class SyncStarFunctionRewriter extends ContinuationRewriterBase {
abstract class AsyncRewriterBase extends ContinuationRewriterBase {
final VariableDeclaration nestedClosureVariable =
new VariableDeclaration(":async_op");
+ final VariableDeclaration stackTraceVariable =
+ new VariableDeclaration(":async_stack_trace");
final VariableDeclaration thenContinuationVariable =
new VariableDeclaration(":async_op_then");
final VariableDeclaration catchErrorContinuationVariable =
@@ -230,6 +232,9 @@ abstract class AsyncRewriterBase extends ContinuationRewriterBase {
void setupAsyncContinuations(List<Statement> statements) {
expressionRewriter = new ExpressionLifter(this);
+ // var :async_stack_trace;
+ statements.add(stackTraceVariable);
+
// var :async_op_then;
statements.add(thenContinuationVariable);
@@ -269,6 +274,13 @@ abstract class AsyncRewriterBase extends ContinuationRewriterBase {
..fileOffset = enclosingFunction.parent.fileOffset;
statements.add(closureFunction);
+ // :async_stack_trace = _asyncStackTraceHelper(asyncBody);
+ final stackTrace = new StaticInvocation(helper.asyncStackTraceHelper,
+ new Arguments(<Expression>[new VariableGet(nestedClosureVariable)]));
+ final stackTraceAssign = new ExpressionStatement(
+ new VariableSet(stackTraceVariable, stackTrace));
+ statements.add(stackTraceAssign);
+
// :async_op_then = _asyncThenWrapperHelper(asyncBody);
final boundThenClosure = new StaticInvocation(helper.asyncThenWrapper,
new Arguments(<Expression>[new VariableGet(nestedClosureVariable)]));
@@ -905,6 +917,7 @@ class HelperNodes {
final Constructor streamControllerConstructor;
final Constructor syncIterableConstructor;
final Constructor streamIteratorConstructor;
+ final Procedure asyncStackTraceHelper;
final Procedure asyncThenWrapper;
final Procedure asyncErrorWrapper;
final Procedure awaitHelper;
@@ -923,6 +936,7 @@ class HelperNodes {
this.streamIteratorConstructor,
this.futureMicrotaskConstructor,
this.streamControllerConstructor,
+ this.asyncStackTraceHelper,
this.asyncThenWrapper,
this.asyncErrorWrapper,
this.awaitHelper,
@@ -942,6 +956,7 @@ class HelperNodes {
coreTypes.streamIteratorDefaultConstructor,
coreTypes.futureMicrotaskConstructor,
coreTypes.asyncStarStreamControllerDefaultConstructor,
+ coreTypes.asyncStackTraceHelperProcedure,
coreTypes.asyncThenWrapperHelperProcedure,
coreTypes.asyncErrorWrapperHelperProcedure,
coreTypes.awaitHelperProcedure,
« no previous file with comments | « pkg/kernel/lib/core_types.dart ('k') | runtime/lib/stacktrace.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698