Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 634603002: Await always waits (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {

Powered by Google App Engine
This is Rietveld 408576698