| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 | 139 |
| 140 // Build a flow graph from a parsed function's AST. | 140 // Build a flow graph from a parsed function's AST. |
| 141 class FlowGraphBuilder: public ValueObject { | 141 class FlowGraphBuilder: public ValueObject { |
| 142 public: | 142 public: |
| 143 // The inlining context is NULL if not inlining. The osr_id is the deopt | 143 // The inlining context is NULL if not inlining. The osr_id is the deopt |
| 144 // id of the OSR entry or Isolate::kNoDeoptId if not compiling for OSR. | 144 // id of the OSR entry or Isolate::kNoDeoptId if not compiling for OSR. |
| 145 FlowGraphBuilder(ParsedFunction* parsed_function, | 145 FlowGraphBuilder(ParsedFunction* parsed_function, |
| 146 const ZoneGrowableArray<const ICData*>& ic_data_array, | 146 const ZoneGrowableArray<const ICData*>& ic_data_array, |
| 147 InlineExitCollector* exit_collector, | 147 InlineExitCollector* exit_collector, |
| 148 intptr_t osr_id, | 148 intptr_t osr_id); |
| 149 bool is_optimizing); | |
| 150 | 149 |
| 151 FlowGraph* BuildGraph(); | 150 FlowGraph* BuildGraph(); |
| 152 | 151 |
| 153 ParsedFunction* parsed_function() const { return parsed_function_; } | 152 ParsedFunction* parsed_function() const { return parsed_function_; } |
| 154 const ZoneGrowableArray<const ICData*>& ic_data_array() const { | 153 const ZoneGrowableArray<const ICData*>& ic_data_array() const { |
| 155 return ic_data_array_; | 154 return ic_data_array_; |
| 156 } | 155 } |
| 157 | 156 |
| 158 // Return true if a Javascript compatibility warning should be emitted at | 157 // Return true if a Javascript compatibility warning should be emitted at |
| 159 // runtime for this type test. | 158 // runtime for this type test. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 intptr_t num_non_copied_params() const { | 193 intptr_t num_non_copied_params() const { |
| 195 return num_non_copied_params_; | 194 return num_non_copied_params_; |
| 196 } | 195 } |
| 197 intptr_t num_stack_locals() const { | 196 intptr_t num_stack_locals() const { |
| 198 return num_stack_locals_; | 197 return num_stack_locals_; |
| 199 } | 198 } |
| 200 | 199 |
| 201 bool IsInlining() const { return (exit_collector_ != NULL); } | 200 bool IsInlining() const { return (exit_collector_ != NULL); } |
| 202 InlineExitCollector* exit_collector() const { return exit_collector_; } | 201 InlineExitCollector* exit_collector() const { return exit_collector_; } |
| 203 | 202 |
| 204 bool is_optimizing() const { return is_optimizing_; } | |
| 205 | |
| 206 ZoneGrowableArray<const Field*>* guarded_fields() const { | 203 ZoneGrowableArray<const Field*>* guarded_fields() const { |
| 207 return guarded_fields_; | 204 return guarded_fields_; |
| 208 } | 205 } |
| 209 | 206 |
| 210 ZoneGrowableArray<const LibraryPrefix*>* deferred_prefixes() const { | 207 ZoneGrowableArray<const LibraryPrefix*>* deferred_prefixes() const { |
| 211 return parsed_function_->deferred_prefixes(); | 208 return parsed_function_->deferred_prefixes(); |
| 212 } | 209 } |
| 213 | 210 |
| 214 intptr_t temp_count() const { return temp_count_; } | 211 intptr_t temp_count() const { return temp_count_; } |
| 215 intptr_t AllocateTemp() { return temp_count_++; } | 212 intptr_t AllocateTemp() { return temp_count_++; } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 227 // OSR entry point. | 224 // OSR entry point. |
| 228 void PruneUnreachable(); | 225 void PruneUnreachable(); |
| 229 | 226 |
| 230 // Returns address where the constant 'value' is stored or 0 if not found. | 227 // Returns address where the constant 'value' is stored or 0 if not found. |
| 231 static uword FindDoubleConstant(double value); | 228 static uword FindDoubleConstant(double value); |
| 232 | 229 |
| 233 Isolate* isolate() const { return parsed_function()->isolate(); } | 230 Isolate* isolate() const { return parsed_function()->isolate(); } |
| 234 | 231 |
| 235 private: | 232 private: |
| 236 friend class NestedStatement; // Explicit access to nesting_stack_. | 233 friend class NestedStatement; // Explicit access to nesting_stack_. |
| 234 friend class Intrinsifier; |
| 237 | 235 |
| 238 intptr_t parameter_count() const { | 236 intptr_t parameter_count() const { |
| 239 return num_copied_params_ + num_non_copied_params_; | 237 return num_copied_params_ + num_non_copied_params_; |
| 240 } | 238 } |
| 241 intptr_t variable_count() const { | 239 intptr_t variable_count() const { |
| 242 return parameter_count() + num_stack_locals_; | 240 return parameter_count() + num_stack_locals_; |
| 243 } | 241 } |
| 244 | 242 |
| 245 ParsedFunction* parsed_function_; | 243 ParsedFunction* parsed_function_; |
| 246 const ZoneGrowableArray<const ICData*>& ic_data_array_; | 244 const ZoneGrowableArray<const ICData*>& ic_data_array_; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 263 // Outgoing argument stack height. | 261 // Outgoing argument stack height. |
| 264 intptr_t args_pushed_; | 262 intptr_t args_pushed_; |
| 265 | 263 |
| 266 // A stack of enclosing nested statements. | 264 // A stack of enclosing nested statements. |
| 267 NestedStatement* nesting_stack_; | 265 NestedStatement* nesting_stack_; |
| 268 | 266 |
| 269 // The deopt id of the OSR entry or Isolate::kNoDeoptId if not compiling | 267 // The deopt id of the OSR entry or Isolate::kNoDeoptId if not compiling |
| 270 // for OSR. | 268 // for OSR. |
| 271 const intptr_t osr_id_; | 269 const intptr_t osr_id_; |
| 272 | 270 |
| 273 // The graph is being rebuilt for the optimizing compiler. | |
| 274 // Do not generate a different graph based on this flag. | |
| 275 const bool is_optimizing_; | |
| 276 | |
| 277 intptr_t jump_cnt_; | 271 intptr_t jump_cnt_; |
| 278 ZoneGrowableArray<JoinEntryInstr*>* await_joins_; | 272 ZoneGrowableArray<JoinEntryInstr*>* await_joins_; |
| 279 ZoneGrowableArray<intptr_t>* await_levels_; | 273 ZoneGrowableArray<intptr_t>* await_levels_; |
| 280 | 274 |
| 281 DISALLOW_IMPLICIT_CONSTRUCTORS(FlowGraphBuilder); | 275 DISALLOW_IMPLICIT_CONSTRUCTORS(FlowGraphBuilder); |
| 282 }; | 276 }; |
| 283 | 277 |
| 284 | 278 |
| 285 // Translate an AstNode to a control-flow graph fragment for its effects | 279 // Translate an AstNode to a control-flow graph fragment for its effects |
| 286 // (e.g., a statement or an expression in an effect context). Implements a | 280 // (e.g., a statement or an expression in an effect context). Implements a |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 // Output parameters. | 598 // Output parameters. |
| 605 GrowableArray<TargetEntryInstr**> true_successor_addresses_; | 599 GrowableArray<TargetEntryInstr**> true_successor_addresses_; |
| 606 GrowableArray<TargetEntryInstr**> false_successor_addresses_; | 600 GrowableArray<TargetEntryInstr**> false_successor_addresses_; |
| 607 | 601 |
| 608 intptr_t condition_token_pos_; | 602 intptr_t condition_token_pos_; |
| 609 }; | 603 }; |
| 610 | 604 |
| 611 } // namespace dart | 605 } // namespace dart |
| 612 | 606 |
| 613 #endif // VM_FLOW_GRAPH_BUILDER_H_ | 607 #endif // VM_FLOW_GRAPH_BUILDER_H_ |
| OLD | NEW |