Chromium Code Reviews| Index: runtime/vm/flow_graph_builder.cc |
| =================================================================== |
| --- runtime/vm/flow_graph_builder.cc (revision 41084) |
| +++ runtime/vm/flow_graph_builder.cc (working copy) |
| @@ -1095,6 +1095,14 @@ |
| AddReturnExit(node->token_pos(), return_value); |
| + |
| + if (function.is_async_closure() && |
| + (node->return_type() == ReturnNode::kContinuationTarget)) { |
| + JoinEntryInstr* const join = new(I) JoinEntryInstr( |
| + owner()->AllocateBlockId(), owner()->try_index()); |
| + owner()->await_joins()->Add(join); |
| + exit_ = join; |
| + } |
| } |
| @@ -2214,43 +2222,28 @@ |
| void EffectGraphVisitor::VisitAwaitMarkerNode(AwaitMarkerNode* node) { |
| - if (node->marker_type() == AwaitMarkerNode::kNewContinuationState) { |
| - // We need to create a new await state which involves: |
| - // * Increase the jump counter. Sanity check against the list of targets. |
| - // * Save the current context for resuming. |
| - ASSERT(node->scope() != NULL); |
| - LocalVariable* jump_var = node->scope()->LookupVariable( |
| - Symbols::AwaitJumpVar(), false); |
| - LocalVariable* ctx_var = node->scope()->LookupVariable( |
| - Symbols::AwaitContextVar(), false); |
| - ASSERT((jump_var != NULL) && jump_var->is_captured()); |
| - ASSERT((ctx_var != NULL) && ctx_var->is_captured()); |
| - const intptr_t jump_cnt = owner()->next_await_counter(); |
| - ASSERT(jump_cnt >= 0); |
| - // Sanity check that we always add a JoinEntryInstr before adding a new |
| - // state. |
| - ASSERT(jump_cnt == owner()->await_joins()->length()); |
| - // Store the counter in :await_jump_var. |
| - Value* jump_val = Bind(new (I) ConstantInstr( |
| - Smi::ZoneHandle(I, Smi::New(jump_cnt)))); |
| - Do(BuildStoreLocal(*jump_var, jump_val)); |
| - // Save the current context for resuming. |
| - BuildSaveContext(*ctx_var); |
| - owner()->await_levels()->Add(owner()->context_level()); |
| - return; |
| - } |
| - if (node->marker_type() == AwaitMarkerNode::kTargetForContinuation) { |
| - // We need to create a new await target which involves: |
| - // * Append a join that is also added to the list that will later result in |
| - // a preamble. |
| - JoinEntryInstr* const join = new(I) JoinEntryInstr( |
| - owner()->AllocateBlockId(), owner()->try_index()); |
| - owner()->await_joins()->Add(join); |
| - Goto(join); |
| - exit_ = join; |
| - return; |
| - } |
| - UNREACHABLE(); |
| + // We need to create a new await state which involves: |
| + // * Increase the jump counter. Sanity check against the list of targets. |
| + // * Save the current context for resuming. |
| + ASSERT(node->scope() != NULL); |
| + LocalVariable* jump_var = node->scope()->LookupVariable( |
| + Symbols::AwaitJumpVar(), false); |
| + LocalVariable* ctx_var = node->scope()->LookupVariable( |
| + Symbols::AwaitContextVar(), false); |
| + ASSERT((jump_var != NULL) && jump_var->is_captured()); |
| + ASSERT((ctx_var != NULL) && ctx_var->is_captured()); |
| + const intptr_t jump_cnt = owner()->next_await_counter(); |
|
Florian Schneider
2014/10/14 11:47:30
Abbreviations that are not a prefix of the origina
hausner
2014/10/14 19:56:39
We use ctx as much as we use context across our so
|
| + ASSERT(jump_cnt >= 0); |
| + // Sanity check that we always add a JoinEntryInstr before adding a new |
| + // state. |
| + ASSERT(jump_cnt == owner()->await_joins()->length()); |
| + // Store the counter in :await_jump_var. |
| + Value* jump_val = Bind(new (I) ConstantInstr( |
| + Smi::ZoneHandle(I, Smi::New(jump_cnt)))); |
| + Do(BuildStoreLocal(*jump_var, jump_val)); |
| + // Save the current context for resuming. |
| + BuildSaveContext(*ctx_var); |
| + owner()->await_levels()->Add(owner()->context_level()); |
| } |