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

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

Issue 2690873005: Enable causal stacktrace in kernel (Closed)
Patch Set: Change kernel function 'debuggable' field to an 'originalAsyncMarker' field, use it to set function… 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: pkg/kernel/lib/transformations/continuation.dart
diff --git a/pkg/kernel/lib/transformations/continuation.dart b/pkg/kernel/lib/transformations/continuation.dart
index 112ea43b8274b3f3e182cc2e99039834e589fcb6..da9430c168d37461a7e13dbd801cb5a534ff5d18 100644
--- a/pkg/kernel/lib/transformations/continuation.dart
+++ b/pkg/kernel/lib/transformations/continuation.dart
@@ -146,6 +146,7 @@ class SyncStarFunctionRewriter extends ContinuationRewriterBase {
..addAll(variableDeclarations())
..addAll([closureFunction, returnStatement]));
enclosingFunction.body.parent = enclosingFunction;
+ enclosingFunction.originalAsyncMarker = enclosingFunction.asyncMarker;
enclosingFunction.asyncMarker = AsyncMarker.Sync;
return enclosingFunction;
}
@@ -198,6 +199,8 @@ abstract class AsyncRewriterBase extends ContinuationRewriterBase {
new VariableDeclaration(":async_op_then");
final VariableDeclaration catchErrorContinuationVariable =
new VariableDeclaration(":async_op_error");
+ final VariableDeclaration asyncStackTrace =
+ new VariableDeclaration(":async_stack_trace");
LabeledStatement labeledBody;
@@ -215,6 +218,9 @@ abstract class AsyncRewriterBase extends ContinuationRewriterBase {
// var :async_op_error;
statements.add(catchErrorContinuationVariable);
+ // var :async_stack_trace;
+ statements.add(asyncStackTrace);
+
// :async_op([:result, :exception, :stack_trace]) {
// modified <node.body>;
// }
@@ -258,6 +264,13 @@ abstract class AsyncRewriterBase extends ContinuationRewriterBase {
new VariableSet(
catchErrorContinuationVariable, boundCatchErrorClosure));
statements.add(catchErrorClosureVariableAssign);
+
+ // :async_stack_trace = _asyncStackTraceHelper();
+ final boundAsyncStackTrace = new StaticInvocation(
+ helper.asyncStackTraceHelper, new Arguments.empty());
+ final asyncStackTraceVariableAssign = new ExpressionStatement(
+ new VariableSet(asyncStackTrace, boundAsyncStackTrace));
+ statements.add(asyncStackTraceVariableAssign);
kustermann 2017/02/22 11:08:25 We could actually just create the variable here an
jensj 2017/02/23 09:40:26 Attempt made.
}
Statement buildWrappedBody() {
@@ -698,6 +711,7 @@ class AsyncStarFunctionRewriter extends AsyncRewriterBase {
enclosingFunction.body = new Block(statements);
enclosingFunction.body.parent = enclosingFunction;
+ enclosingFunction.originalAsyncMarker = enclosingFunction.asyncMarker;
enclosingFunction.asyncMarker = AsyncMarker.Sync;
return enclosingFunction;
}
@@ -820,8 +834,8 @@ class AsyncFunctionRewriter extends AsyncRewriterBase {
enclosingFunction.body = new Block(statements);
enclosingFunction.body.parent = enclosingFunction;
+ enclosingFunction.originalAsyncMarker = enclosingFunction.asyncMarker;
enclosingFunction.asyncMarker = AsyncMarker.Sync;
- enclosingFunction.debuggable = false;
return enclosingFunction;
}
@@ -874,6 +888,7 @@ class HelperNodes {
final Constructor streamIteratorConstructor;
final Procedure asyncThenWrapper;
final Procedure asyncErrorWrapper;
+ final Procedure asyncStackTraceHelper;
final Procedure awaitHelper;
final CoreTypes coreTypes;
@@ -891,6 +906,7 @@ class HelperNodes {
this.streamControllerConstructor,
this.asyncThenWrapper,
this.asyncErrorWrapper,
+ this.asyncStackTraceHelper,
this.awaitHelper,
this.coreTypes);
@@ -973,6 +989,7 @@ class HelperNodes {
findConstructor(streamControllerClass, ''),
findProcedure(asyncLibrary, '_asyncThenWrapperHelper'),
findProcedure(asyncLibrary, '_asyncErrorWrapperHelper'),
+ findProcedure(asyncLibrary, '_asyncStackTraceHelper'),
findProcedure(asyncLibrary, '_awaitHelper'),
new CoreTypes(program));
}

Powered by Google App Engine
This is Rietveld 408576698