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 | 13 |
14 namespace dart { | 14 namespace dart { |
15 | 15 |
16 // Forward declarations. | 16 // Forward declarations. |
17 class Code; | 17 class Code; |
18 class DeoptInfoBuilder; | 18 class DeoptInfoBuilder; |
19 class FlowGraph; | 19 class FlowGraph; |
20 class FlowGraphCompiler; | 20 class FlowGraphCompiler; |
21 class Function; | 21 class Function; |
22 template <typename T> | 22 template <typename T> |
23 class GrowableArray; | 23 class GrowableArray; |
24 class ParsedFunction; | 24 class ParsedFunction; |
25 | 25 |
26 | |
27 class ParallelMoveResolver : public ValueObject { | 26 class ParallelMoveResolver : public ValueObject { |
28 public: | 27 public: |
29 explicit ParallelMoveResolver(FlowGraphCompiler* compiler); | 28 explicit ParallelMoveResolver(FlowGraphCompiler* compiler); |
30 | 29 |
31 // Resolve a set of parallel moves, emitting assembler instructions. | 30 // Resolve a set of parallel moves, emitting assembler instructions. |
32 void EmitNativeCode(ParallelMoveInstr* parallel_move); | 31 void EmitNativeCode(ParallelMoveInstr* parallel_move); |
33 | 32 |
34 private: | 33 private: |
35 class ScratchFpuRegisterScope : public ValueObject { | 34 class ScratchFpuRegisterScope : public ValueObject { |
36 public: | 35 public: |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 CompilerDeoptInfo* AddDeoptIndexAtCall(intptr_t deopt_id); | 518 CompilerDeoptInfo* AddDeoptIndexAtCall(intptr_t deopt_id); |
520 | 519 |
521 void AddSlowPathCode(SlowPathCode* slow_path); | 520 void AddSlowPathCode(SlowPathCode* slow_path); |
522 | 521 |
523 void FinalizeExceptionHandlers(const Code& code); | 522 void FinalizeExceptionHandlers(const Code& code); |
524 void FinalizePcDescriptors(const Code& code); | 523 void FinalizePcDescriptors(const Code& code); |
525 RawArray* CreateDeoptInfo(Assembler* assembler); | 524 RawArray* CreateDeoptInfo(Assembler* assembler); |
526 void FinalizeStackMaps(const Code& code); | 525 void FinalizeStackMaps(const Code& code); |
527 void FinalizeVarDescriptors(const Code& code); | 526 void FinalizeVarDescriptors(const Code& code); |
528 void FinalizeStaticCallTargetsTable(const Code& code); | 527 void FinalizeStaticCallTargetsTable(const Code& code); |
| 528 void FinalizeCodeSourceMap(const Code& code); |
529 | 529 |
530 const Class& double_class() const { return double_class_; } | 530 const Class& double_class() const { return double_class_; } |
531 const Class& mint_class() const { return mint_class_; } | 531 const Class& mint_class() const { return mint_class_; } |
532 const Class& float32x4_class() const { return float32x4_class_; } | 532 const Class& float32x4_class() const { return float32x4_class_; } |
533 const Class& float64x2_class() const { return float64x2_class_; } | 533 const Class& float64x2_class() const { return float64x2_class_; } |
534 const Class& int32x4_class() const { return int32x4_class_; } | 534 const Class& int32x4_class() const { return int32x4_class_; } |
535 | 535 |
536 const Class& BoxClassFor(Representation rep); | 536 const Class& BoxClassFor(Representation rep); |
537 | 537 |
538 void SaveLiveRegisters(LocationSummary* locs); | 538 void SaveLiveRegisters(LocationSummary* locs); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 const ZoneGrowableArray<const ICData*>& deopt_id_to_ic_data() const { | 571 const ZoneGrowableArray<const ICData*>& deopt_id_to_ic_data() const { |
572 return *deopt_id_to_ic_data_; | 572 return *deopt_id_to_ic_data_; |
573 } | 573 } |
574 | 574 |
575 Thread* thread() const { return thread_; } | 575 Thread* thread() const { return thread_; } |
576 Isolate* isolate() const { return thread_->isolate(); } | 576 Isolate* isolate() const { return thread_->isolate(); } |
577 Zone* zone() const { return zone_; } | 577 Zone* zone() const { return zone_; } |
578 | 578 |
579 void AddStubCallTarget(const Code& code); | 579 void AddStubCallTarget(const Code& code); |
580 | 580 |
581 const Array& inlined_code_intervals() const { | |
582 return inlined_code_intervals_; | |
583 } | |
584 | |
585 RawArray* edge_counters_array() const { return edge_counters_array_.raw(); } | 581 RawArray* edge_counters_array() const { return edge_counters_array_.raw(); } |
586 | 582 |
587 RawArray* InliningIdToFunction() const; | 583 RawArray* InliningIdToFunction() const; |
588 RawArray* InliningIdToTokenPos() const; | |
589 RawArray* CallerInliningIdMap() const; | |
590 | |
591 CodeSourceMapBuilder* code_source_map_builder() { | |
592 if (code_source_map_builder_ == NULL) { | |
593 code_source_map_builder_ = new CodeSourceMapBuilder(); | |
594 } | |
595 ASSERT(code_source_map_builder_ != NULL); | |
596 return code_source_map_builder_; | |
597 } | |
598 | 584 |
599 void BeginCodeSourceRange(); | 585 void BeginCodeSourceRange(); |
600 bool EndCodeSourceRange(TokenPosition token_pos); | 586 void EndCodeSourceRange(TokenPosition token_pos); |
601 | 587 |
602 #if defined(TARGET_ARCH_DBC) | 588 #if defined(TARGET_ARCH_DBC) |
603 enum CallResult { | 589 enum CallResult { |
604 kHasResult, | 590 kHasResult, |
605 kNoResult, | 591 kNoResult, |
606 }; | 592 }; |
607 void RecordAfterCallHelper(TokenPosition token_pos, | 593 void RecordAfterCallHelper(TokenPosition token_pos, |
608 intptr_t deopt_id, | 594 intptr_t deopt_id, |
609 intptr_t argument_count, | 595 intptr_t argument_count, |
610 CallResult result, | 596 CallResult result, |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 #endif | 755 #endif |
770 | 756 |
771 // Compiler specific per-block state. Indexed by postorder block number | 757 // Compiler specific per-block state. Indexed by postorder block number |
772 // for convenience. This is not the block's index in the block order, | 758 // for convenience. This is not the block's index in the block order, |
773 // which is reverse postorder. | 759 // which is reverse postorder. |
774 BlockEntryInstr* current_block_; | 760 BlockEntryInstr* current_block_; |
775 ExceptionHandlerList* exception_handlers_list_; | 761 ExceptionHandlerList* exception_handlers_list_; |
776 DescriptorList* pc_descriptors_list_; | 762 DescriptorList* pc_descriptors_list_; |
777 StackMapTableBuilder* stackmap_table_builder_; | 763 StackMapTableBuilder* stackmap_table_builder_; |
778 CodeSourceMapBuilder* code_source_map_builder_; | 764 CodeSourceMapBuilder* code_source_map_builder_; |
779 intptr_t saved_code_size_; | |
780 GrowableArray<BlockInfo*> block_info_; | 765 GrowableArray<BlockInfo*> block_info_; |
781 GrowableArray<CompilerDeoptInfo*> deopt_infos_; | 766 GrowableArray<CompilerDeoptInfo*> deopt_infos_; |
782 GrowableArray<SlowPathCode*> slow_path_code_; | 767 GrowableArray<SlowPathCode*> slow_path_code_; |
783 // Stores static call targets as well as stub targets. | 768 // Stores static call targets as well as stub targets. |
784 // TODO(srdjan): Evaluate if we should store allocation stub targets into a | 769 // TODO(srdjan): Evaluate if we should store allocation stub targets into a |
785 // separate table? | 770 // separate table? |
786 GrowableArray<StaticCallsStruct*> static_calls_target_table_; | 771 GrowableArray<StaticCallsStruct*> static_calls_target_table_; |
787 const bool is_optimizing_; | 772 const bool is_optimizing_; |
788 // Set to true if optimized code has IC calls. | 773 // Set to true if optimized code has IC calls. |
789 bool may_reoptimize_; | 774 bool may_reoptimize_; |
(...skipping 13 matching lines...) Expand all Loading... |
803 // Currently instructions generate deopt stubs internally by | 788 // Currently instructions generate deopt stubs internally by |
804 // calling AddDeoptStub. To communicate deoptimization environment | 789 // calling AddDeoptStub. To communicate deoptimization environment |
805 // that should be used when deoptimizing we store it in this variable. | 790 // that should be used when deoptimizing we store it in this variable. |
806 // In future AddDeoptStub should be moved out of the instruction template. | 791 // In future AddDeoptStub should be moved out of the instruction template. |
807 Environment* pending_deoptimization_env_; | 792 Environment* pending_deoptimization_env_; |
808 | 793 |
809 ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data_; | 794 ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data_; |
810 | 795 |
811 Array& edge_counters_array_; | 796 Array& edge_counters_array_; |
812 | 797 |
813 Array& inlined_code_intervals_; | |
814 const GrowableArray<const Function*>& inline_id_to_function_; | |
815 const GrowableArray<TokenPosition>& inline_id_to_token_pos_; | |
816 const GrowableArray<intptr_t>& caller_inline_id_; | |
817 | |
818 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 798 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); |
819 }; | 799 }; |
820 | 800 |
821 } // namespace dart | 801 } // namespace dart |
822 | 802 |
823 #endif // RUNTIME_VM_FLOW_GRAPH_COMPILER_H_ | 803 #endif // RUNTIME_VM_FLOW_GRAPH_COMPILER_H_ |
OLD | NEW |