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

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

Issue 774763002: Cleanups. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years 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 | « runtime/vm/compiler.cc ('k') | runtime/vm/flow_graph.cc » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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_H_ 5 #ifndef VM_FLOW_GRAPH_H_
6 #define VM_FLOW_GRAPH_H_ 6 #define VM_FLOW_GRAPH_H_
7 7
8 #include "vm/bit_vector.h" 8 #include "vm/bit_vector.h"
9 #include "vm/growable_array.h" 9 #include "vm/growable_array.h"
10 #include "vm/hash_map.h" 10 #include "vm/hash_map.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 static inline bool IsKeyEqual(Pair kv, Key key) { 77 static inline bool IsKeyEqual(Pair kv, Key key) {
78 return kv->value().raw() == key.raw(); 78 return kv->value().raw() == key.raw();
79 } 79 }
80 }; 80 };
81 81
82 82
83 // Class to encapsulate the construction and manipulation of the flow graph. 83 // Class to encapsulate the construction and manipulation of the flow graph.
84 class FlowGraph : public ZoneAllocated { 84 class FlowGraph : public ZoneAllocated {
85 public: 85 public:
86 FlowGraph(const FlowGraphBuilder& builder, 86 FlowGraph(ParsedFunction* parsed_function,
87 GraphEntryInstr* graph_entry, 87 GraphEntryInstr* graph_entry,
88 intptr_t max_block_id); 88 intptr_t max_block_id);
89 89
90 const FlowGraphBuilder& builder() const {
91 return builder_;
92 }
93
94 // Function properties. 90 // Function properties.
95 ParsedFunction& parsed_function() const { 91 ParsedFunction* parsed_function() const {
96 return parsed_function_; 92 return parsed_function_;
97 } 93 }
98 intptr_t parameter_count() const { 94 intptr_t parameter_count() const {
99 return num_copied_params_ + num_non_copied_params_; 95 return num_copied_params_ + num_non_copied_params_;
100 } 96 }
101 intptr_t variable_count() const { 97 intptr_t variable_count() const {
102 return parameter_count() + num_stack_locals(); 98 return parameter_count() + parsed_function_->num_stack_locals();
103 } 99 }
104 intptr_t num_stack_locals() const { 100 intptr_t num_stack_locals() const {
105 return parsed_function().num_stack_locals(); 101 return parsed_function_->num_stack_locals();
106 } 102 }
107 intptr_t num_copied_params() const { 103 intptr_t num_copied_params() const {
108 return num_copied_params_; 104 return num_copied_params_;
109 } 105 }
110 intptr_t num_non_copied_params() const { 106 intptr_t num_non_copied_params() const {
111 return num_non_copied_params_; 107 return num_non_copied_params_;
112 } 108 }
113 bool IsIrregexpFunction() const { 109 bool IsIrregexpFunction() const {
114 return parsed_function().function().IsIrregexpFunction(); 110 return parsed_function()->function().IsIrregexpFunction();
115 } 111 }
116 112
117 LocalVariable* CurrentContextVar() const { 113 LocalVariable* CurrentContextVar() const {
118 return parsed_function().current_context_var(); 114 return parsed_function()->current_context_var();
119 } 115 }
120 116
121 intptr_t CurrentContextEnvIndex() const { 117 intptr_t CurrentContextEnvIndex() const {
122 return parsed_function().current_context_var()->BitIndexIn( 118 return parsed_function()->current_context_var()->BitIndexIn(
123 num_non_copied_params_); 119 num_non_copied_params_);
124 } 120 }
125 121
126 // Flow graph orders. 122 // Flow graph orders.
127 const GrowableArray<BlockEntryInstr*>& preorder() const { 123 const GrowableArray<BlockEntryInstr*>& preorder() const {
128 return preorder_; 124 return preorder_;
129 } 125 }
130 const GrowableArray<BlockEntryInstr*>& postorder() const { 126 const GrowableArray<BlockEntryInstr*>& postorder() const {
131 return postorder_; 127 return postorder_;
132 } 128 }
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 329
334 // DiscoverBlocks computes parent_ and assigned_vars_ which are then used 330 // DiscoverBlocks computes parent_ and assigned_vars_ which are then used
335 // if/when computing SSA. 331 // if/when computing SSA.
336 GrowableArray<intptr_t> parent_; 332 GrowableArray<intptr_t> parent_;
337 GrowableArray<BitVector*> assigned_vars_; 333 GrowableArray<BitVector*> assigned_vars_;
338 334
339 intptr_t current_ssa_temp_index_; 335 intptr_t current_ssa_temp_index_;
340 intptr_t max_block_id_; 336 intptr_t max_block_id_;
341 337
342 // Flow graph fields. 338 // Flow graph fields.
343 const FlowGraphBuilder& builder_; 339 ParsedFunction* parsed_function_;
344 ParsedFunction& parsed_function_;
345 const intptr_t num_copied_params_; 340 const intptr_t num_copied_params_;
346 const intptr_t num_non_copied_params_; 341 const intptr_t num_non_copied_params_;
347 GraphEntryInstr* graph_entry_; 342 GraphEntryInstr* graph_entry_;
348 GrowableArray<BlockEntryInstr*> preorder_; 343 GrowableArray<BlockEntryInstr*> preorder_;
349 GrowableArray<BlockEntryInstr*> postorder_; 344 GrowableArray<BlockEntryInstr*> postorder_;
350 GrowableArray<BlockEntryInstr*> reverse_postorder_; 345 GrowableArray<BlockEntryInstr*> reverse_postorder_;
351 GrowableArray<BlockEntryInstr*> optimized_block_order_; 346 GrowableArray<BlockEntryInstr*> optimized_block_order_;
352 ConstantInstr* constant_null_; 347 ConstantInstr* constant_null_;
353 ConstantInstr* constant_dead_; 348 ConstantInstr* constant_dead_;
354 ConstantInstr* constant_empty_context_; 349 ConstantInstr* constant_empty_context_;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 505
511 private: 506 private:
512 GrowableArray<Definition*> defs_; 507 GrowableArray<Definition*> defs_;
513 BitVector* contains_vector_; 508 BitVector* contains_vector_;
514 }; 509 };
515 510
516 511
517 } // namespace dart 512 } // namespace dart
518 513
519 #endif // VM_FLOW_GRAPH_H_ 514 #endif // VM_FLOW_GRAPH_H_
OLDNEW
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/flow_graph.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698