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 RUNTIME_VM_FLOW_GRAPH_COMPILER_H_ | 5 #ifndef RUNTIME_VM_FLOW_GRAPH_COMPILER_H_ |
6 #define RUNTIME_VM_FLOW_GRAPH_COMPILER_H_ | 6 #define RUNTIME_VM_FLOW_GRAPH_COMPILER_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/code_descriptors.h" | 10 #include "vm/code_descriptors.h" |
11 #include "vm/code_generator.h" | 11 #include "vm/code_generator.h" |
12 #include "vm/intermediate_language.h" | 12 #include "vm/intermediate_language.h" |
| 13 #include "vm/code_statistics.h" |
13 | 14 |
14 namespace dart { | 15 namespace dart { |
15 | 16 |
16 // Forward declarations. | 17 // Forward declarations. |
17 class Code; | 18 class Code; |
18 class DeoptInfoBuilder; | 19 class DeoptInfoBuilder; |
19 class FlowGraph; | 20 class FlowGraph; |
20 class FlowGraphCompiler; | 21 class FlowGraphCompiler; |
21 class Function; | 22 class Function; |
22 template <typename T> | 23 template <typename T> |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 bool is_marked_; | 262 bool is_marked_; |
262 }; | 263 }; |
263 | 264 |
264 public: | 265 public: |
265 FlowGraphCompiler(Assembler* assembler, | 266 FlowGraphCompiler(Assembler* assembler, |
266 FlowGraph* flow_graph, | 267 FlowGraph* flow_graph, |
267 const ParsedFunction& parsed_function, | 268 const ParsedFunction& parsed_function, |
268 bool is_optimizing, | 269 bool is_optimizing, |
269 const GrowableArray<const Function*>& inline_id_to_function, | 270 const GrowableArray<const Function*>& inline_id_to_function, |
270 const GrowableArray<TokenPosition>& inline_id_to_token_pos, | 271 const GrowableArray<TokenPosition>& inline_id_to_token_pos, |
271 const GrowableArray<intptr_t>& caller_inline_id); | 272 const GrowableArray<intptr_t>& caller_inline_id, |
| 273 CodeStatistics* stats = NULL); |
272 | 274 |
273 ~FlowGraphCompiler(); | 275 ~FlowGraphCompiler(); |
274 | 276 |
275 static bool SupportsUnboxedDoubles(); | 277 static bool SupportsUnboxedDoubles(); |
276 static bool SupportsUnboxedMints(); | 278 static bool SupportsUnboxedMints(); |
277 static bool SupportsSinCos(); | 279 static bool SupportsSinCos(); |
278 static bool SupportsUnboxedSimd128(); | 280 static bool SupportsUnboxedSimd128(); |
279 static bool SupportsHardwareDivision(); | 281 static bool SupportsHardwareDivision(); |
280 static bool CanConvertUnboxedMintToDouble(); | 282 static bool CanConvertUnboxedMintToDouble(); |
281 | 283 |
(...skipping 23 matching lines...) Expand all Loading... |
305 | 307 |
306 Label* intrinsic_slow_path_label() { return &intrinsic_slow_path_label_; } | 308 Label* intrinsic_slow_path_label() { return &intrinsic_slow_path_label_; } |
307 | 309 |
308 bool ForceSlowPathForStackOverflow() const; | 310 bool ForceSlowPathForStackOverflow() const; |
309 | 311 |
310 const GrowableArray<BlockInfo*>& block_info() const { return block_info_; } | 312 const GrowableArray<BlockInfo*>& block_info() const { return block_info_; } |
311 ParallelMoveResolver* parallel_move_resolver() { | 313 ParallelMoveResolver* parallel_move_resolver() { |
312 return ¶llel_move_resolver_; | 314 return ¶llel_move_resolver_; |
313 } | 315 } |
314 | 316 |
| 317 void StatsBegin(Instruction* instr) { |
| 318 if (stats_ != NULL) stats_->Begin(instr); |
| 319 } |
| 320 |
| 321 void StatsEnd(Instruction* instr) { |
| 322 if (stats_ != NULL) stats_->End(instr); |
| 323 } |
| 324 |
| 325 void SpecialStatsBegin(intptr_t tag) { |
| 326 if (stats_ != NULL) stats_->SpecialBegin(tag); |
| 327 } |
| 328 |
| 329 void SpecialStatsEnd(intptr_t tag) { |
| 330 if (stats_ != NULL) stats_->SpecialEnd(tag); |
| 331 } |
| 332 |
315 // Constructor is lighweight, major initialization work should occur here. | 333 // Constructor is lighweight, major initialization work should occur here. |
316 // This makes it easier to measure time spent in the compiler. | 334 // This makes it easier to measure time spent in the compiler. |
317 void InitCompiler(); | 335 void InitCompiler(); |
318 | 336 |
319 void CompileGraph(); | 337 void CompileGraph(); |
320 | 338 |
321 void VisitBlocks(); | 339 void VisitBlocks(); |
322 | 340 |
323 // Bail out of the flow graph compiler. Does not return to the caller. | 341 // Bail out of the flow graph compiler. Does not return to the caller. |
324 void Bailout(const char* reason); | 342 void Bailout(const char* reason); |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 Environment* pending_deoptimization_env_; | 803 Environment* pending_deoptimization_env_; |
786 | 804 |
787 ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data_; | 805 ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data_; |
788 | 806 |
789 Array& edge_counters_array_; | 807 Array& edge_counters_array_; |
790 | 808 |
791 Array& inlined_code_intervals_; | 809 Array& inlined_code_intervals_; |
792 const GrowableArray<const Function*>& inline_id_to_function_; | 810 const GrowableArray<const Function*>& inline_id_to_function_; |
793 const GrowableArray<TokenPosition>& inline_id_to_token_pos_; | 811 const GrowableArray<TokenPosition>& inline_id_to_token_pos_; |
794 const GrowableArray<intptr_t>& caller_inline_id_; | 812 const GrowableArray<intptr_t>& caller_inline_id_; |
| 813 CodeStatistics* stats_; |
795 | 814 |
796 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 815 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); |
797 }; | 816 }; |
798 | 817 |
799 } // namespace dart | 818 } // namespace dart |
800 | 819 |
801 #endif // RUNTIME_VM_FLOW_GRAPH_COMPILER_H_ | 820 #endif // RUNTIME_VM_FLOW_GRAPH_COMPILER_H_ |
OLD | NEW |