| OLD | NEW |
| 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 #include <map> | 5 #include <map> |
| 6 #include <set> | 6 #include <set> |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "vm/kernel_to_il.h" | 9 #include "vm/kernel_to_il.h" |
| 10 | 10 |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 scope->VariableAt(i)->set_is_forced_stack(); | 655 scope->VariableAt(i)->set_is_forced_stack(); |
| 656 } | 656 } |
| 657 } | 657 } |
| 658 | 658 |
| 659 // Do not visit the positional and named parameters, because they've | 659 // Do not visit the positional and named parameters, because they've |
| 660 // already been added to the scope. | 660 // already been added to the scope. |
| 661 if (node->body() != NULL) { | 661 if (node->body() != NULL) { |
| 662 node->body()->AcceptStatementVisitor(this); | 662 node->body()->AcceptStatementVisitor(this); |
| 663 } | 663 } |
| 664 | 664 |
| 665 // Ensure that :await_jump_var and :await_ctx_var are captured. | 665 // Ensure that :await_jump_var, :await_ctx_var and :async_op are captured. |
| 666 if (node->async_marker() == FunctionNode::kSyncYielding) { | 666 if (node->async_marker() == FunctionNode::kSyncYielding) { |
| 667 { | 667 { |
| 668 LocalVariable* temp = NULL; | 668 LocalVariable* temp = NULL; |
| 669 LookupCapturedVariableByName( | 669 LookupCapturedVariableByName( |
| 670 (depth_.function_ == 0) ? &result_->yield_jump_variable : &temp, | 670 (depth_.function_ == 0) ? &result_->yield_jump_variable : &temp, |
| 671 Symbols::AwaitJumpVar()); | 671 Symbols::AwaitJumpVar()); |
| 672 } | 672 } |
| 673 { | 673 { |
| 674 LocalVariable* temp = NULL; | 674 LocalVariable* temp = NULL; |
| 675 LookupCapturedVariableByName( | 675 LookupCapturedVariableByName( |
| 676 (depth_.function_ == 0) ? &result_->yield_context_variable : &temp, | 676 (depth_.function_ == 0) ? &result_->yield_context_variable : &temp, |
| 677 Symbols::AwaitContextVar()); | 677 Symbols::AwaitContextVar()); |
| 678 } | 678 } |
| 679 { |
| 680 LocalVariable* temp = |
| 681 scope_->LookupVariable(Symbols::AsyncOperation(), true); |
| 682 if (temp != NULL) { |
| 683 scope_->CaptureVariable(temp); |
| 684 } |
| 685 } |
| 679 } | 686 } |
| 680 } | 687 } |
| 681 | 688 |
| 682 | 689 |
| 683 void ScopeBuilder::VisitYieldStatement(YieldStatement* node) { | 690 void ScopeBuilder::VisitYieldStatement(YieldStatement* node) { |
| 684 ASSERT(node->is_native()); | 691 ASSERT(node->is_native()); |
| 685 if (depth_.function_ == 0) { | 692 if (depth_.function_ == 0) { |
| 686 AddSwitchVariable(); | 693 AddSwitchVariable(); |
| 687 // Promote all currently visible local variables into the context. | 694 // Promote all currently visible local variables into the context. |
| 688 // TODO(27590) CaptureLocalVariables promotes to many variables into | 695 // TODO(27590) CaptureLocalVariables promotes to many variables into |
| (...skipping 5148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5837 instructions += LoadLocal(parsed_function_->current_context_var()); | 5844 instructions += LoadLocal(parsed_function_->current_context_var()); |
| 5838 instructions += StoreInstanceField(Closure::context_offset()); | 5845 instructions += StoreInstanceField(Closure::context_offset()); |
| 5839 | 5846 |
| 5840 return instructions; | 5847 return instructions; |
| 5841 } | 5848 } |
| 5842 | 5849 |
| 5843 | 5850 |
| 5844 } // namespace kernel | 5851 } // namespace kernel |
| 5845 } // namespace dart | 5852 } // namespace dart |
| 5846 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 5853 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| OLD | NEW |