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

Unified Diff: runtime/vm/ast.h

Issue 1308163006: Reduce the number of captured variables in async code, by only capturing local (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address comments Created 5 years, 3 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 | « no previous file | runtime/vm/ast_printer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/ast.h
diff --git a/runtime/vm/ast.h b/runtime/vm/ast.h
index 32fd18db8736962f4debcec2b076c5b520b75be4..7b4ae7953041feb3ed37baa38d585b33b867e610 100644
--- a/runtime/vm/ast.h
+++ b/runtime/vm/ast.h
@@ -165,13 +165,15 @@ class AwaitNode : public AstNode {
LocalVariable* saved_try_ctx,
LocalVariable* async_saved_try_ctx,
LocalVariable* outer_saved_try_ctx,
- LocalVariable* outer_async_saved_try_ctx)
+ LocalVariable* outer_async_saved_try_ctx,
+ LocalScope* scope)
: AstNode(token_pos),
expr_(expr),
saved_try_ctx_(saved_try_ctx),
async_saved_try_ctx_(async_saved_try_ctx),
outer_saved_try_ctx_(outer_saved_try_ctx),
- outer_async_saved_try_ctx_(outer_async_saved_try_ctx) { }
+ outer_async_saved_try_ctx_(outer_async_saved_try_ctx),
+ scope_(scope) { }
void VisitChildren(AstNodeVisitor* visitor) const {
expr_->Visit(visitor);
@@ -184,6 +186,7 @@ class AwaitNode : public AstNode {
LocalVariable* outer_async_saved_try_ctx() const {
return outer_async_saved_try_ctx_;
}
+ LocalScope* scope() const { return scope_; }
DECLARE_COMMON_NODE_FUNCTIONS(AwaitNode);
@@ -193,6 +196,7 @@ class AwaitNode : public AstNode {
LocalVariable* async_saved_try_ctx_;
LocalVariable* outer_saved_try_ctx_;
LocalVariable* outer_async_saved_try_ctx_;
+ LocalScope* scope_;
DISALLOW_COPY_AND_ASSIGN(AwaitNode);
};
@@ -209,17 +213,25 @@ class AwaitNode : public AstNode {
// <AwaitMarker> -> ...
class AwaitMarkerNode : public AstNode {
public:
- AwaitMarkerNode() : AstNode(Scanner::kNoSourcePos) { }
+ AwaitMarkerNode(LocalScope* async_scope, LocalScope* await_scope)
+ : AstNode(Scanner::kNoSourcePos),
+ async_scope_(async_scope),
+ await_scope_(await_scope) {
+ ASSERT(async_scope != NULL);
+ ASSERT(await_scope != NULL);
+ await_scope->CaptureLocalVariables(async_scope);
+ }
void VisitChildren(AstNodeVisitor* visitor) const { }
- LocalScope* scope() const { return scope_; }
- void set_scope(LocalScope* scope) { scope_ = scope; }
+ LocalScope* async_scope() const { return async_scope_; }
+ LocalScope* await_scope() const { return await_scope_; }
DECLARE_COMMON_NODE_FUNCTIONS(AwaitMarkerNode);
private:
- LocalScope* scope_;
+ LocalScope* async_scope_;
+ LocalScope* await_scope_;
DISALLOW_COPY_AND_ASSIGN(AwaitMarkerNode);
};
« no previous file with comments | « no previous file | runtime/vm/ast_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698