Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 11269040: More inlining flags and tuned heuristics. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Improved heuristics. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define VM_INTERMEDIATE_LANGUAGE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/ast.h" 9 #include "vm/ast.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 }; 660 };
661 661
662 662
663 // Basic block entries are administrative nodes. There is a distinguished 663 // Basic block entries are administrative nodes. There is a distinguished
664 // graph entry with no predecessor. Joins are the only nodes with multiple 664 // graph entry with no predecessor. Joins are the only nodes with multiple
665 // predecessors. Targets are all other basic block entries. The types 665 // predecessors. Targets are all other basic block entries. The types
666 // enforce edge-split form---joins are forbidden as the successors of 666 // enforce edge-split form---joins are forbidden as the successors of
667 // branches. 667 // branches.
668 class BlockEntryInstr : public Instruction { 668 class BlockEntryInstr : public Instruction {
669 public: 669 public:
670 static const intptr_t kInvalidLoopDepth = -1;
671
670 virtual BlockEntryInstr* AsBlockEntry() { return this; } 672 virtual BlockEntryInstr* AsBlockEntry() { return this; }
671 673
672 virtual intptr_t PredecessorCount() const = 0; 674 virtual intptr_t PredecessorCount() const = 0;
673 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const = 0; 675 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const = 0;
674 virtual void PrepareEntry(FlowGraphCompiler* compiler) = 0; 676 virtual void PrepareEntry(FlowGraphCompiler* compiler) = 0;
675 677
676 intptr_t preorder_number() const { return preorder_number_; } 678 intptr_t preorder_number() const { return preorder_number_; }
677 void set_preorder_number(intptr_t number) { preorder_number_ = number; } 679 void set_preorder_number(intptr_t number) { preorder_number_ = number; }
678 680
679 intptr_t postorder_number() const { return postorder_number_; } 681 intptr_t postorder_number() const { return postorder_number_; }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 742
741 virtual bool HasSideEffect() const { return false; } 743 virtual bool HasSideEffect() const { return false; }
742 744
743 intptr_t try_index() const { return try_index_; } 745 intptr_t try_index() const { return try_index_; }
744 746
745 BitVector* loop_info() const { return loop_info_; } 747 BitVector* loop_info() const { return loop_info_; }
746 void set_loop_info(BitVector* loop_info) { 748 void set_loop_info(BitVector* loop_info) {
747 loop_info_ = loop_info; 749 loop_info_ = loop_info;
748 } 750 }
749 751
752 intptr_t loop_depth() const { return loop_depth_; }
753 void set_loop_depth(intptr_t loop_depth) {
754 ASSERT(loop_depth_ == kInvalidLoopDepth);
755 ASSERT(loop_depth != kInvalidLoopDepth);
756 loop_depth_ = loop_depth;
757 }
758
750 virtual BlockEntryInstr* GetBlock() const { 759 virtual BlockEntryInstr* GetBlock() const {
751 return const_cast<BlockEntryInstr*>(this); 760 return const_cast<BlockEntryInstr*>(this);
752 } 761 }
753 762
754 protected: 763 protected:
755 BlockEntryInstr(intptr_t block_id, intptr_t try_index) 764 BlockEntryInstr(intptr_t block_id, intptr_t try_index, intptr_t loop_depth)
756 : block_id_(block_id), 765 : block_id_(block_id),
757 try_index_(try_index), 766 try_index_(try_index),
758 preorder_number_(-1), 767 preorder_number_(-1),
759 postorder_number_(-1), 768 postorder_number_(-1),
760 dominator_(NULL), 769 dominator_(NULL),
761 dominated_blocks_(1), 770 dominated_blocks_(1),
762 last_instruction_(NULL), 771 last_instruction_(NULL),
763 parallel_move_(NULL), 772 parallel_move_(NULL),
764 loop_info_(NULL) { } 773 loop_info_(NULL),
774 loop_depth_(loop_depth) { }
765 775
766 private: 776 private:
767 virtual void ClearPredecessors() = 0; 777 virtual void ClearPredecessors() = 0;
768 virtual void AddPredecessor(BlockEntryInstr* predecessor) = 0; 778 virtual void AddPredecessor(BlockEntryInstr* predecessor) = 0;
769 779
770 const intptr_t block_id_; 780 const intptr_t block_id_;
771 const intptr_t try_index_; 781 const intptr_t try_index_;
772 intptr_t preorder_number_; 782 intptr_t preorder_number_;
773 intptr_t postorder_number_; 783 intptr_t postorder_number_;
774 // Starting and ending lifetime positions for this block. Used by 784 // Starting and ending lifetime positions for this block. Used by
775 // the linear scan register allocator. 785 // the linear scan register allocator.
776 intptr_t start_pos_; 786 intptr_t start_pos_;
777 intptr_t end_pos_; 787 intptr_t end_pos_;
778 BlockEntryInstr* dominator_; // Immediate dominator, NULL for graph entry. 788 BlockEntryInstr* dominator_; // Immediate dominator, NULL for graph entry.
779 // TODO(fschneider): Optimize the case of one child to save space. 789 // TODO(fschneider): Optimize the case of one child to save space.
780 GrowableArray<BlockEntryInstr*> dominated_blocks_; 790 GrowableArray<BlockEntryInstr*> dominated_blocks_;
781 Instruction* last_instruction_; 791 Instruction* last_instruction_;
782 792
783 // Parallel move that will be used by linear scan register allocator to 793 // Parallel move that will be used by linear scan register allocator to
784 // connect live ranges at the start of the block. 794 // connect live ranges at the start of the block.
785 ParallelMoveInstr* parallel_move_; 795 ParallelMoveInstr* parallel_move_;
786 796
787 // Bit vector containg loop blocks for a loop header indexed by block 797 // Bit vector containg loop blocks for a loop header indexed by block
788 // preorder number. 798 // preorder number.
789 BitVector* loop_info_; 799 BitVector* loop_info_;
790 800
801 // Syntactic loop depth of the block.
802 intptr_t loop_depth_;
803
791 DISALLOW_COPY_AND_ASSIGN(BlockEntryInstr); 804 DISALLOW_COPY_AND_ASSIGN(BlockEntryInstr);
792 }; 805 };
793 806
794 807
795 class ForwardInstructionIterator : public ValueObject { 808 class ForwardInstructionIterator : public ValueObject {
796 public: 809 public:
797 explicit ForwardInstructionIterator(BlockEntryInstr* block_entry) 810 explicit ForwardInstructionIterator(BlockEntryInstr* block_entry)
798 : block_entry_(block_entry), current_(block_entry) { 811 : block_entry_(block_entry), current_(block_entry) {
799 ASSERT(block_entry_->last_instruction()->next() == NULL); 812 ASSERT(block_entry_->last_instruction()->next() == NULL);
800 Advance(); 813 Advance();
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 GrowableArray<TargetEntryInstr*> catch_entries_; 907 GrowableArray<TargetEntryInstr*> catch_entries_;
895 GrowableArray<Definition*> initial_definitions_; 908 GrowableArray<Definition*> initial_definitions_;
896 intptr_t spill_slot_count_; 909 intptr_t spill_slot_count_;
897 910
898 DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr); 911 DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr);
899 }; 912 };
900 913
901 914
902 class JoinEntryInstr : public BlockEntryInstr { 915 class JoinEntryInstr : public BlockEntryInstr {
903 public: 916 public:
904 JoinEntryInstr(intptr_t block_id, intptr_t try_index) 917 JoinEntryInstr(intptr_t block_id, intptr_t try_index, intptr_t loop_depth)
905 : BlockEntryInstr(block_id, try_index), 918 : BlockEntryInstr(block_id, try_index, loop_depth),
906 predecessors_(2), // Two is the assumed to be the common case. 919 predecessors_(2), // Two is the assumed to be the common case.
907 phis_(NULL), 920 phis_(NULL),
908 phi_count_(0) { } 921 phi_count_(0) { }
909 922
910 DECLARE_INSTRUCTION(JoinEntry) 923 DECLARE_INSTRUCTION(JoinEntry)
911 924
912 virtual intptr_t PredecessorCount() const { return predecessors_.length(); } 925 virtual intptr_t PredecessorCount() const { return predecessors_.length(); }
913 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { 926 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const {
914 return predecessors_[index]; 927 return predecessors_[index];
915 } 928 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 } 977 }
965 978
966 private: 979 private:
967 ZoneGrowableArray<PhiInstr*>* phis_; 980 ZoneGrowableArray<PhiInstr*>* phis_;
968 intptr_t index_; 981 intptr_t index_;
969 }; 982 };
970 983
971 984
972 class TargetEntryInstr : public BlockEntryInstr { 985 class TargetEntryInstr : public BlockEntryInstr {
973 public: 986 public:
974 TargetEntryInstr(intptr_t block_id, intptr_t try_index) 987 TargetEntryInstr(intptr_t block_id, intptr_t try_index, intptr_t loop_depth)
975 : BlockEntryInstr(block_id, try_index), 988 : BlockEntryInstr(block_id, try_index, loop_depth),
976 predecessor_(NULL), 989 predecessor_(NULL),
977 catch_try_index_(CatchClauseNode::kInvalidTryIndex) { } 990 catch_try_index_(CatchClauseNode::kInvalidTryIndex) { }
978 991
979 DECLARE_INSTRUCTION(TargetEntry) 992 DECLARE_INSTRUCTION(TargetEntry)
980 993
981 virtual intptr_t PredecessorCount() const { 994 virtual intptr_t PredecessorCount() const {
982 return (predecessor_ == NULL) ? 0 : 1; 995 return (predecessor_ == NULL) ? 0 : 1;
983 } 996 }
984 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { 997 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const {
985 ASSERT((index == 0) && (predecessor_ != NULL)); 998 ASSERT((index == 0) && (predecessor_ != NULL));
(...skipping 3247 matching lines...) Expand 10 before | Expand all | Expand 10 after
4233 ForwardInstructionIterator* current_iterator_; 4246 ForwardInstructionIterator* current_iterator_;
4234 4247
4235 private: 4248 private:
4236 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 4249 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
4237 }; 4250 };
4238 4251
4239 4252
4240 } // namespace dart 4253 } // namespace dart
4241 4254
4242 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 4255 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698