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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 944893005: Implement async* functions in VM (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 10 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
« no previous file with comments | « runtime/vm/flow_graph_builder.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_builder.cc
===================================================================
--- runtime/vm/flow_graph_builder.cc (revision 44183)
+++ runtime/vm/flow_graph_builder.cc (working copy)
@@ -1111,7 +1111,9 @@
AddReturnExit(node->token_pos(), return_value);
- if ((function.IsAsyncClosure() || function.IsSyncGenClosure()) &&
+ if ((function.IsAsyncClosure() ||
+ function.IsSyncGenClosure() ||
+ function.IsAsyncGenClosure()) &&
(node->return_type() == ReturnNode::kContinuationTarget)) {
JoinEntryInstr* const join = new(I) JoinEntryInstr(
owner()->AllocateBlockId(), owner()->try_index());
@@ -1483,10 +1485,10 @@
}
-void EffectGraphVisitor::BuildYieldJump(LocalVariable* old_context,
- LocalVariable* iterator_param,
- const intptr_t old_ctx_level,
- JoinEntryInstr* target) {
+void EffectGraphVisitor::BuildSyncYieldJump(LocalVariable* old_context,
+ LocalVariable* iterator_param,
+ const intptr_t old_ctx_level,
+ JoinEntryInstr* target) {
// Building a jump consists of the following actions:
// * Load the generator body's iterator parameter (:iterator)
// from the current context into a temporary.
@@ -1539,7 +1541,7 @@
}
-void EffectGraphVisitor::BuildAwaitJump(LocalVariable* old_context,
+void EffectGraphVisitor::BuildAsyncJump(LocalVariable* old_context,
LocalVariable* continuation_result,
LocalVariable* continuation_error,
LocalVariable* continuation_stack_trace,
@@ -3882,7 +3884,9 @@
// The preamble is generated after visiting the body.
GotoInstr* preamble_start = NULL;
if (is_top_level_sequence &&
- (function.IsAsyncClosure() || function.IsSyncGenClosure())) {
+ (function.IsAsyncClosure() ||
+ function.IsSyncGenClosure() ||
+ function.IsAsyncGenClosure())) {
JoinEntryInstr* preamble_end = new(I) JoinEntryInstr(
owner()->AllocateBlockId(), owner()->try_index());
ASSERT(exit() != NULL);
@@ -3908,7 +3912,9 @@
// After generating the CFG for the body we can create the preamble
// because we know exactly how many continuation states we need.
if (is_top_level_sequence &&
- (function.IsAsyncClosure() || function.IsSyncGenClosure())) {
+ (function.IsAsyncClosure() ||
+ function.IsSyncGenClosure() ||
+ function.IsAsyncGenClosure())) {
ASSERT(preamble_start != NULL);
// We are at the top level. Fetch the corresponding scope.
LocalScope* top_scope = node->scope();
@@ -3939,7 +3945,7 @@
EffectGraphVisitor for_true(owner());
EffectGraphVisitor for_false(owner());
- if (function.IsAsyncClosure()) {
+ if (function.IsAsyncClosure() || function.IsAsyncGenClosure()) {
LocalVariable* result_param =
top_scope->LookupVariable(Symbols::AsyncOperationParam(), false);
LocalVariable* error_param =
@@ -3948,7 +3954,7 @@
LocalVariable* stack_trace_param =
top_scope->LookupVariable(Symbols::AsyncOperationStackTraceParam(),
false);
- for_true.BuildAwaitJump(old_context,
+ for_true.BuildAsyncJump(old_context,
result_param,
error_param,
stack_trace_param,
@@ -3958,10 +3964,10 @@
ASSERT(function.IsSyncGenClosure());
LocalVariable* iterator_param =
top_scope->LookupVariable(Symbols::IteratorParameter(), false);
- for_true.BuildYieldJump(old_context,
- iterator_param,
- (*owner()->await_levels())[i],
- (*owner()->await_joins())[i]);
+ for_true.BuildSyncYieldJump(old_context,
+ iterator_param,
+ (*owner()->await_levels())[i],
+ (*owner()->await_joins())[i]);
}
Join(for_test, for_true, for_false);
« no previous file with comments | « runtime/vm/flow_graph_builder.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698