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

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

Issue 11953076: Move code around in preparation for better inlining. (Closed) Base URL: https://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
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 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 747
748 BitVector* loop_info() const { return loop_info_; } 748 BitVector* loop_info() const { return loop_info_; }
749 void set_loop_info(BitVector* loop_info) { 749 void set_loop_info(BitVector* loop_info) {
750 loop_info_ = loop_info; 750 loop_info_ = loop_info;
751 } 751 }
752 752
753 virtual BlockEntryInstr* GetBlock() const { 753 virtual BlockEntryInstr* GetBlock() const {
754 return const_cast<BlockEntryInstr*>(this); 754 return const_cast<BlockEntryInstr*>(this);
755 } 755 }
756 756
757 // Helper to mutate the graph during inlining. This block should be
758 // replaced with new_block as a predecessor of all of this block's
759 // successors.
760 void ReplaceAsPredecessorWith(BlockEntryInstr* new_block);
761
757 protected: 762 protected:
758 BlockEntryInstr(intptr_t block_id, intptr_t try_index) 763 BlockEntryInstr(intptr_t block_id, intptr_t try_index)
759 : block_id_(block_id), 764 : block_id_(block_id),
760 try_index_(try_index), 765 try_index_(try_index),
761 preorder_number_(-1), 766 preorder_number_(-1),
762 postorder_number_(-1), 767 postorder_number_(-1),
763 dominator_(NULL), 768 dominator_(NULL),
764 dominated_blocks_(1), 769 dominated_blocks_(1),
765 last_instruction_(NULL), 770 last_instruction_(NULL),
766 parallel_move_(NULL), 771 parallel_move_(NULL),
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 void InsertPhi(intptr_t var_index, intptr_t var_count); 922 void InsertPhi(intptr_t var_index, intptr_t var_count);
918 void RemoveDeadPhis(); 923 void RemoveDeadPhis();
919 924
920 void InsertPhi(PhiInstr* phi); 925 void InsertPhi(PhiInstr* phi);
921 926
922 intptr_t phi_count() const { return phi_count_; } 927 intptr_t phi_count() const { return phi_count_; }
923 928
924 virtual void PrintTo(BufferFormatter* f) const; 929 virtual void PrintTo(BufferFormatter* f) const;
925 930
926 private: 931 private:
927 friend class FlowGraph; // Access to predecessors_ when inlining. 932 // Classes that have access to predecessors_ when inlining.
933 friend class BlockEntryInstr;
934 friend class ValueInliningContext;
935
928 virtual void ClearPredecessors() { predecessors_.Clear(); } 936 virtual void ClearPredecessors() { predecessors_.Clear(); }
929 virtual void AddPredecessor(BlockEntryInstr* predecessor); 937 virtual void AddPredecessor(BlockEntryInstr* predecessor);
930 938
931 GrowableArray<BlockEntryInstr*> predecessors_; 939 GrowableArray<BlockEntryInstr*> predecessors_;
932 ZoneGrowableArray<PhiInstr*>* phis_; 940 ZoneGrowableArray<PhiInstr*>* phis_;
933 intptr_t phi_count_; 941 intptr_t phi_count_;
934 942
935 DISALLOW_COPY_AND_ASSIGN(JoinEntryInstr); 943 DISALLOW_COPY_AND_ASSIGN(JoinEntryInstr);
936 }; 944 };
937 945
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 void set_catch_try_index(intptr_t index) { catch_try_index_ = index; } 1004 void set_catch_try_index(intptr_t index) { catch_try_index_ = index; }
997 void set_catch_handler_types(const Array& handler_types) { 1005 void set_catch_handler_types(const Array& handler_types) {
998 catch_handler_types_ = handler_types.raw(); 1006 catch_handler_types_ = handler_types.raw();
999 } 1007 }
1000 1008
1001 virtual void PrepareEntry(FlowGraphCompiler* compiler); 1009 virtual void PrepareEntry(FlowGraphCompiler* compiler);
1002 1010
1003 virtual void PrintTo(BufferFormatter* f) const; 1011 virtual void PrintTo(BufferFormatter* f) const;
1004 1012
1005 private: 1013 private:
1006 friend class FlowGraph; // Access to predecessor_ when inlining. 1014 friend class BlockEntryInstr; // Access to predecessor_ when inlining.
1015
1007 virtual void ClearPredecessors() { predecessor_ = NULL; } 1016 virtual void ClearPredecessors() { predecessor_ = NULL; }
1008 virtual void AddPredecessor(BlockEntryInstr* predecessor) { 1017 virtual void AddPredecessor(BlockEntryInstr* predecessor) {
1009 ASSERT(predecessor_ == NULL); 1018 ASSERT(predecessor_ == NULL);
1010 predecessor_ = predecessor; 1019 predecessor_ = predecessor;
1011 } 1020 }
1012 1021
1013 BlockEntryInstr* predecessor_; 1022 BlockEntryInstr* predecessor_;
1014 intptr_t catch_try_index_; 1023 intptr_t catch_try_index_;
1015 Array& catch_handler_types_; 1024 Array& catch_handler_types_;
1016 1025
(...skipping 3429 matching lines...) Expand 10 before | Expand all | Expand 10 after
4446 ForwardInstructionIterator* current_iterator_; 4455 ForwardInstructionIterator* current_iterator_;
4447 4456
4448 private: 4457 private:
4449 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 4458 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
4450 }; 4459 };
4451 4460
4452 4461
4453 } // namespace dart 4462 } // namespace dart
4454 4463
4455 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 4464 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698