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

Unified Diff: runtime/vm/parser.cc

Issue 2718353002: Revert "Track the 'awaiter return' call stack..." (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object_test.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index a5b49ee3fc1e49a5e6d4e1ffd5c96b14da3e81aa..f9664bd666ce8766eeb4873f386e798b52c06f37 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -6817,8 +6817,6 @@ void Parser::OpenAsyncTryBlock() {
// This is the outermost try-catch in the function.
ASSERT(try_stack_ == NULL);
PushTry(current_block_);
- // Validate that we always get try index of 0.
- ASSERT(try_stack_->try_index() == CatchClauseNode::kImplicitAsyncTryIndex);
SetupSavedTryContext(context_var);
}
@@ -7088,7 +7086,6 @@ void Parser::AddAsyncGeneratorVariables() {
// var :async_then_callback;
// var :async_catch_error_callback;
// var :async_stack_trace;
- // var :controller_stream;
// These variables are used to store the async generator closure containing
// the body of the async* function. They are used by the await operator.
LocalVariable* controller_var =
@@ -7111,10 +7108,6 @@ void Parser::AddAsyncGeneratorVariables() {
LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
Symbols::AsyncStackTraceVar(), Object::dynamic_type());
current_block_->scope->AddVariable(async_stack_trace);
- LocalVariable* controller_stream = new (Z)
- LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
- Symbols::ControllerStream(), Object::dynamic_type());
- current_block_->scope->AddVariable(controller_stream);
}
@@ -7184,8 +7177,7 @@ RawFunction* Parser::OpenAsyncGeneratorFunction(TokenPosition async_func_pos) {
// var :async_then_callback = _asyncThenWrapperHelper(:async_op);
// var :async_catch_error_callback = _asyncCatchErrorWrapperHelper(:async_op);
// :controller = new _AsyncStarStreamController(:async_op);
-// var :controller_stream = :controller.stream;
-// return :controller_stream;
+// return :controller.stream;
// }
SequenceNode* Parser::CloseAsyncGeneratorFunction(const Function& closure_func,
SequenceNode* closure_body) {
@@ -7216,9 +7208,6 @@ SequenceNode* Parser::CloseAsyncGeneratorFunction(const Function& closure_func,
existing_var = closure_body->scope()->LookupVariable(
Symbols::AsyncStackTraceVar(), false);
ASSERT((existing_var != NULL) && existing_var->is_captured());
- existing_var =
- closure_body->scope()->LookupVariable(Symbols::ControllerStream(), false);
- ASSERT((existing_var != NULL) && existing_var->is_captured());
const Library& async_lib = Library::Handle(Library::AsyncLibrary());
@@ -7327,28 +7316,13 @@ SequenceNode* Parser::CloseAsyncGeneratorFunction(const Function& closure_func,
TokenPosition::kNoSource, controller_var, controller_constructor_call);
current_block_->statements->Add(store_controller);
- // Grab :controller.stream
- InstanceGetterNode* controller_stream = new (Z) InstanceGetterNode(
- TokenPosition::kNoSource,
- new (Z) LoadLocalNode(TokenPosition::kNoSource, controller_var),
- Symbols::Stream());
-
- // Store :controller.stream into :controller_stream inside the closure.
- // We have to remember the stream because a new instance is generated for
- // each getter invocation and in order to recreate the linkage, we need the
- // awaited on instance.
- LocalVariable* controller_stream_var =
- current_block_->scope->LookupVariable(Symbols::ControllerStream(), false);
- ASSERT(controller_stream_var != NULL);
-
- StoreLocalNode* store_controller_stream = new (Z) StoreLocalNode(
- TokenPosition::kNoSource, controller_stream_var, controller_stream);
- current_block_->statements->Add(store_controller_stream);
-
// return :controller.stream;
ReturnNode* return_node = new (Z) ReturnNode(
TokenPosition::kNoSource,
- new (Z) LoadLocalNode(TokenPosition::kNoSource, controller_stream_var));
+ new (Z) InstanceGetterNode(
+ TokenPosition::kNoSource,
+ new (Z) LoadLocalNode(TokenPosition::kNoSource, controller_var),
+ Symbols::Stream()));
current_block_->statements->Add(return_node);
return CloseBlock();
}
@@ -9092,37 +9066,6 @@ AstNode* Parser::ParseAwaitForStatement(String* label_name) {
ParseAwaitableExpr(kAllowConst, kConsumeCascades, NULL);
ExpectToken(Token::kRPAREN);
- // Create :stream to store the stream into temporarily.
- LocalVariable* stream_var =
- new (Z) LocalVariable(stream_expr_pos, stream_expr_pos,
- Symbols::ColonStream(), Object::dynamic_type());
- current_block_->scope->AddVariable(stream_var);
-
- // Store the stream expression into a variable.
- StoreLocalNode* store_stream_var =
- new (Z) StoreLocalNode(stream_expr_pos, stream_var, stream_expr);
- current_block_->statements->Add(store_stream_var);
-
- // Register the awaiter on the stream by invoking `_asyncStarListenHelper`.
- const Library& async_lib = Library::Handle(Library::AsyncLibrary());
- const Function& async_star_listen_helper = Function::ZoneHandle(
- Z,
- async_lib.LookupFunctionAllowPrivate(Symbols::_AsyncStarListenHelper()));
- ASSERT(!async_star_listen_helper.IsNull());
- LocalVariable* async_op_var =
- current_block_->scope->LookupVariable(Symbols::AsyncOperation(), false);
- ASSERT(async_op_var != NULL);
- ArgumentListNode* async_star_listen_helper_args =
- new (Z) ArgumentListNode(stream_expr_pos);
- async_star_listen_helper_args->Add(
- new (Z) LoadLocalNode(stream_expr_pos, stream_var));
- async_star_listen_helper_args->Add(
- new (Z) LoadLocalNode(stream_expr_pos, async_op_var));
- StaticCallNode* async_star_listen_helper_call = new (Z) StaticCallNode(
- stream_expr_pos, async_star_listen_helper, async_star_listen_helper_args);
-
- current_block_->statements->Add(async_star_listen_helper_call);
-
// Build creation of implicit StreamIterator.
// var :for-in-iter = new StreamIterator(stream_expr).
const Class& stream_iterator_cls =
@@ -9133,7 +9076,7 @@ AstNode* Parser::ParseAwaitForStatement(String* label_name) {
stream_iterator_cls.LookupFunction(Symbols::StreamIteratorConstructor()));
ASSERT(!iterator_ctor.IsNull());
ArgumentListNode* ctor_args = new (Z) ArgumentListNode(stream_expr_pos);
- ctor_args->Add(new (Z) LoadLocalNode(stream_expr_pos, stream_var));
+ ctor_args->Add(stream_expr);
ConstructorCallNode* ctor_call = new (Z) ConstructorCallNode(
stream_expr_pos, TypeArguments::ZoneHandle(Z), iterator_ctor, ctor_args);
const AbstractType& iterator_type = Object::dynamic_type();
« no previous file with comments | « runtime/vm/object_test.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698