Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #include "vm/parser.h" | 5 #include "vm/parser.h" |
| 6 #include "vm/flags.h" | 6 #include "vm/flags.h" |
| 7 | 7 |
| 8 #ifndef DART_PRECOMPILED_RUNTIME | 8 #ifndef DART_PRECOMPILED_RUNTIME |
| 9 | 9 |
| 10 #include "lib/invocation_mirror.h" | 10 #include "lib/invocation_mirror.h" |
| (...skipping 3450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3461 func.set_modifier(func_modifier); | 3461 func.set_modifier(func_modifier); |
| 3462 } | 3462 } |
| 3463 | 3463 |
| 3464 OpenBlock(); // Open a nested scope for the outermost function block. | 3464 OpenBlock(); // Open a nested scope for the outermost function block. |
| 3465 | 3465 |
| 3466 Function& generated_body_closure = Function::ZoneHandle(Z); | 3466 Function& generated_body_closure = Function::ZoneHandle(Z); |
| 3467 if (func.IsAsyncFunction()) { | 3467 if (func.IsAsyncFunction()) { |
| 3468 ASSERT(!func.is_generated_body()); | 3468 ASSERT(!func.is_generated_body()); |
| 3469 // The code of an async function is synthesized. Disable debugging. | 3469 // The code of an async function is synthesized. Disable debugging. |
| 3470 func.set_is_debuggable(false); | 3470 func.set_is_debuggable(false); |
| 3471 // In order to produce sane asynchronous stacks we rely on this function | |
|
rmacnak
2017/01/26 18:05:58
To collect them efficiently.
Cutch
2017/01/31 23:45:31
Done (here and elsewhere).
| |
| 3472 // not being inlined. | |
| 3473 func.set_is_inlinable(!FLAG_sane_async_stacks); | |
| 3471 generated_body_closure = OpenAsyncFunction(func.token_pos()); | 3474 generated_body_closure = OpenAsyncFunction(func.token_pos()); |
| 3472 } else if (func.IsAsyncClosure()) { | 3475 } else if (func.IsAsyncClosure()) { |
| 3473 // The closure containing the body of an async function is debuggable. | 3476 // The closure containing the body of an async function is debuggable. |
| 3474 ASSERT(func.is_debuggable()); | 3477 ASSERT(func.is_debuggable()); |
| 3478 // In order to produce sane asynchronous stacks we rely on this function | |
| 3479 // not being inlined. | |
| 3480 func.set_is_inlinable(!FLAG_sane_async_stacks); | |
| 3475 OpenAsyncClosure(); | 3481 OpenAsyncClosure(); |
| 3476 } else if (func.IsSyncGenerator()) { | 3482 } else if (func.IsSyncGenerator()) { |
| 3477 // The code of a sync generator is synthesized. Disable debugging. | 3483 // The code of a sync generator is synthesized. Disable debugging. |
| 3478 func.set_is_debuggable(false); | 3484 func.set_is_debuggable(false); |
| 3479 generated_body_closure = OpenSyncGeneratorFunction(func.token_pos()); | 3485 generated_body_closure = OpenSyncGeneratorFunction(func.token_pos()); |
| 3480 } else if (func.IsSyncGenClosure()) { | 3486 } else if (func.IsSyncGenClosure()) { |
| 3481 // The closure containing the body of a sync generator is debuggable. | 3487 // The closure containing the body of a sync generator is debuggable. |
| 3482 ASSERT(func.is_debuggable()); | 3488 ASSERT(func.is_debuggable()); |
| 3483 async_temp_scope_ = current_block_->scope; | 3489 async_temp_scope_ = current_block_->scope; |
| 3484 } else if (func.IsAsyncGenerator()) { | 3490 } else if (func.IsAsyncGenerator()) { |
| 3485 func.set_is_debuggable(false); | 3491 func.set_is_debuggable(false); |
| 3492 // In order to produce sane asynchronous stacks we rely on this function | |
| 3493 // not being inlined. | |
| 3494 func.set_is_inlinable(!FLAG_sane_async_stacks); | |
| 3486 generated_body_closure = OpenAsyncGeneratorFunction(func.token_pos()); | 3495 generated_body_closure = OpenAsyncGeneratorFunction(func.token_pos()); |
| 3487 } else if (func.IsAsyncGenClosure()) { | 3496 } else if (func.IsAsyncGenClosure()) { |
| 3488 // The closure containing the body of an async* function is debuggable. | 3497 // The closure containing the body of an async* function is debuggable. |
| 3489 ASSERT(func.is_debuggable()); | 3498 ASSERT(func.is_debuggable()); |
| 3499 // In order to produce sane asynchronous stacks we rely on this function | |
| 3500 // not being inlined. | |
| 3501 func.set_is_inlinable(!FLAG_sane_async_stacks); | |
| 3490 OpenAsyncGeneratorClosure(); | 3502 OpenAsyncGeneratorClosure(); |
| 3491 } | 3503 } |
| 3492 | 3504 |
| 3493 BoolScope allow_await(&this->await_is_keyword_, | 3505 BoolScope allow_await(&this->await_is_keyword_, |
| 3494 func.IsAsyncOrGenerator() || func.is_generated_body()); | 3506 func.IsAsyncOrGenerator() || func.is_generated_body()); |
| 3495 TokenPosition end_token_pos = TokenPosition::kNoSource; | 3507 TokenPosition end_token_pos = TokenPosition::kNoSource; |
| 3496 if (CurrentToken() == Token::kLBRACE) { | 3508 if (CurrentToken() == Token::kLBRACE) { |
| 3497 ConsumeToken(); | 3509 ConsumeToken(); |
| 3498 if (String::Handle(Z, func.name()).Equals(Symbols::EqualOperator())) { | 3510 if (String::Handle(Z, func.name()).Equals(Symbols::EqualOperator())) { |
| 3499 const Class& owner = Class::Handle(Z, func.Owner()); | 3511 const Class& owner = Class::Handle(Z, func.Owner()); |
| (...skipping 3354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6854 current_block_->scope->AddVariable(await_ctx_var); | 6866 current_block_->scope->AddVariable(await_ctx_var); |
| 6855 } | 6867 } |
| 6856 | 6868 |
| 6857 | 6869 |
| 6858 void Parser::AddAsyncClosureVariables() { | 6870 void Parser::AddAsyncClosureVariables() { |
| 6859 // Add to current block's scope: | 6871 // Add to current block's scope: |
| 6860 // var :async_op; | 6872 // var :async_op; |
| 6861 // var :async_then_callback; | 6873 // var :async_then_callback; |
| 6862 // var :async_catch_error_callback; | 6874 // var :async_catch_error_callback; |
| 6863 // var :async_completer; | 6875 // var :async_completer; |
| 6876 // var :async_stack_trace; | |
| 6864 LocalVariable* async_op_var = | 6877 LocalVariable* async_op_var = |
| 6865 new (Z) LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource, | 6878 new (Z) LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource, |
| 6866 Symbols::AsyncOperation(), Object::dynamic_type()); | 6879 Symbols::AsyncOperation(), Object::dynamic_type()); |
| 6867 current_block_->scope->AddVariable(async_op_var); | 6880 current_block_->scope->AddVariable(async_op_var); |
| 6868 LocalVariable* async_then_callback_var = new (Z) | 6881 LocalVariable* async_then_callback_var = new (Z) |
| 6869 LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource, | 6882 LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource, |
| 6870 Symbols::AsyncThenCallback(), Object::dynamic_type()); | 6883 Symbols::AsyncThenCallback(), Object::dynamic_type()); |
| 6871 current_block_->scope->AddVariable(async_then_callback_var); | 6884 current_block_->scope->AddVariable(async_then_callback_var); |
| 6872 LocalVariable* async_catch_error_callback_var = new (Z) | 6885 LocalVariable* async_catch_error_callback_var = new (Z) |
| 6873 LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource, | 6886 LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource, |
| 6874 Symbols::AsyncCatchErrorCallback(), Object::dynamic_type()); | 6887 Symbols::AsyncCatchErrorCallback(), Object::dynamic_type()); |
| 6875 current_block_->scope->AddVariable(async_catch_error_callback_var); | 6888 current_block_->scope->AddVariable(async_catch_error_callback_var); |
| 6876 LocalVariable* async_completer = | 6889 LocalVariable* async_completer = |
| 6877 new (Z) LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource, | 6890 new (Z) LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource, |
| 6878 Symbols::AsyncCompleter(), Object::dynamic_type()); | 6891 Symbols::AsyncCompleter(), Object::dynamic_type()); |
| 6879 current_block_->scope->AddVariable(async_completer); | 6892 current_block_->scope->AddVariable(async_completer); |
| 6893 LocalVariable* async_stack_trace = new (Z) | |
| 6894 LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource, | |
| 6895 Symbols::AsyncStackTraceVar(), Object::dynamic_type()); | |
| 6896 current_block_->scope->AddVariable(async_stack_trace); | |
| 6880 } | 6897 } |
| 6881 | 6898 |
| 6882 | 6899 |
| 6883 void Parser::AddAsyncGeneratorVariables() { | 6900 void Parser::AddAsyncGeneratorVariables() { |
| 6884 // Add to current block's scope: | 6901 // Add to current block's scope: |
| 6885 // var :controller; | 6902 // var :controller; |
| 6886 // The :controller variable is used by the async generator closure to | 6903 // The :controller variable is used by the async generator closure to |
| 6887 // store the StreamController object to which the yielded expressions | 6904 // store the StreamController object to which the yielded expressions |
| 6888 // are added. | 6905 // are added. |
| 6889 // var :async_op; | 6906 // var :async_op; |
| 6890 // var :async_then_callback; | 6907 // var :async_then_callback; |
| 6891 // var :async_catch_error_callback; | 6908 // var :async_catch_error_callback; |
| 6909 // var :async_stack_trace; | |
| 6892 // These variables are used to store the async generator closure containing | 6910 // These variables are used to store the async generator closure containing |
| 6893 // the body of the async* function. They are used by the await operator. | 6911 // the body of the async* function. They are used by the await operator. |
| 6894 LocalVariable* controller_var = | 6912 LocalVariable* controller_var = |
| 6895 new (Z) LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource, | 6913 new (Z) LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource, |
| 6896 Symbols::Controller(), Object::dynamic_type()); | 6914 Symbols::Controller(), Object::dynamic_type()); |
| 6897 current_block_->scope->AddVariable(controller_var); | 6915 current_block_->scope->AddVariable(controller_var); |
| 6898 LocalVariable* async_op_var = | 6916 LocalVariable* async_op_var = |
| 6899 new (Z) LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource, | 6917 new (Z) LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource, |
| 6900 Symbols::AsyncOperation(), Object::dynamic_type()); | 6918 Symbols::AsyncOperation(), Object::dynamic_type()); |
| 6901 current_block_->scope->AddVariable(async_op_var); | 6919 current_block_->scope->AddVariable(async_op_var); |
| 6902 LocalVariable* async_then_callback_var = new (Z) | 6920 LocalVariable* async_then_callback_var = new (Z) |
| 6903 LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource, | 6921 LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource, |
| 6904 Symbols::AsyncThenCallback(), Object::dynamic_type()); | 6922 Symbols::AsyncThenCallback(), Object::dynamic_type()); |
| 6905 current_block_->scope->AddVariable(async_then_callback_var); | 6923 current_block_->scope->AddVariable(async_then_callback_var); |
| 6906 LocalVariable* async_catch_error_callback_var = new (Z) | 6924 LocalVariable* async_catch_error_callback_var = new (Z) |
| 6907 LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource, | 6925 LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource, |
| 6908 Symbols::AsyncCatchErrorCallback(), Object::dynamic_type()); | 6926 Symbols::AsyncCatchErrorCallback(), Object::dynamic_type()); |
| 6909 current_block_->scope->AddVariable(async_catch_error_callback_var); | 6927 current_block_->scope->AddVariable(async_catch_error_callback_var); |
| 6928 LocalVariable* async_stack_trace = new (Z) | |
| 6929 LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource, | |
| 6930 Symbols::AsyncStackTraceVar(), Object::dynamic_type()); | |
| 6931 current_block_->scope->AddVariable(async_stack_trace); | |
| 6910 } | 6932 } |
| 6911 | 6933 |
| 6912 | 6934 |
| 6913 RawFunction* Parser::OpenAsyncGeneratorFunction(TokenPosition async_func_pos) { | 6935 RawFunction* Parser::OpenAsyncGeneratorFunction(TokenPosition async_func_pos) { |
| 6914 TRACE_PARSER("OpenAsyncGeneratorFunction"); | 6936 TRACE_PARSER("OpenAsyncGeneratorFunction"); |
| 6915 AddContinuationVariables(); | 6937 AddContinuationVariables(); |
| 6916 AddAsyncGeneratorVariables(); | 6938 AddAsyncGeneratorVariables(); |
| 6917 | 6939 |
| 6918 Function& closure = Function::Handle(Z); | 6940 Function& closure = Function::Handle(Z); |
| 6919 bool is_new_closure = false; | 6941 bool is_new_closure = false; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6997 ASSERT((existing_var != NULL) && existing_var->is_captured()); | 7019 ASSERT((existing_var != NULL) && existing_var->is_captured()); |
| 6998 existing_var = | 7020 existing_var = |
| 6999 closure_body->scope()->LookupVariable(Symbols::AsyncOperation(), false); | 7021 closure_body->scope()->LookupVariable(Symbols::AsyncOperation(), false); |
| 7000 ASSERT((existing_var != NULL) && existing_var->is_captured()); | 7022 ASSERT((existing_var != NULL) && existing_var->is_captured()); |
| 7001 existing_var = closure_body->scope()->LookupVariable( | 7023 existing_var = closure_body->scope()->LookupVariable( |
| 7002 Symbols::AsyncThenCallback(), false); | 7024 Symbols::AsyncThenCallback(), false); |
| 7003 ASSERT((existing_var != NULL) && existing_var->is_captured()); | 7025 ASSERT((existing_var != NULL) && existing_var->is_captured()); |
| 7004 existing_var = closure_body->scope()->LookupVariable( | 7026 existing_var = closure_body->scope()->LookupVariable( |
| 7005 Symbols::AsyncCatchErrorCallback(), false); | 7027 Symbols::AsyncCatchErrorCallback(), false); |
| 7006 ASSERT((existing_var != NULL) && existing_var->is_captured()); | 7028 ASSERT((existing_var != NULL) && existing_var->is_captured()); |
| 7029 existing_var = closure_body->scope()->LookupVariable( | |
| 7030 Symbols::AsyncStackTraceVar(), false); | |
| 7031 ASSERT((existing_var != NULL) && existing_var->is_captured()); | |
| 7007 | 7032 |
| 7008 const Library& async_lib = Library::Handle(Library::AsyncLibrary()); | 7033 const Library& async_lib = Library::Handle(Library::AsyncLibrary()); |
| 7009 | 7034 |
| 7010 const Class& controller_class = Class::Handle( | 7035 const Class& controller_class = Class::Handle( |
| 7011 Z, | 7036 Z, |
| 7012 async_lib.LookupClassAllowPrivate(Symbols::_AsyncStarStreamController())); | 7037 async_lib.LookupClassAllowPrivate(Symbols::_AsyncStarStreamController())); |
| 7013 ASSERT(!controller_class.IsNull()); | 7038 ASSERT(!controller_class.IsNull()); |
| 7014 const Function& controller_constructor = Function::ZoneHandle( | 7039 const Function& controller_constructor = Function::ZoneHandle( |
| 7015 Z, controller_class.LookupConstructorAllowPrivate( | 7040 Z, controller_class.LookupConstructorAllowPrivate( |
| 7016 Symbols::_AsyncStarStreamControllerConstructor())); | 7041 Symbols::_AsyncStarStreamControllerConstructor())); |
| 7017 | 7042 |
| 7018 // :await_jump_var = -1; | 7043 // :await_jump_var = -1; |
| 7019 LocalVariable* jump_var = | 7044 LocalVariable* jump_var = |
| 7020 current_block_->scope->LookupVariable(Symbols::AwaitJumpVar(), false); | 7045 current_block_->scope->LookupVariable(Symbols::AwaitJumpVar(), false); |
| 7021 LiteralNode* init_value = new (Z) | 7046 LiteralNode* init_value = new (Z) |
| 7022 LiteralNode(TokenPosition::kNoSource, Smi::ZoneHandle(Smi::New(-1))); | 7047 LiteralNode(TokenPosition::kNoSource, Smi::ZoneHandle(Smi::New(-1))); |
| 7023 current_block_->statements->Add( | 7048 current_block_->statements->Add( |
| 7024 new (Z) StoreLocalNode(TokenPosition::kNoSource, jump_var, init_value)); | 7049 new (Z) StoreLocalNode(TokenPosition::kNoSource, jump_var, init_value)); |
| 7025 | 7050 |
| 7051 TokenPosition token_pos = TokenPosition::kNoSource; | |
| 7052 | |
| 7053 // Add to AST: | |
|
rmacnak
2017/01/26 18:05:58
if (FLAG_sane_async_stacks)
| |
| 7054 // :async_stack_trace = _asyncStackTraceHelper(); | |
| 7055 const Function& async_stack_trace_helper = Function::ZoneHandle( | |
| 7056 Z, | |
| 7057 async_lib.LookupFunctionAllowPrivate(Symbols::AsyncStackTraceHelper())); | |
| 7058 ASSERT(!async_stack_trace_helper.IsNull()); | |
| 7059 ArgumentListNode* async_stack_trace_helper_args = | |
| 7060 new (Z) ArgumentListNode(TokenPosition::kNoSource); | |
| 7061 StaticCallNode* async_stack_trace_helper_call = new (Z) StaticCallNode( | |
| 7062 token_pos, async_stack_trace_helper, async_stack_trace_helper_args); | |
| 7063 LocalVariable* async_stack_trace_var = current_block_->scope->LookupVariable( | |
| 7064 Symbols::AsyncStackTraceVar(), false); | |
| 7065 StoreLocalNode* store_async_stack_trace = new (Z) StoreLocalNode( | |
| 7066 token_pos, async_stack_trace_var, async_stack_trace_helper_call); | |
| 7067 current_block_->statements->Add(store_async_stack_trace); | |
| 7068 | |
| 7026 // Add to AST: | 7069 // Add to AST: |
| 7027 // :async_op = <closure>; (containing the original body) | 7070 // :async_op = <closure>; (containing the original body) |
| 7028 LocalVariable* async_op_var = | 7071 LocalVariable* async_op_var = |
| 7029 current_block_->scope->LookupVariable(Symbols::AsyncOperation(), false); | 7072 current_block_->scope->LookupVariable(Symbols::AsyncOperation(), false); |
| 7030 ClosureNode* closure_obj = new (Z) ClosureNode( | 7073 ClosureNode* closure_obj = new (Z) ClosureNode( |
| 7031 TokenPosition::kNoSource, closure_func, NULL, closure_body->scope()); | 7074 TokenPosition::kNoSource, closure_func, NULL, closure_body->scope()); |
| 7032 StoreLocalNode* store_async_op = new (Z) | 7075 StoreLocalNode* store_async_op = new (Z) |
| 7033 StoreLocalNode(TokenPosition::kNoSource, async_op_var, closure_obj); | 7076 StoreLocalNode(TokenPosition::kNoSource, async_op_var, closure_obj); |
| 7034 | 7077 |
| 7035 current_block_->statements->Add(store_async_op); | 7078 current_block_->statements->Add(store_async_op); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7159 // closure body in order to mark them as captured. | 7202 // closure body in order to mark them as captured. |
| 7160 LocalVariable* existing_var = | 7203 LocalVariable* existing_var = |
| 7161 closure_body->scope()->LookupVariable(Symbols::AwaitJumpVar(), false); | 7204 closure_body->scope()->LookupVariable(Symbols::AwaitJumpVar(), false); |
| 7162 ASSERT((existing_var != NULL) && existing_var->is_captured()); | 7205 ASSERT((existing_var != NULL) && existing_var->is_captured()); |
| 7163 existing_var = | 7206 existing_var = |
| 7164 closure_body->scope()->LookupVariable(Symbols::AwaitContextVar(), false); | 7207 closure_body->scope()->LookupVariable(Symbols::AwaitContextVar(), false); |
| 7165 ASSERT((existing_var != NULL) && existing_var->is_captured()); | 7208 ASSERT((existing_var != NULL) && existing_var->is_captured()); |
| 7166 existing_var = | 7209 existing_var = |
| 7167 closure_body->scope()->LookupVariable(Symbols::AsyncCompleter(), false); | 7210 closure_body->scope()->LookupVariable(Symbols::AsyncCompleter(), false); |
| 7168 ASSERT((existing_var != NULL) && existing_var->is_captured()); | 7211 ASSERT((existing_var != NULL) && existing_var->is_captured()); |
| 7212 existing_var = closure_body->scope()->LookupVariable( | |
| 7213 Symbols::AsyncStackTraceVar(), false); | |
| 7214 ASSERT((existing_var != NULL) && existing_var->is_captured()); | |
| 7169 | 7215 |
| 7170 // Create and return a new future that executes a closure with the current | 7216 // Create and return a new future that executes a closure with the current |
| 7171 // body. | 7217 // body. |
| 7172 | 7218 |
| 7173 // No need to capture parameters or other variables, since they have already | 7219 // No need to capture parameters or other variables, since they have already |
| 7174 // been captured in the corresponding scope as the body has been parsed within | 7220 // been captured in the corresponding scope as the body has been parsed within |
| 7175 // a nested block (contained in the async function's block). | 7221 // a nested block (contained in the async function's block). |
| 7176 const Class& future = Class::ZoneHandle(Z, I->object_store()->future_class()); | 7222 const Class& future = Class::ZoneHandle(Z, I->object_store()->future_class()); |
| 7177 ASSERT(!future.IsNull()); | 7223 ASSERT(!future.IsNull()); |
| 7178 const Function& constructor = Function::ZoneHandle( | 7224 const Function& constructor = Function::ZoneHandle( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7211 // :async_op = <closure>; (containing the original body) | 7257 // :async_op = <closure>; (containing the original body) |
| 7212 LocalVariable* async_op_var = | 7258 LocalVariable* async_op_var = |
| 7213 current_block_->scope->LookupVariable(Symbols::AsyncOperation(), false); | 7259 current_block_->scope->LookupVariable(Symbols::AsyncOperation(), false); |
| 7214 ClosureNode* cn = | 7260 ClosureNode* cn = |
| 7215 new (Z) ClosureNode(token_pos, closure, NULL, closure_body->scope()); | 7261 new (Z) ClosureNode(token_pos, closure, NULL, closure_body->scope()); |
| 7216 StoreLocalNode* store_async_op = | 7262 StoreLocalNode* store_async_op = |
| 7217 new (Z) StoreLocalNode(token_pos, async_op_var, cn); | 7263 new (Z) StoreLocalNode(token_pos, async_op_var, cn); |
| 7218 current_block_->statements->Add(store_async_op); | 7264 current_block_->statements->Add(store_async_op); |
| 7219 | 7265 |
| 7220 const Library& async_lib = Library::Handle(Library::AsyncLibrary()); | 7266 const Library& async_lib = Library::Handle(Library::AsyncLibrary()); |
| 7267 | |
| 7268 // Add to AST: | |
|
rmacnak
2017/01/26 18:05:58
if (FLAG_sane_async_stacks)
Cutch
2017/01/31 23:45:31
Done.
| |
| 7269 // :async_stack_trace = _asyncStackTraceHelper(); | |
| 7270 const Function& async_stack_trace_helper = Function::ZoneHandle( | |
| 7271 Z, | |
| 7272 async_lib.LookupFunctionAllowPrivate(Symbols::AsyncStackTraceHelper())); | |
| 7273 ASSERT(!async_stack_trace_helper.IsNull()); | |
| 7274 ArgumentListNode* async_stack_trace_helper_args = | |
| 7275 new (Z) ArgumentListNode(token_pos); | |
| 7276 StaticCallNode* async_stack_trace_helper_call = new (Z) StaticCallNode( | |
| 7277 token_pos, async_stack_trace_helper, async_stack_trace_helper_args); | |
| 7278 LocalVariable* async_stack_trace_var = current_block_->scope->LookupVariable( | |
| 7279 Symbols::AsyncStackTraceVar(), false); | |
| 7280 StoreLocalNode* store_async_stack_trace = new (Z) StoreLocalNode( | |
| 7281 token_pos, async_stack_trace_var, async_stack_trace_helper_call); | |
| 7282 current_block_->statements->Add(store_async_stack_trace); | |
| 7283 | |
| 7221 // :async_then_callback = _asyncThenWrapperHelper(:async_op) | 7284 // :async_then_callback = _asyncThenWrapperHelper(:async_op) |
| 7222 const Function& async_then_wrapper_helper = Function::ZoneHandle( | 7285 const Function& async_then_wrapper_helper = Function::ZoneHandle( |
| 7223 Z, | 7286 Z, |
| 7224 async_lib.LookupFunctionAllowPrivate(Symbols::AsyncThenWrapperHelper())); | 7287 async_lib.LookupFunctionAllowPrivate(Symbols::AsyncThenWrapperHelper())); |
| 7225 ASSERT(!async_then_wrapper_helper.IsNull()); | 7288 ASSERT(!async_then_wrapper_helper.IsNull()); |
| 7226 ArgumentListNode* async_then_wrapper_helper_args = | 7289 ArgumentListNode* async_then_wrapper_helper_args = |
| 7227 new (Z) ArgumentListNode(token_pos); | 7290 new (Z) ArgumentListNode(token_pos); |
| 7228 async_then_wrapper_helper_args->Add( | 7291 async_then_wrapper_helper_args->Add( |
| 7229 new (Z) LoadLocalNode(token_pos, async_op_var)); | 7292 new (Z) LoadLocalNode(token_pos, async_op_var)); |
| 7230 StaticCallNode* then_wrapper_call = new (Z) StaticCallNode( | 7293 StaticCallNode* then_wrapper_call = new (Z) StaticCallNode( |
| (...skipping 7437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14668 const ArgumentListNode& function_args, | 14731 const ArgumentListNode& function_args, |
| 14669 const LocalVariable* temp_for_last_arg, | 14732 const LocalVariable* temp_for_last_arg, |
| 14670 bool is_super_invocation) { | 14733 bool is_super_invocation) { |
| 14671 UNREACHABLE(); | 14734 UNREACHABLE(); |
| 14672 return NULL; | 14735 return NULL; |
| 14673 } | 14736 } |
| 14674 | 14737 |
| 14675 } // namespace dart | 14738 } // namespace dart |
| 14676 | 14739 |
| 14677 #endif // DART_PRECOMPILED_RUNTIME | 14740 #endif // DART_PRECOMPILED_RUNTIME |
| OLD | NEW |