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 <set> | 5 #include <set> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "vm/kernel_to_il.h" | 8 #include "vm/kernel_to_il.h" |
9 | 9 |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 3534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3545 // :current_context_var from :await_ctx_var. | 3545 // :current_context_var from :await_ctx_var. |
3546 // Note: after this point context_depth_ does not match current context | 3546 // Note: after this point context_depth_ does not match current context |
3547 // depth so we should not access any local variables anymore. | 3547 // depth so we should not access any local variables anymore. |
3548 dispatch += LoadLocal(scopes_->yield_context_variable); | 3548 dispatch += LoadLocal(scopes_->yield_context_variable); |
3549 dispatch += StoreLocal(TokenPosition::kNoSource, | 3549 dispatch += StoreLocal(TokenPosition::kNoSource, |
3550 parsed_function_->current_context_var()); | 3550 parsed_function_->current_context_var()); |
3551 dispatch += Drop(); | 3551 dispatch += Drop(); |
3552 } | 3552 } |
3553 if (i == (yield_continuations_.length() - 1)) { | 3553 if (i == (yield_continuations_.length() - 1)) { |
3554 // We reached the last possility, no need to build more ifs. | 3554 // We reached the last possility, no need to build more ifs. |
3555 // Coninue to the last continuation. | 3555 // Continue to the last continuation. |
3556 // Note: continuations start with nop DropTemps instruction | 3556 // Note: continuations start with nop DropTemps instruction |
3557 // which acts like an anchor, so we need to skip it. | 3557 // which acts like an anchor, so we need to skip it. |
3558 block->set_try_index(yield_continuations_[i].try_index); | 3558 block->set_try_index(yield_continuations_[i].try_index); |
3559 dispatch <<= yield_continuations_[i].entry->next(); | 3559 dispatch <<= yield_continuations_[i].entry->next(); |
3560 break; | 3560 break; |
3561 } | 3561 } |
3562 | 3562 |
3563 // Build comparison: | 3563 // Build comparison: |
3564 // | 3564 // |
3565 // if (:await_ctx_var == i) { | 3565 // if (:await_ctx_var == i) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3611 | 3611 |
3612 // Call _asyncSetThreadStackTrace | 3612 // Call _asyncSetThreadStackTrace |
3613 instructions += StaticCall(TokenPosition::kNoSource, target, 1); | 3613 instructions += StaticCall(TokenPosition::kNoSource, target, 1); |
3614 instructions += Drop(); | 3614 instructions += Drop(); |
3615 | 3615 |
3616 body = instructions + body; | 3616 body = instructions + body; |
3617 context_depth_ = current_context_depth; | 3617 context_depth_ = current_context_depth; |
3618 } | 3618 } |
3619 | 3619 |
3620 if (NeedsDebugStepCheck(dart_function, function->position())) { | 3620 if (NeedsDebugStepCheck(dart_function, function->position())) { |
3621 // If a switch was added above: Start the switch by injecting a debugable | 3621 // If a switch was added above: Start the switch by injecting a debuggable |
3622 // safepoint so stepping over an await works. | 3622 // safepoint so stepping over an await works. |
3623 // If not, still start the body with a debugable safepoint to ensure | 3623 // If not, still start the body with a debuggable safepoint to ensure |
3624 // breaking on a method always happens, even if there are no | 3624 // breaking on a method always happens, even if there are no |
3625 // assignments/calls/runtimecalls in the first basic block. | 3625 // assignments/calls/runtimecalls in the first basic block. |
3626 // Place this check at the last parameter to ensure parameters | 3626 // Place this check at the last parameter to ensure parameters |
3627 // are in scope in the debugger at method entry. | 3627 // are in scope in the debugger at method entry. |
3628 const int num_params = dart_function.NumParameters(); | 3628 const int num_params = dart_function.NumParameters(); |
3629 TokenPosition check_pos = TokenPosition::kNoSource; | 3629 TokenPosition check_pos = TokenPosition::kNoSource; |
3630 if (num_params > 0) { | 3630 if (num_params > 0) { |
3631 LocalScope* scope = parsed_function_->node_sequence()->scope(); | 3631 LocalScope* scope = parsed_function_->node_sequence()->scope(); |
3632 const LocalVariable& parameter = *scope->VariableAt(num_params - 1); | 3632 const LocalVariable& parameter = *scope->VariableAt(num_params - 1); |
3633 check_pos = parameter.token_pos(); | 3633 check_pos = parameter.token_pos(); |
(...skipping 3189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6823 thread->clear_sticky_error(); | 6823 thread->clear_sticky_error(); |
6824 return error.raw(); | 6824 return error.raw(); |
6825 } | 6825 } |
6826 } | 6826 } |
6827 | 6827 |
6828 | 6828 |
6829 } // namespace kernel | 6829 } // namespace kernel |
6830 } // namespace dart | 6830 } // namespace dart |
6831 | 6831 |
6832 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 6832 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
OLD | NEW |