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 |
26 class ParallelMoveResolver : public ValueObject { | 27 class ParallelMoveResolver : public ValueObject { |
27 public: | 28 public: |
28 explicit ParallelMoveResolver(FlowGraphCompiler* compiler); | 29 explicit ParallelMoveResolver(FlowGraphCompiler* compiler); |
29 | 30 |
30 // Resolve a set of parallel moves, emitting assembler instructions. | 31 // Resolve a set of parallel moves, emitting assembler instructions. |
31 void EmitNativeCode(ParallelMoveInstr* parallel_move); | 32 void EmitNativeCode(ParallelMoveInstr* parallel_move); |
32 | 33 |
33 private: | 34 private: |
34 class ScratchFpuRegisterScope : public ValueObject { | 35 class ScratchFpuRegisterScope : public ValueObject { |
35 public: | 36 public: |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 intptr_t deopt_id, | 355 intptr_t deopt_id, |
355 const RuntimeEntry& entry, | 356 const RuntimeEntry& entry, |
356 intptr_t argument_count, | 357 intptr_t argument_count, |
357 LocationSummary* locs); | 358 LocationSummary* locs); |
358 | 359 |
359 void GenerateCall(TokenPosition token_pos, | 360 void GenerateCall(TokenPosition token_pos, |
360 const StubEntry& stub_entry, | 361 const StubEntry& stub_entry, |
361 RawPcDescriptors::Kind kind, | 362 RawPcDescriptors::Kind kind, |
362 LocationSummary* locs); | 363 LocationSummary* locs); |
363 | 364 |
| 365 void GenerateCallWithDeopt(TokenPosition token_pos, |
| 366 intptr_t deopt_id, |
| 367 const StubEntry& stub_entry, |
| 368 RawPcDescriptors::Kind kind, |
| 369 LocationSummary* locs); |
| 370 |
364 void GeneratePatchableCall(TokenPosition token_pos, | 371 void GeneratePatchableCall(TokenPosition token_pos, |
365 const StubEntry& stub_entry, | 372 const StubEntry& stub_entry, |
366 RawPcDescriptors::Kind kind, | 373 RawPcDescriptors::Kind kind, |
367 LocationSummary* locs); | 374 LocationSummary* locs); |
368 | 375 |
369 void GenerateDartCall(intptr_t deopt_id, | 376 void GenerateDartCall(intptr_t deopt_id, |
370 TokenPosition token_pos, | 377 TokenPosition token_pos, |
371 const StubEntry& stub_entry, | 378 const StubEntry& stub_entry, |
372 RawPcDescriptors::Kind kind, | 379 RawPcDescriptors::Kind kind, |
373 LocationSummary* locs); | 380 LocationSummary* locs); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 TokenPosition token_pos); | 467 TokenPosition token_pos); |
461 Condition EmitEqualityRegRegCompare(Register left, | 468 Condition EmitEqualityRegRegCompare(Register left, |
462 Register right, | 469 Register right, |
463 bool needs_number_check, | 470 bool needs_number_check, |
464 TokenPosition token_pos); | 471 TokenPosition token_pos); |
465 | 472 |
466 bool NeedsEdgeCounter(TargetEntryInstr* block); | 473 bool NeedsEdgeCounter(TargetEntryInstr* block); |
467 | 474 |
468 void EmitEdgeCounter(intptr_t edge_id); | 475 void EmitEdgeCounter(intptr_t edge_id); |
469 #endif // !defined(TARGET_ARCH_DBC) | 476 #endif // !defined(TARGET_ARCH_DBC) |
| 477 void EmitCatchEntryState( |
| 478 Environment* env = NULL, |
| 479 intptr_t try_index = CatchClauseNode::kInvalidTryIndex); |
470 | 480 |
471 void EmitTrySync(Instruction* instr, intptr_t try_index); | 481 void EmitCallsiteMetaData(TokenPosition token_pos, |
| 482 intptr_t deopt_id, |
| 483 RawPcDescriptors::Kind kind, |
| 484 LocationSummary* locs); |
472 | 485 |
473 void EmitComment(Instruction* instr); | 486 void EmitComment(Instruction* instr); |
474 | 487 |
475 intptr_t StackSize() const; | 488 intptr_t StackSize() const; |
476 | 489 |
477 // Returns assembler label associated with the given block entry. | 490 // Returns assembler label associated with the given block entry. |
478 Label* GetJumpLabel(BlockEntryInstr* block_entry) const; | 491 Label* GetJumpLabel(BlockEntryInstr* block_entry) const; |
479 bool WasCompacted(BlockEntryInstr* block_entry) const; | 492 bool WasCompacted(BlockEntryInstr* block_entry) const; |
480 | 493 |
481 // Returns the label of the fall-through of the current block. | 494 // Returns the label of the fall-through of the current block. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 | 536 |
524 CompilerDeoptInfo* AddDeoptIndexAtCall(intptr_t deopt_id); | 537 CompilerDeoptInfo* AddDeoptIndexAtCall(intptr_t deopt_id); |
525 | 538 |
526 void AddSlowPathCode(SlowPathCode* slow_path); | 539 void AddSlowPathCode(SlowPathCode* slow_path); |
527 | 540 |
528 void FinalizeExceptionHandlers(const Code& code); | 541 void FinalizeExceptionHandlers(const Code& code); |
529 void FinalizePcDescriptors(const Code& code); | 542 void FinalizePcDescriptors(const Code& code); |
530 RawArray* CreateDeoptInfo(Assembler* assembler); | 543 RawArray* CreateDeoptInfo(Assembler* assembler); |
531 void FinalizeStackMaps(const Code& code); | 544 void FinalizeStackMaps(const Code& code); |
532 void FinalizeVarDescriptors(const Code& code); | 545 void FinalizeVarDescriptors(const Code& code); |
| 546 void FinalizeCatchEntryStateMap(const Code& code); |
533 void FinalizeStaticCallTargetsTable(const Code& code); | 547 void FinalizeStaticCallTargetsTable(const Code& code); |
534 void FinalizeCodeSourceMap(const Code& code); | 548 void FinalizeCodeSourceMap(const Code& code); |
535 | 549 |
536 const Class& double_class() const { return double_class_; } | 550 const Class& double_class() const { return double_class_; } |
537 const Class& mint_class() const { return mint_class_; } | 551 const Class& mint_class() const { return mint_class_; } |
538 const Class& float32x4_class() const { return float32x4_class_; } | 552 const Class& float32x4_class() const { return float32x4_class_; } |
539 const Class& float64x2_class() const { return float64x2_class_; } | 553 const Class& float64x2_class() const { return float64x2_class_; } |
540 const Class& int32x4_class() const { return int32x4_class_; } | 554 const Class& int32x4_class() const { return int32x4_class_; } |
541 | 555 |
542 const Class& BoxClassFor(Representation rep); | 556 const Class& BoxClassFor(Representation rep); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 void RecordAfterCallHelper(TokenPosition token_pos, | 616 void RecordAfterCallHelper(TokenPosition token_pos, |
603 intptr_t deopt_id, | 617 intptr_t deopt_id, |
604 intptr_t argument_count, | 618 intptr_t argument_count, |
605 CallResult result, | 619 CallResult result, |
606 LocationSummary* locs); | 620 LocationSummary* locs); |
607 void RecordAfterCall(Instruction* instr, CallResult result); | 621 void RecordAfterCall(Instruction* instr, CallResult result); |
608 #endif | 622 #endif |
609 | 623 |
610 private: | 624 private: |
611 friend class CheckStackOverflowSlowPath; // For pending_deoptimization_env_. | 625 friend class CheckStackOverflowSlowPath; // For pending_deoptimization_env_. |
| 626 friend class CheckedSmiSlowPath; // Same. |
| 627 friend class CheckedSmiComparisonSlowPath; // Same. |
612 | 628 |
613 static bool ShouldInlineSmiStringHashCode(const ICData& ic_data); | 629 static bool ShouldInlineSmiStringHashCode(const ICData& ic_data); |
614 | 630 |
615 void EmitFrameEntry(); | 631 void EmitFrameEntry(); |
616 | 632 |
617 void AddStaticCallTarget(const Function& function); | 633 void AddStaticCallTarget(const Function& function); |
618 | 634 |
619 void GenerateDeferredCode(); | 635 void GenerateDeferredCode(); |
620 | 636 |
621 void EmitInstructionPrologue(Instruction* instr); | 637 void EmitInstructionPrologue(Instruction* instr); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 #endif | 780 #endif |
765 | 781 |
766 // Compiler specific per-block state. Indexed by postorder block number | 782 // Compiler specific per-block state. Indexed by postorder block number |
767 // for convenience. This is not the block's index in the block order, | 783 // for convenience. This is not the block's index in the block order, |
768 // which is reverse postorder. | 784 // which is reverse postorder. |
769 BlockEntryInstr* current_block_; | 785 BlockEntryInstr* current_block_; |
770 ExceptionHandlerList* exception_handlers_list_; | 786 ExceptionHandlerList* exception_handlers_list_; |
771 DescriptorList* pc_descriptors_list_; | 787 DescriptorList* pc_descriptors_list_; |
772 StackMapTableBuilder* stackmap_table_builder_; | 788 StackMapTableBuilder* stackmap_table_builder_; |
773 CodeSourceMapBuilder* code_source_map_builder_; | 789 CodeSourceMapBuilder* code_source_map_builder_; |
| 790 CatchEntryStateMapBuilder* catch_entry_state_maps_builder_; |
774 GrowableArray<BlockInfo*> block_info_; | 791 GrowableArray<BlockInfo*> block_info_; |
775 GrowableArray<CompilerDeoptInfo*> deopt_infos_; | 792 GrowableArray<CompilerDeoptInfo*> deopt_infos_; |
776 GrowableArray<SlowPathCode*> slow_path_code_; | 793 GrowableArray<SlowPathCode*> slow_path_code_; |
777 // Stores static call targets as well as stub targets. | 794 // Stores static call targets as well as stub targets. |
778 // TODO(srdjan): Evaluate if we should store allocation stub targets into a | 795 // TODO(srdjan): Evaluate if we should store allocation stub targets into a |
779 // separate table? | 796 // separate table? |
780 GrowableArray<StaticCallsStruct*> static_calls_target_table_; | 797 GrowableArray<StaticCallsStruct*> static_calls_target_table_; |
781 const bool is_optimizing_; | 798 const bool is_optimizing_; |
782 // Set to true if optimized code has IC calls. | 799 // Set to true if optimized code has IC calls. |
783 bool may_reoptimize_; | 800 bool may_reoptimize_; |
(...skipping 19 matching lines...) Expand all Loading... |
803 ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data_; | 820 ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data_; |
804 | 821 |
805 Array& edge_counters_array_; | 822 Array& edge_counters_array_; |
806 | 823 |
807 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 824 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); |
808 }; | 825 }; |
809 | 826 |
810 } // namespace dart | 827 } // namespace dart |
811 | 828 |
812 #endif // RUNTIME_VM_FLOW_GRAPH_COMPILER_H_ | 829 #endif // RUNTIME_VM_FLOW_GRAPH_COMPILER_H_ |
OLD | NEW |