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

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

Issue 11975061: Removed loop depth info tracking at graph build time. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 months 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 }; 649 };
650 650
651 651
652 // Basic block entries are administrative nodes. There is a distinguished 652 // Basic block entries are administrative nodes. There is a distinguished
653 // graph entry with no predecessor. Joins are the only nodes with multiple 653 // graph entry with no predecessor. Joins are the only nodes with multiple
654 // predecessors. Targets are all other basic block entries. The types 654 // predecessors. Targets are all other basic block entries. The types
655 // enforce edge-split form---joins are forbidden as the successors of 655 // enforce edge-split form---joins are forbidden as the successors of
656 // branches. 656 // branches.
657 class BlockEntryInstr : public Instruction { 657 class BlockEntryInstr : public Instruction {
658 public: 658 public:
659 static const intptr_t kInvalidLoopDepth = -1;
660
661 virtual BlockEntryInstr* AsBlockEntry() { return this; } 659 virtual BlockEntryInstr* AsBlockEntry() { return this; }
662 660
663 virtual intptr_t PredecessorCount() const = 0; 661 virtual intptr_t PredecessorCount() const = 0;
664 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const = 0; 662 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const = 0;
665 virtual void PrepareEntry(FlowGraphCompiler* compiler) = 0; 663 virtual void PrepareEntry(FlowGraphCompiler* compiler) = 0;
666 664
667 intptr_t preorder_number() const { return preorder_number_; } 665 intptr_t preorder_number() const { return preorder_number_; }
668 void set_preorder_number(intptr_t number) { preorder_number_ = number; } 666 void set_preorder_number(intptr_t number) { preorder_number_ = number; }
669 667
670 intptr_t postorder_number() const { return postorder_number_; } 668 intptr_t postorder_number() const { return postorder_number_; }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 742
745 virtual bool HasSideEffect() const { return false; } 743 virtual bool HasSideEffect() const { return false; }
746 744
747 intptr_t try_index() const { return try_index_; } 745 intptr_t try_index() const { return try_index_; }
748 746
749 BitVector* loop_info() const { return loop_info_; } 747 BitVector* loop_info() const { return loop_info_; }
750 void set_loop_info(BitVector* loop_info) { 748 void set_loop_info(BitVector* loop_info) {
751 loop_info_ = loop_info; 749 loop_info_ = loop_info;
752 } 750 }
753 751
754 intptr_t loop_depth() const { return loop_depth_; }
755 void set_loop_depth(intptr_t loop_depth) {
756 ASSERT(loop_depth_ == kInvalidLoopDepth);
757 ASSERT(loop_depth != kInvalidLoopDepth);
758 loop_depth_ = loop_depth;
759 }
760
761 virtual BlockEntryInstr* GetBlock() const { 752 virtual BlockEntryInstr* GetBlock() const {
762 return const_cast<BlockEntryInstr*>(this); 753 return const_cast<BlockEntryInstr*>(this);
763 } 754 }
764 755
765 protected: 756 protected:
766 BlockEntryInstr(intptr_t block_id, intptr_t try_index, intptr_t loop_depth) 757 BlockEntryInstr(intptr_t block_id, intptr_t try_index)
767 : block_id_(block_id), 758 : block_id_(block_id),
768 try_index_(try_index), 759 try_index_(try_index),
769 preorder_number_(-1), 760 preorder_number_(-1),
770 postorder_number_(-1), 761 postorder_number_(-1),
771 dominator_(NULL), 762 dominator_(NULL),
772 dominated_blocks_(1), 763 dominated_blocks_(1),
773 last_instruction_(NULL), 764 last_instruction_(NULL),
774 parallel_move_(NULL), 765 parallel_move_(NULL),
775 loop_info_(NULL), 766 loop_info_(NULL) { }
776 loop_depth_(loop_depth) { }
777 767
778 private: 768 private:
779 virtual void ClearPredecessors() = 0; 769 virtual void ClearPredecessors() = 0;
780 virtual void AddPredecessor(BlockEntryInstr* predecessor) = 0; 770 virtual void AddPredecessor(BlockEntryInstr* predecessor) = 0;
781 771
782 const intptr_t block_id_; 772 const intptr_t block_id_;
783 const intptr_t try_index_; 773 const intptr_t try_index_;
784 intptr_t preorder_number_; 774 intptr_t preorder_number_;
785 intptr_t postorder_number_; 775 intptr_t postorder_number_;
786 // Starting and ending lifetime positions for this block. Used by 776 // Starting and ending lifetime positions for this block. Used by
787 // the linear scan register allocator. 777 // the linear scan register allocator.
788 intptr_t start_pos_; 778 intptr_t start_pos_;
789 intptr_t end_pos_; 779 intptr_t end_pos_;
790 BlockEntryInstr* dominator_; // Immediate dominator, NULL for graph entry. 780 BlockEntryInstr* dominator_; // Immediate dominator, NULL for graph entry.
791 // TODO(fschneider): Optimize the case of one child to save space. 781 // TODO(fschneider): Optimize the case of one child to save space.
792 GrowableArray<BlockEntryInstr*> dominated_blocks_; 782 GrowableArray<BlockEntryInstr*> dominated_blocks_;
793 Instruction* last_instruction_; 783 Instruction* last_instruction_;
794 784
795 // Parallel move that will be used by linear scan register allocator to 785 // Parallel move that will be used by linear scan register allocator to
796 // connect live ranges at the start of the block. 786 // connect live ranges at the start of the block.
797 ParallelMoveInstr* parallel_move_; 787 ParallelMoveInstr* parallel_move_;
798 788
799 // Bit vector containg loop blocks for a loop header indexed by block 789 // Bit vector containg loop blocks for a loop header indexed by block
800 // preorder number. 790 // preorder number.
801 BitVector* loop_info_; 791 BitVector* loop_info_;
802 792
803 // Syntactic loop depth of the block.
804 intptr_t loop_depth_;
805
806 DISALLOW_COPY_AND_ASSIGN(BlockEntryInstr); 793 DISALLOW_COPY_AND_ASSIGN(BlockEntryInstr);
807 }; 794 };
808 795
809 796
810 class ForwardInstructionIterator : public ValueObject { 797 class ForwardInstructionIterator : public ValueObject {
811 public: 798 public:
812 explicit ForwardInstructionIterator(BlockEntryInstr* block_entry) 799 explicit ForwardInstructionIterator(BlockEntryInstr* block_entry)
813 : block_entry_(block_entry), current_(block_entry) { 800 : block_entry_(block_entry), current_(block_entry) {
814 Advance(); 801 Advance();
815 } 802 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 GrowableArray<TargetEntryInstr*> catch_entries_; 886 GrowableArray<TargetEntryInstr*> catch_entries_;
900 GrowableArray<Definition*> initial_definitions_; 887 GrowableArray<Definition*> initial_definitions_;
901 intptr_t spill_slot_count_; 888 intptr_t spill_slot_count_;
902 889
903 DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr); 890 DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr);
904 }; 891 };
905 892
906 893
907 class JoinEntryInstr : public BlockEntryInstr { 894 class JoinEntryInstr : public BlockEntryInstr {
908 public: 895 public:
909 JoinEntryInstr(intptr_t block_id, intptr_t try_index, intptr_t loop_depth) 896 JoinEntryInstr(intptr_t block_id, intptr_t try_index)
910 : BlockEntryInstr(block_id, try_index, loop_depth), 897 : BlockEntryInstr(block_id, try_index),
911 predecessors_(2), // Two is the assumed to be the common case. 898 predecessors_(2), // Two is the assumed to be the common case.
912 phis_(NULL), 899 phis_(NULL),
913 phi_count_(0) { } 900 phi_count_(0) { }
914 901
915 DECLARE_INSTRUCTION(JoinEntry) 902 DECLARE_INSTRUCTION(JoinEntry)
916 903
917 virtual intptr_t PredecessorCount() const { return predecessors_.length(); } 904 virtual intptr_t PredecessorCount() const { return predecessors_.length(); }
918 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { 905 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const {
919 return predecessors_[index]; 906 return predecessors_[index];
920 } 907 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 } 958 }
972 959
973 private: 960 private:
974 ZoneGrowableArray<PhiInstr*>* phis_; 961 ZoneGrowableArray<PhiInstr*>* phis_;
975 intptr_t index_; 962 intptr_t index_;
976 }; 963 };
977 964
978 965
979 class TargetEntryInstr : public BlockEntryInstr { 966 class TargetEntryInstr : public BlockEntryInstr {
980 public: 967 public:
981 TargetEntryInstr(intptr_t block_id, intptr_t try_index, intptr_t loop_depth) 968 TargetEntryInstr(intptr_t block_id, intptr_t try_index)
982 : BlockEntryInstr(block_id, try_index, loop_depth), 969 : BlockEntryInstr(block_id, try_index),
983 predecessor_(NULL), 970 predecessor_(NULL),
984 catch_try_index_(CatchClauseNode::kInvalidTryIndex), 971 catch_try_index_(CatchClauseNode::kInvalidTryIndex),
985 catch_handler_types_(Array::ZoneHandle()) { } 972 catch_handler_types_(Array::ZoneHandle()) { }
986 973
987 DECLARE_INSTRUCTION(TargetEntry) 974 DECLARE_INSTRUCTION(TargetEntry)
988 975
989 virtual intptr_t PredecessorCount() const { 976 virtual intptr_t PredecessorCount() const {
990 return (predecessor_ == NULL) ? 0 : 1; 977 return (predecessor_ == NULL) ? 0 : 1;
991 } 978 }
992 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { 979 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const {
(...skipping 3465 matching lines...) Expand 10 before | Expand all | Expand 10 after
4458 ForwardInstructionIterator* current_iterator_; 4445 ForwardInstructionIterator* current_iterator_;
4459 4446
4460 private: 4447 private:
4461 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 4448 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
4462 }; 4449 };
4463 4450
4464 4451
4465 } // namespace dart 4452 } // namespace dart
4466 4453
4467 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 4454 #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