Revert "Proper sequencing of _asyncStackTraceHelper in Kernel"

This reverts commit 0489249d29.  The
change causes failures in the front end tests.

BUG=
R=sivachandra@google.com

Review-Url: https://codereview.chromium.org/2949533003 .
This commit is contained in:
Kevin Millikin 2017-06-19 17:21:18 +02:00
parent f9dc588a27
commit 8340cfda55
6 changed files with 34 additions and 28 deletions

View file

@ -77,7 +77,6 @@ class CoreTypes {
Constructor _syncIterableDefaultConstructor;
Constructor _streamIteratorDefaultConstructor;
Constructor _asyncStarStreamControllerDefaultConstructor;
Procedure _asyncStackTraceHelperProcedure;
Procedure _asyncThenWrapperHelperProcedure;
Procedure _asyncErrorWrapperHelperProcedure;
Procedure _awaitHelperProcedure;
@ -101,11 +100,6 @@ class CoreTypes {
_index.getMember('dart:async', '_AsyncStarStreamController', '');
}
Procedure get asyncStackTraceHelperProcedure {
return _asyncStackTraceHelperProcedure ??=
_index.getTopLevelMember('dart:async', '_asyncStackTraceHelper');
}
Procedure get asyncThenWrapperHelperProcedure {
return _asyncThenWrapperHelperProcedure ??=
_index.getTopLevelMember('dart:async', '_asyncThenWrapperHelper');

View file

@ -215,8 +215,6 @@ 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 =
@ -232,9 +230,6 @@ 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);
@ -274,13 +269,6 @@ 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)]));
@ -917,7 +905,6 @@ class HelperNodes {
final Constructor streamControllerConstructor;
final Constructor syncIterableConstructor;
final Constructor streamIteratorConstructor;
final Procedure asyncStackTraceHelper;
final Procedure asyncThenWrapper;
final Procedure asyncErrorWrapper;
final Procedure awaitHelper;
@ -936,7 +923,6 @@ class HelperNodes {
this.streamIteratorConstructor,
this.futureMicrotaskConstructor,
this.streamControllerConstructor,
this.asyncStackTraceHelper,
this.asyncThenWrapper,
this.asyncErrorWrapper,
this.awaitHelper,
@ -956,7 +942,6 @@ class HelperNodes {
coreTypes.streamIteratorDefaultConstructor,
coreTypes.futureMicrotaskConstructor,
coreTypes.asyncStarStreamControllerDefaultConstructor,
coreTypes.asyncStackTraceHelperProcedure,
coreTypes.asyncThenWrapperHelperProcedure,
coreTypes.asyncErrorWrapperHelperProcedure,
coreTypes.awaitHelperProcedure,

View file

@ -111,13 +111,13 @@ DEFINE_NATIVE_ENTRY(StackTrace_current, 0) {
DEFINE_NATIVE_ENTRY(StackTrace_asyncStackTraceHelper, 1) {
if (!FLAG_causal_async_stacks) return Object::null();
GET_NATIVE_ARGUMENT(Closure, async_op, arguments->NativeArgAt(0));
if (FLAG_support_debugger) {
Debugger* debugger = isolate->debugger();
if (debugger != NULL) {
debugger->MaybeAsyncStepInto(async_op);
if (!async_op.IsNull()) {
if (FLAG_support_debugger) {
Debugger* debugger = isolate->debugger();
if (debugger != NULL) {
debugger->MaybeAsyncStepInto(async_op);
}
}
}
return CurrentStackTrace(thread, true);

View file

@ -35,6 +35,7 @@ evaluate_*: Skip # no evaluation test for now
###
### Async debugging
###
async_single_step_into_test: RuntimeError # Issue 29158
async_star_single_step_into_test: RuntimeError # Issue 29158
async_step_out_test: RuntimeError # Issue 29158
async_star_step_out_test: RuntimeError # Issue 29158

View file

@ -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()) {

View file

@ -7367,7 +7367,7 @@ SequenceNode* Parser::CloseAsyncGeneratorFunction(const Function& closure_func,
if (FLAG_causal_async_stacks) {
// Add to AST:
// :async_stack_trace = _asyncStackTraceHelper(:async_op);
// :async_stack_trace = _asyncStackTraceHelper();
const Function& async_stack_trace_helper = Function::ZoneHandle(
Z,
async_lib.LookupFunctionAllowPrivate(Symbols::AsyncStackTraceHelper()));