OLD | NEW |
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_FLOW_GRAPH_BUILDER_H_ | 5 #ifndef VM_FLOW_GRAPH_BUILDER_H_ |
6 #define VM_FLOW_GRAPH_BUILDER_H_ | 6 #define VM_FLOW_GRAPH_BUILDER_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "platform/globals.h" | 9 #include "platform/globals.h" |
10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 intptr_t loop_depth() const { return loop_depth_; } | 172 intptr_t loop_depth() const { return loop_depth_; } |
173 | 173 |
174 // Manage the currently active try index. | 174 // Manage the currently active try index. |
175 void set_try_index(intptr_t value) { try_index_ = value; } | 175 void set_try_index(intptr_t value) { try_index_ = value; } |
176 intptr_t try_index() const { return try_index_; } | 176 intptr_t try_index() const { return try_index_; } |
177 | 177 |
178 // Manage the currently active catch-handler try index. | 178 // Manage the currently active catch-handler try index. |
179 void set_catch_try_index(intptr_t value) { catch_try_index_ = value; } | 179 void set_catch_try_index(intptr_t value) { catch_try_index_ = value; } |
180 intptr_t catch_try_index() const { return catch_try_index_; } | 180 intptr_t catch_try_index() const { return catch_try_index_; } |
181 | 181 |
| 182 intptr_t next_await_counter() { return jump_cnt_++; } |
| 183 |
| 184 ZoneGrowableArray<intptr_t>* await_levels() const { return await_levels_; } |
| 185 ZoneGrowableArray<JoinEntryInstr*>* await_joins() const { |
| 186 return await_joins_; |
| 187 } |
| 188 |
182 void AddCatchEntry(CatchBlockEntryInstr* entry); | 189 void AddCatchEntry(CatchBlockEntryInstr* entry); |
183 | 190 |
184 intptr_t num_copied_params() const { | 191 intptr_t num_copied_params() const { |
185 return num_copied_params_; | 192 return num_copied_params_; |
186 } | 193 } |
187 intptr_t num_non_copied_params() const { | 194 intptr_t num_non_copied_params() const { |
188 return num_non_copied_params_; | 195 return num_non_copied_params_; |
189 } | 196 } |
190 intptr_t num_stack_locals() const { | 197 intptr_t num_stack_locals() const { |
191 return num_stack_locals_; | 198 return num_stack_locals_; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 NestedStatement* nesting_stack_; | 267 NestedStatement* nesting_stack_; |
261 | 268 |
262 // The deopt id of the OSR entry or Isolate::kNoDeoptId if not compiling | 269 // The deopt id of the OSR entry or Isolate::kNoDeoptId if not compiling |
263 // for OSR. | 270 // for OSR. |
264 const intptr_t osr_id_; | 271 const intptr_t osr_id_; |
265 | 272 |
266 // The graph is being rebuilt for the optimizing compiler. | 273 // The graph is being rebuilt for the optimizing compiler. |
267 // Do not generate a different graph based on this flag. | 274 // Do not generate a different graph based on this flag. |
268 const bool is_optimizing_; | 275 const bool is_optimizing_; |
269 | 276 |
| 277 intptr_t jump_cnt_; |
| 278 ZoneGrowableArray<JoinEntryInstr*>* await_joins_; |
| 279 ZoneGrowableArray<intptr_t>* await_levels_; |
| 280 |
270 DISALLOW_IMPLICIT_CONSTRUCTORS(FlowGraphBuilder); | 281 DISALLOW_IMPLICIT_CONSTRUCTORS(FlowGraphBuilder); |
271 }; | 282 }; |
272 | 283 |
273 | 284 |
274 // Translate an AstNode to a control-flow graph fragment for its effects | 285 // Translate an AstNode to a control-flow graph fragment for its effects |
275 // (e.g., a statement or an expression in an effect context). Implements a | 286 // (e.g., a statement or an expression in an effect context). Implements a |
276 // function from an AstNode and next temporary index to a graph fragment | 287 // function from an AstNode and next temporary index to a graph fragment |
277 // with a single entry and at most one exit. The fragment is represented by | 288 // with a single entry and at most one exit. The fragment is represented by |
278 // an (entry, exit) pair of Instruction pointers: | 289 // an (entry, exit) pair of Instruction pointers: |
279 // | 290 // |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 const AbstractType& dst_type, | 461 const AbstractType& dst_type, |
451 const String& dst_name); | 462 const String& dst_name); |
452 | 463 |
453 // Helpers for allocating and deallocating temporary locals on top of the | 464 // Helpers for allocating and deallocating temporary locals on top of the |
454 // expression stack. | 465 // expression stack. |
455 LocalVariable* EnterTempLocalScope(Value* value); | 466 LocalVariable* EnterTempLocalScope(Value* value); |
456 Definition* ExitTempLocalScope(LocalVariable* var); | 467 Definition* ExitTempLocalScope(LocalVariable* var); |
457 | 468 |
458 void BuildLetTempExpressions(LetNode* node); | 469 void BuildLetTempExpressions(LetNode* node); |
459 | 470 |
| 471 void BuildAwaitJump(LocalScope* lookup_scope, |
| 472 const intptr_t old_ctx_level, |
| 473 JoinEntryInstr* target); |
| 474 |
460 Isolate* isolate() const { return owner()->isolate(); } | 475 Isolate* isolate() const { return owner()->isolate(); } |
461 | 476 |
462 private: | 477 private: |
463 friend class TempLocalScope; // For ReturnDefinition. | 478 friend class TempLocalScope; // For ReturnDefinition. |
464 | 479 |
465 // Helper to drop the result value. | 480 // Helper to drop the result value. |
466 virtual void ReturnValue(Value* value) { | 481 virtual void ReturnValue(Value* value) { |
467 Do(new DropTempsInstr(0, value)); | 482 Do(new DropTempsInstr(0, value)); |
468 } | 483 } |
469 | 484 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 // Output parameters. | 603 // Output parameters. |
589 GrowableArray<TargetEntryInstr**> true_successor_addresses_; | 604 GrowableArray<TargetEntryInstr**> true_successor_addresses_; |
590 GrowableArray<TargetEntryInstr**> false_successor_addresses_; | 605 GrowableArray<TargetEntryInstr**> false_successor_addresses_; |
591 | 606 |
592 intptr_t condition_token_pos_; | 607 intptr_t condition_token_pos_; |
593 }; | 608 }; |
594 | 609 |
595 } // namespace dart | 610 } // namespace dart |
596 | 611 |
597 #endif // VM_FLOW_GRAPH_BUILDER_H_ | 612 #endif // VM_FLOW_GRAPH_BUILDER_H_ |
OLD | NEW |