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