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

Side by Side Diff: runtime/vm/ast.h

Issue 1079233002: Simplify restoring of saved try contexts in async code by passing around the (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/ast_transformer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_AST_H_ 5 #ifndef VM_AST_H_
6 #define VM_AST_H_ 6 #define VM_AST_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/allocation.h" 9 #include "vm/allocation.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 private: 154 private:
155 const intptr_t token_pos_; 155 const intptr_t token_pos_;
156 DISALLOW_COPY_AND_ASSIGN(AstNode); 156 DISALLOW_COPY_AND_ASSIGN(AstNode);
157 }; 157 };
158 158
159 159
160 class AwaitNode : public AstNode { 160 class AwaitNode : public AstNode {
161 public: 161 public:
162 AwaitNode(intptr_t token_pos, 162 AwaitNode(intptr_t token_pos,
163 AstNode* expr, 163 AstNode* expr,
164 LocalScope* try_scope, 164 LocalVariable* saved_try_ctx,
165 int16_t try_index, 165 LocalVariable* async_saved_try_ctx,
166 LocalScope* outer_try_scope, 166 LocalVariable* outer_saved_try_ctx,
167 intptr_t outer_try_index) 167 LocalVariable* outer_async_saved_try_ctx)
168 : AstNode(token_pos), 168 : AstNode(token_pos),
169 expr_(expr), 169 expr_(expr),
170 try_scope_(try_scope), 170 saved_try_ctx_(saved_try_ctx),
171 try_index_(try_index), 171 async_saved_try_ctx_(async_saved_try_ctx),
172 outer_try_scope_(outer_try_scope), 172 outer_saved_try_ctx_(outer_saved_try_ctx),
173 outer_try_index_(outer_try_index) { } 173 outer_async_saved_try_ctx_(outer_async_saved_try_ctx) { }
174 174
175 void VisitChildren(AstNodeVisitor* visitor) const { 175 void VisitChildren(AstNodeVisitor* visitor) const {
176 expr_->Visit(visitor); 176 expr_->Visit(visitor);
177 } 177 }
178 178
179 AstNode* expr() const { return expr_; } 179 AstNode* expr() const { return expr_; }
180 LocalScope* try_scope() const { return try_scope_; } 180 LocalVariable* saved_try_ctx() const { return saved_try_ctx_; }
181 int16_t try_index() const { return try_index_; } 181 LocalVariable* async_saved_try_ctx() const { return async_saved_try_ctx_; }
182 LocalScope* outer_try_scope() const { return outer_try_scope_; } 182 LocalVariable* outer_saved_try_ctx() const { return outer_saved_try_ctx_; }
183 int16_t outer_try_index() const { return outer_try_index_; } 183 LocalVariable* outer_async_saved_try_ctx() const {
184 return outer_async_saved_try_ctx_;
185 }
184 186
185 DECLARE_COMMON_NODE_FUNCTIONS(AwaitNode); 187 DECLARE_COMMON_NODE_FUNCTIONS(AwaitNode);
186 188
187 private: 189 private:
188 AstNode* expr_; 190 AstNode* expr_;
189 LocalScope* try_scope_; 191 LocalVariable* saved_try_ctx_;
190 int16_t try_index_; 192 LocalVariable* async_saved_try_ctx_;
191 LocalScope* outer_try_scope_; 193 LocalVariable* outer_saved_try_ctx_;
192 int16_t outer_try_index_; 194 LocalVariable* outer_async_saved_try_ctx_;
193 195
194 DISALLOW_COPY_AND_ASSIGN(AwaitNode); 196 DISALLOW_COPY_AND_ASSIGN(AwaitNode);
195 }; 197 };
196 198
197 199
198 // AwaitMarker nodes are used to generate markers that the FlowGraphBuilder 200 // AwaitMarker nodes are used to generate markers that the FlowGraphBuilder
199 // relies on. A marker indicates that a new await state needs to be 201 // relies on. A marker indicates that a new await state needs to be
200 // added to a function preamble. This type also triggers storing of the 202 // added to a function preamble. This type also triggers storing of the
201 // current context. 203 // current context.
202 // 204 //
(...skipping 1742 matching lines...) Expand 10 before | Expand all | Expand 10 after
1945 const intptr_t try_index_; 1947 const intptr_t try_index_;
1946 1948
1947 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); 1949 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode);
1948 }; 1950 };
1949 1951
1950 } // namespace dart 1952 } // namespace dart
1951 1953
1952 #undef DECLARE_COMMON_NODE_FUNCTIONS 1954 #undef DECLARE_COMMON_NODE_FUNCTIONS
1953 1955
1954 #endif // VM_AST_H_ 1956 #endif // VM_AST_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/ast_transformer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698