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 "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 // Each try in this function gets its own try index. | 41 // Each try in this function gets its own try index. |
42 intptr_t AllocateTryIndex() { return ++last_used_try_index_; } | 42 intptr_t AllocateTryIndex() { return ++last_used_try_index_; } |
43 | 43 |
44 // Manage the currently active try index. | 44 // Manage the currently active try index. |
45 void set_try_index(intptr_t value) { try_index_ = value; } | 45 void set_try_index(intptr_t value) { try_index_ = value; } |
46 intptr_t try_index() const { return try_index_; } | 46 intptr_t try_index() const { return try_index_; } |
47 | 47 |
48 void AddCatchEntry(TargetEntryInstr* entry); | 48 void AddCatchEntry(TargetEntryInstr* entry); |
49 | 49 |
50 intptr_t copied_parameter_count() const { | 50 intptr_t num_copied_params() const { |
51 return copied_parameter_count_; | 51 return num_copied_params_; |
52 } | 52 } |
53 intptr_t non_copied_parameter_count() const { | 53 intptr_t num_non_copied_params() const { |
54 return non_copied_parameter_count_; | 54 return num_non_copied_params_; |
55 } | 55 } |
56 intptr_t stack_local_count() const { | 56 intptr_t num_stack_locals() const { |
57 return stack_local_count_; | 57 return num_stack_locals_; |
58 } | 58 } |
59 | 59 |
60 bool InInliningContext() const { return inlining_context_ != kNotInlining; } | 60 bool InInliningContext() const { return inlining_context_ != kNotInlining; } |
61 void AddReturnExit(ReturnInstr* return_instr) { | 61 void AddReturnExit(ReturnInstr* return_instr) { |
62 if (InInliningContext()) { | 62 if (InInliningContext()) { |
63 ASSERT(exits_ != NULL); | 63 ASSERT(exits_ != NULL); |
64 exits_->Add(return_instr); | 64 exits_->Add(return_instr); |
65 } | 65 } |
66 } | 66 } |
67 | 67 |
68 private: | 68 private: |
69 intptr_t parameter_count() const { | 69 intptr_t parameter_count() const { |
70 return copied_parameter_count_ + non_copied_parameter_count_; | 70 return num_copied_params_ + num_non_copied_params_; |
71 } | 71 } |
72 intptr_t variable_count() const { | 72 intptr_t variable_count() const { |
73 return parameter_count() + stack_local_count_; | 73 return parameter_count() + num_stack_locals_; |
74 } | 74 } |
75 | 75 |
76 const ParsedFunction& parsed_function_; | 76 const ParsedFunction& parsed_function_; |
77 | 77 |
78 const intptr_t copied_parameter_count_; | 78 const intptr_t num_copied_params_; |
79 const intptr_t non_copied_parameter_count_; | 79 const intptr_t num_non_copied_params_; |
80 const intptr_t stack_local_count_; // Does not include any parameters. | 80 const intptr_t num_stack_locals_; // Does not include any parameters. |
81 | 81 |
82 intptr_t context_level_; | 82 intptr_t context_level_; |
83 intptr_t last_used_try_index_; | 83 intptr_t last_used_try_index_; |
84 intptr_t try_index_; | 84 intptr_t try_index_; |
85 GraphEntryInstr* graph_entry_; | 85 GraphEntryInstr* graph_entry_; |
86 InliningContext inlining_context_; | 86 InliningContext inlining_context_; |
87 ZoneGrowableArray<ReturnInstr*>* exits_; | 87 ZoneGrowableArray<ReturnInstr*>* exits_; |
88 | 88 |
89 DISALLOW_IMPLICIT_CONSTRUCTORS(FlowGraphBuilder); | 89 DISALLOW_IMPLICIT_CONSTRUCTORS(FlowGraphBuilder); |
90 }; | 90 }; |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 // Output parameters. | 379 // Output parameters. |
380 GrowableArray<TargetEntryInstr**> true_successor_addresses_; | 380 GrowableArray<TargetEntryInstr**> true_successor_addresses_; |
381 GrowableArray<TargetEntryInstr**> false_successor_addresses_; | 381 GrowableArray<TargetEntryInstr**> false_successor_addresses_; |
382 | 382 |
383 intptr_t condition_token_pos_; | 383 intptr_t condition_token_pos_; |
384 }; | 384 }; |
385 | 385 |
386 } // namespace dart | 386 } // namespace dart |
387 | 387 |
388 #endif // VM_FLOW_GRAPH_BUILDER_H_ | 388 #endif // VM_FLOW_GRAPH_BUILDER_H_ |
OLD | NEW |