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

Side by Side Diff: pkg/kernel/lib/transformations/continuation.dart

Issue 2697083002: Revert "Enable causal stacktrace in kernel" (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | runtime/vm/kernel_to_il.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library kernel.transformations.continuation; 5 library kernel.transformations.continuation;
6 6
7 import 'dart:math' as math; 7 import 'dart:math' as math;
8 8
9 import '../ast.dart'; 9 import '../ast.dart';
10 import '../core_types.dart'; 10 import '../core_types.dart';
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 } 191 }
192 } 192 }
193 193
194 abstract class AsyncRewriterBase extends ContinuationRewriterBase { 194 abstract class AsyncRewriterBase extends ContinuationRewriterBase {
195 final VariableDeclaration nestedClosureVariable = 195 final VariableDeclaration nestedClosureVariable =
196 new VariableDeclaration(":async_op"); 196 new VariableDeclaration(":async_op");
197 final VariableDeclaration thenContinuationVariable = 197 final VariableDeclaration thenContinuationVariable =
198 new VariableDeclaration(":async_op_then"); 198 new VariableDeclaration(":async_op_then");
199 final VariableDeclaration catchErrorContinuationVariable = 199 final VariableDeclaration catchErrorContinuationVariable =
200 new VariableDeclaration(":async_op_error"); 200 new VariableDeclaration(":async_op_error");
201 final VariableDeclaration asyncStackTrace =
202 new VariableDeclaration(":async_stack_trace");
203 201
204 LabeledStatement labeledBody; 202 LabeledStatement labeledBody;
205 203
206 ExpressionLifter expressionRewriter; 204 ExpressionLifter expressionRewriter;
207 205
208 AsyncRewriterBase(helper, enclosingFunction) 206 AsyncRewriterBase(helper, enclosingFunction)
209 : super(helper, enclosingFunction) {} 207 : super(helper, enclosingFunction) {}
210 208
211 void setupAsyncContinuations(List<Statement> statements) { 209 void setupAsyncContinuations(List<Statement> statements) {
212 expressionRewriter = new ExpressionLifter(this); 210 expressionRewriter = new ExpressionLifter(this);
213 211
214 // var :async_op_then; 212 // var :async_op_then;
215 statements.add(thenContinuationVariable); 213 statements.add(thenContinuationVariable);
216 214
217 // var :async_op_error; 215 // var :async_op_error;
218 statements.add(catchErrorContinuationVariable); 216 statements.add(catchErrorContinuationVariable);
219 217
220 // var :async_stack_trace;
221 statements.add(asyncStackTrace);
222
223 // :async_op([:result, :exception, :stack_trace]) { 218 // :async_op([:result, :exception, :stack_trace]) {
224 // modified <node.body>; 219 // modified <node.body>;
225 // } 220 // }
226 final parameters = <VariableDeclaration>[ 221 final parameters = <VariableDeclaration>[
227 expressionRewriter.asyncResult, 222 expressionRewriter.asyncResult,
228 new VariableDeclaration(':exception'), 223 new VariableDeclaration(':exception'),
229 new VariableDeclaration(':stack_trace'), 224 new VariableDeclaration(':stack_trace'),
230 ]; 225 ];
231 final function = new FunctionNode(buildWrappedBody(), 226 final function = new FunctionNode(buildWrappedBody(),
232 positionalParameters: parameters, 227 positionalParameters: parameters,
(...skipping 23 matching lines...) Expand all
256 statements.add(thenClosureVariableAssign); 251 statements.add(thenClosureVariableAssign);
257 252
258 // :async_op_error = _asyncErrorWrapperHelper(asyncBody); 253 // :async_op_error = _asyncErrorWrapperHelper(asyncBody);
259 final boundCatchErrorClosure = new StaticInvocation( 254 final boundCatchErrorClosure = new StaticInvocation(
260 helper.asyncErrorWrapper, 255 helper.asyncErrorWrapper,
261 new Arguments(<Expression>[new VariableGet(nestedClosureVariable)])); 256 new Arguments(<Expression>[new VariableGet(nestedClosureVariable)]));
262 final catchErrorClosureVariableAssign = new ExpressionStatement( 257 final catchErrorClosureVariableAssign = new ExpressionStatement(
263 new VariableSet( 258 new VariableSet(
264 catchErrorContinuationVariable, boundCatchErrorClosure)); 259 catchErrorContinuationVariable, boundCatchErrorClosure));
265 statements.add(catchErrorClosureVariableAssign); 260 statements.add(catchErrorClosureVariableAssign);
266
267 // :async_stack_trace = _asyncStackTraceHelper();
268 final boundAsyncStackTrace = new StaticInvocation(
269 helper.asyncStackTraceHelper, new Arguments.empty());
270 final asyncStackTraceVariableAssign = new ExpressionStatement(
271 new VariableSet(asyncStackTrace, boundAsyncStackTrace));
272 statements.add(asyncStackTraceVariableAssign);
273 } 261 }
274 262
275 Statement buildWrappedBody() { 263 Statement buildWrappedBody() {
276 ++currentTryDepth; 264 ++currentTryDepth;
277 labeledBody = new LabeledStatement(null); 265 labeledBody = new LabeledStatement(null);
278 labeledBody.body = visitDelimited(enclosingFunction.body) 266 labeledBody.body = visitDelimited(enclosingFunction.body)
279 ..parent = labeledBody; 267 ..parent = labeledBody;
280 --currentTryDepth; 268 --currentTryDepth;
281 269
282 var exceptionVariable = new VariableDeclaration(":exception"); 270 var exceptionVariable = new VariableDeclaration(":exception");
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 final Class futureClass; 867 final Class futureClass;
880 final Class completerClass; 868 final Class completerClass;
881 final Procedure printProcedure; 869 final Procedure printProcedure;
882 final Procedure completerConstructor; 870 final Procedure completerConstructor;
883 final Procedure futureMicrotaskConstructor; 871 final Procedure futureMicrotaskConstructor;
884 final Constructor streamControllerConstructor; 872 final Constructor streamControllerConstructor;
885 final Constructor syncIterableConstructor; 873 final Constructor syncIterableConstructor;
886 final Constructor streamIteratorConstructor; 874 final Constructor streamIteratorConstructor;
887 final Procedure asyncThenWrapper; 875 final Procedure asyncThenWrapper;
888 final Procedure asyncErrorWrapper; 876 final Procedure asyncErrorWrapper;
889 final Procedure asyncStackTraceHelper;
890 final Procedure awaitHelper; 877 final Procedure awaitHelper;
891 final CoreTypes coreTypes; 878 final CoreTypes coreTypes;
892 879
893 HelperNodes( 880 HelperNodes(
894 this.asyncLibrary, 881 this.asyncLibrary,
895 this.coreLibrary, 882 this.coreLibrary,
896 this.iteratorClass, 883 this.iteratorClass,
897 this.futureClass, 884 this.futureClass,
898 this.completerClass, 885 this.completerClass,
899 this.printProcedure, 886 this.printProcedure,
900 this.completerConstructor, 887 this.completerConstructor,
901 this.syncIterableConstructor, 888 this.syncIterableConstructor,
902 this.streamIteratorConstructor, 889 this.streamIteratorConstructor,
903 this.futureMicrotaskConstructor, 890 this.futureMicrotaskConstructor,
904 this.streamControllerConstructor, 891 this.streamControllerConstructor,
905 this.asyncThenWrapper, 892 this.asyncThenWrapper,
906 this.asyncErrorWrapper, 893 this.asyncErrorWrapper,
907 this.asyncStackTraceHelper,
908 this.awaitHelper, 894 this.awaitHelper,
909 this.coreTypes); 895 this.coreTypes);
910 896
911 factory HelperNodes.fromProgram(Program program) { 897 factory HelperNodes.fromProgram(Program program) {
912 Library findLibrary(String name) { 898 Library findLibrary(String name) {
913 Uri uri = Uri.parse(name); 899 Uri uri = Uri.parse(name);
914 for (var library in program.libraries) { 900 for (var library in program.libraries) {
915 if (library.importUri == uri) return library; 901 if (library.importUri == uri) return library;
916 } 902 }
917 throw 'Library "$name" not found'; 903 throw 'Library "$name" not found';
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 futureClass, 966 futureClass,
981 completerClass, 967 completerClass,
982 findProcedure(coreLibrary, 'print'), 968 findProcedure(coreLibrary, 'print'),
983 findFactoryConstructor(completerClass, 'sync'), 969 findFactoryConstructor(completerClass, 'sync'),
984 findConstructor(syncIterableClass, ''), 970 findConstructor(syncIterableClass, ''),
985 findConstructor(streamIteratorClass, ''), 971 findConstructor(streamIteratorClass, ''),
986 findFactoryConstructor(futureClass, 'microtask'), 972 findFactoryConstructor(futureClass, 'microtask'),
987 findConstructor(streamControllerClass, ''), 973 findConstructor(streamControllerClass, ''),
988 findProcedure(asyncLibrary, '_asyncThenWrapperHelper'), 974 findProcedure(asyncLibrary, '_asyncThenWrapperHelper'),
989 findProcedure(asyncLibrary, '_asyncErrorWrapperHelper'), 975 findProcedure(asyncLibrary, '_asyncErrorWrapperHelper'),
990 findProcedure(asyncLibrary, '_asyncStackTraceHelper'),
991 findProcedure(asyncLibrary, '_awaitHelper'), 976 findProcedure(asyncLibrary, '_awaitHelper'),
992 new CoreTypes(program)); 977 new CoreTypes(program));
993 } 978 }
994 } 979 }
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/kernel_to_il.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698