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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 FlowGraph* caller_graph_; | 117 FlowGraph* caller_graph_; |
118 Definition* call_; | 118 Definition* call_; |
119 GrowableArray<Data> exits_; | 119 GrowableArray<Data> exits_; |
120 }; | 120 }; |
121 | 121 |
122 | 122 |
123 // Build a flow graph from a parsed function's AST. | 123 // Build a flow graph from a parsed function's AST. |
124 class FlowGraphBuilder : public ValueObject { | 124 class FlowGraphBuilder : public ValueObject { |
125 public: | 125 public: |
126 // The inlining context is NULL if not inlining. The osr_id is the deopt | 126 // The inlining context is NULL if not inlining. The osr_id is the deopt |
127 // id of the OSR entry or Isolate::kNoDeoptId if not compiling for OSR. | 127 // id of the OSR entry or Thread::kNoDeoptId if not compiling for OSR. |
128 FlowGraphBuilder(const ParsedFunction& parsed_function, | 128 FlowGraphBuilder(const ParsedFunction& parsed_function, |
129 const ZoneGrowableArray<const ICData*>& ic_data_array, | 129 const ZoneGrowableArray<const ICData*>& ic_data_array, |
130 InlineExitCollector* exit_collector, | 130 InlineExitCollector* exit_collector, |
131 intptr_t osr_id); | 131 intptr_t osr_id); |
132 | 132 |
133 FlowGraph* BuildGraph(); | 133 FlowGraph* BuildGraph(); |
134 | 134 |
135 const ParsedFunction& parsed_function() const { return parsed_function_; } | 135 const ParsedFunction& parsed_function() const { return parsed_function_; } |
136 const Function& function() const { return parsed_function_.function(); } | 136 const Function& function() const { return parsed_function_.function(); } |
137 const ZoneGrowableArray<const ICData*>& ic_data_array() const { | 137 const ZoneGrowableArray<const ICData*>& ic_data_array() const { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 203 |
204 NestedStatement* nesting_stack() const { return nesting_stack_; } | 204 NestedStatement* nesting_stack() const { return nesting_stack_; } |
205 | 205 |
206 // When compiling for OSR, remove blocks that are not reachable from the | 206 // When compiling for OSR, remove blocks that are not reachable from the |
207 // OSR entry point. | 207 // OSR entry point. |
208 void PruneUnreachable(); | 208 void PruneUnreachable(); |
209 | 209 |
210 // Returns address where the constant 'value' is stored or 0 if not found. | 210 // Returns address where the constant 'value' is stored or 0 if not found. |
211 static uword FindDoubleConstant(double value); | 211 static uword FindDoubleConstant(double value); |
212 | 212 |
| 213 Thread* thread() const { return parsed_function().thread(); } |
213 Isolate* isolate() const { return parsed_function().isolate(); } | 214 Isolate* isolate() const { return parsed_function().isolate(); } |
214 Zone* zone() const { return parsed_function().zone(); } | 215 Zone* zone() const { return parsed_function().zone(); } |
215 | 216 |
216 private: | 217 private: |
217 friend class NestedStatement; // Explicit access to nesting_stack_. | 218 friend class NestedStatement; // Explicit access to nesting_stack_. |
218 friend class Intrinsifier; | 219 friend class Intrinsifier; |
219 | 220 |
220 intptr_t parameter_count() const { | 221 intptr_t parameter_count() const { |
221 return num_copied_params_ + num_non_copied_params_; | 222 return num_copied_params_ + num_non_copied_params_; |
222 } | 223 } |
(...skipping 17 matching lines...) Expand all Loading... |
240 | 241 |
241 // The expression stack height. | 242 // The expression stack height. |
242 intptr_t temp_count_; | 243 intptr_t temp_count_; |
243 | 244 |
244 // Outgoing argument stack height. | 245 // Outgoing argument stack height. |
245 intptr_t args_pushed_; | 246 intptr_t args_pushed_; |
246 | 247 |
247 // A stack of enclosing nested statements. | 248 // A stack of enclosing nested statements. |
248 NestedStatement* nesting_stack_; | 249 NestedStatement* nesting_stack_; |
249 | 250 |
250 // The deopt id of the OSR entry or Isolate::kNoDeoptId if not compiling | 251 // The deopt id of the OSR entry or Thread::kNoDeoptId if not compiling |
251 // for OSR. | 252 // for OSR. |
252 const intptr_t osr_id_; | 253 const intptr_t osr_id_; |
253 | 254 |
254 intptr_t jump_count_; | 255 intptr_t jump_count_; |
255 ZoneGrowableArray<JoinEntryInstr*>* await_joins_; | 256 ZoneGrowableArray<JoinEntryInstr*>* await_joins_; |
256 | 257 |
257 DISALLOW_IMPLICIT_CONSTRUCTORS(FlowGraphBuilder); | 258 DISALLOW_IMPLICIT_CONSTRUCTORS(FlowGraphBuilder); |
258 }; | 259 }; |
259 | 260 |
260 | 261 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 // Helpers for allocating and deallocating temporary locals on top of the | 460 // Helpers for allocating and deallocating temporary locals on top of the |
460 // expression stack. | 461 // expression stack. |
461 LocalVariable* EnterTempLocalScope(Value* value); | 462 LocalVariable* EnterTempLocalScope(Value* value); |
462 Definition* ExitTempLocalScope(LocalVariable* var); | 463 Definition* ExitTempLocalScope(LocalVariable* var); |
463 | 464 |
464 void BuildLetTempExpressions(LetNode* node); | 465 void BuildLetTempExpressions(LetNode* node); |
465 | 466 |
466 void BuildInstanceGetterConditional(InstanceGetterNode* node); | 467 void BuildInstanceGetterConditional(InstanceGetterNode* node); |
467 void BuildInstanceCallConditional(InstanceCallNode* node); | 468 void BuildInstanceCallConditional(InstanceCallNode* node); |
468 | 469 |
| 470 Thread* thread() const { return owner()->thread(); } |
469 Isolate* isolate() const { return owner()->isolate(); } | 471 Isolate* isolate() const { return owner()->isolate(); } |
470 Zone* zone() const { return owner()->zone(); } | 472 Zone* zone() const { return owner()->zone(); } |
471 | 473 |
472 private: | 474 private: |
473 friend class TempLocalScope; // For ReturnDefinition. | 475 friend class TempLocalScope; // For ReturnDefinition. |
474 | 476 |
475 // Helper to drop the result value. | 477 // Helper to drop the result value. |
476 virtual void ReturnValue(Value* value) { | 478 virtual void ReturnValue(Value* value) { |
477 Do(new DropTempsInstr(0, value)); | 479 Do(new DropTempsInstr(0, value)); |
478 } | 480 } |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 // Output parameters. | 602 // Output parameters. |
601 GrowableArray<TargetEntryInstr**> true_successor_addresses_; | 603 GrowableArray<TargetEntryInstr**> true_successor_addresses_; |
602 GrowableArray<TargetEntryInstr**> false_successor_addresses_; | 604 GrowableArray<TargetEntryInstr**> false_successor_addresses_; |
603 | 605 |
604 intptr_t condition_token_pos_; | 606 intptr_t condition_token_pos_; |
605 }; | 607 }; |
606 | 608 |
607 } // namespace dart | 609 } // namespace dart |
608 | 610 |
609 #endif // VM_FLOW_GRAPH_BUILDER_H_ | 611 #endif // VM_FLOW_GRAPH_BUILDER_H_ |
OLD | NEW |