Index: runtime/vm/flow_graph_builder.cc |
=================================================================== |
--- runtime/vm/flow_graph_builder.cc (revision 40935) |
+++ runtime/vm/flow_graph_builder.cc (working copy) |
@@ -258,10 +258,7 @@ |
temp_count_(0), |
args_pushed_(0), |
nesting_stack_(NULL), |
- osr_id_(osr_id), |
- jump_cnt_(0), |
- await_joins_(new(I) ZoneGrowableArray<JoinEntryInstr*>()), |
- await_levels_(new(I) ZoneGrowableArray<intptr_t>()) { } |
+ osr_id_(osr_id) { } |
void FlowGraphBuilder::AddCatchEntry(CatchBlockEntryInstr* entry) { |
@@ -1095,6 +1092,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; |
+ } |
} |
@@ -2229,26 +2234,18 @@ |
ASSERT(jump_cnt >= 0); |
// Sanity check that we always add a JoinEntryInstr before adding a new |
// state. |
- ASSERT(jump_cnt == owner()->await_joins()->length()); |
+ 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()); |
+ 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(); //XXX |
} |
UNREACHABLE(); |
} |
@@ -3881,7 +3878,7 @@ |
LoadLocalNode* load_jump_cnt = new(I) LoadLocalNode( |
Scanner::kNoSourcePos, jump_var); |
ComparisonNode* check_jump_cnt; |
- const intptr_t num_await_states = owner()->await_joins()->length(); |
+ const intptr_t num_await_states = owner()->await_joins().length(); |
for (intptr_t i = 0; i < num_await_states; i++) { |
check_jump_cnt = new(I) ComparisonNode( |
Scanner::kNoSourcePos, |
@@ -3895,8 +3892,8 @@ |
EffectGraphVisitor for_false(owner()); |
for_true.BuildAwaitJump(top_scope, |
- (*owner()->await_levels())[i], |
- (*owner()->await_joins())[i]); |
+ owner()->await_levels()[i], |
+ owner()->await_joins()[i]); |
Join(for_test, for_true, for_false); |
if (i == 0) { |