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

Side by Side Diff: src/compiler/instruction.h

Issue 652643002: [turbofan] remove graph from InstructionSequence (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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 | « src/compiler/code-generator.h ('k') | src/compiler/instruction.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_COMPILER_INSTRUCTION_H_ 5 #ifndef V8_COMPILER_INSTRUCTION_H_
6 #define V8_COMPILER_INSTRUCTION_H_ 6 #define V8_COMPILER_INSTRUCTION_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <iosfwd> 9 #include <iosfwd>
10 #include <map> 10 #include <map>
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 // Represents architecture-specific generated code before, during, and after 760 // Represents architecture-specific generated code before, during, and after
761 // register allocation. 761 // register allocation.
762 // TODO(titzer): s/IsDouble/IsFloat64/ 762 // TODO(titzer): s/IsDouble/IsFloat64/
763 class InstructionSequence FINAL { 763 class InstructionSequence FINAL {
764 public: 764 public:
765 InstructionSequence(Linkage* linkage, Graph* graph, Schedule* schedule); 765 InstructionSequence(Linkage* linkage, Graph* graph, Schedule* schedule);
766 766
767 int NextVirtualRegister() { return next_virtual_register_++; } 767 int NextVirtualRegister() { return next_virtual_register_++; }
768 int VirtualRegisterCount() const { return next_virtual_register_; } 768 int VirtualRegisterCount() const { return next_virtual_register_; }
769 769
770 int ValueCount() const { return graph_->NodeCount(); } 770 int node_count() const { return node_count_; }
771 771
772 int BasicBlockCount() const { 772 int BasicBlockCount() const {
773 return static_cast<int>(schedule_->rpo_order()->size()); 773 return static_cast<int>(schedule_->rpo_order()->size());
774 } 774 }
775 775
776 BasicBlock* BlockAt(int rpo_number) const { 776 BasicBlock* BlockAt(int rpo_number) const {
777 return (*schedule_->rpo_order())[rpo_number]; 777 return (*schedule_->rpo_order())[rpo_number];
778 } 778 }
779 779
780 BasicBlock* GetContainingLoop(BasicBlock* block) { 780 BasicBlock* GetContainingLoop(BasicBlock* block) {
(...skipping 27 matching lines...) Expand all
808 return GapInstruction::cast(InstructionAt(index)); 808 return GapInstruction::cast(InstructionAt(index));
809 } 809 }
810 bool IsGapAt(int index) const { return InstructionAt(index)->IsGapMoves(); } 810 bool IsGapAt(int index) const { return InstructionAt(index)->IsGapMoves(); }
811 Instruction* InstructionAt(int index) const { 811 Instruction* InstructionAt(int index) const {
812 DCHECK(index >= 0); 812 DCHECK(index >= 0);
813 DCHECK(index < static_cast<int>(instructions_.size())); 813 DCHECK(index < static_cast<int>(instructions_.size()));
814 return instructions_[index]; 814 return instructions_[index];
815 } 815 }
816 816
817 Frame* frame() { return &frame_; } 817 Frame* frame() { return &frame_; }
818 Graph* graph() const { return graph_; }
819 Isolate* isolate() const { return zone()->isolate(); } 818 Isolate* isolate() const { return zone()->isolate(); }
820 Linkage* linkage() const { return linkage_; } 819 Linkage* linkage() const { return linkage_; }
821 Schedule* schedule() const { return schedule_; } 820 Schedule* schedule() const { return schedule_; }
822 const PointerMapDeque* pointer_maps() const { return &pointer_maps_; } 821 const PointerMapDeque* pointer_maps() const { return &pointer_maps_; }
823 Zone* zone() const { return graph_->zone(); } 822 Zone* zone() const { return zone_; }
824 823
825 // Used by the code generator while adding instructions. 824 // Used by the code generator while adding instructions.
826 int AddInstruction(Instruction* instr, BasicBlock* block); 825 int AddInstruction(Instruction* instr, BasicBlock* block);
827 void StartBlock(BasicBlock* block); 826 void StartBlock(BasicBlock* block);
828 void EndBlock(BasicBlock* block); 827 void EndBlock(BasicBlock* block);
829 828
830 int AddConstant(Node* node, Constant constant) { 829 int AddConstant(Node* node, Constant constant) {
831 int virtual_register = GetVirtualRegister(node); 830 int virtual_register = GetVirtualRegister(node);
832 DCHECK(constants_.find(virtual_register) == constants_.end()); 831 DCHECK(constants_.find(virtual_register) == constants_.end());
833 constants_.insert(std::make_pair(virtual_register, constant)); 832 constants_.insert(std::make_pair(virtual_register, constant));
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 StateId AddFrameStateDescriptor(FrameStateDescriptor* descriptor); 866 StateId AddFrameStateDescriptor(FrameStateDescriptor* descriptor);
868 FrameStateDescriptor* GetFrameStateDescriptor(StateId deoptimization_id); 867 FrameStateDescriptor* GetFrameStateDescriptor(StateId deoptimization_id);
869 int GetFrameStateDescriptorCount(); 868 int GetFrameStateDescriptorCount();
870 869
871 private: 870 private:
872 friend std::ostream& operator<<(std::ostream& os, 871 friend std::ostream& operator<<(std::ostream& os,
873 const InstructionSequence& code); 872 const InstructionSequence& code);
874 873
875 typedef std::set<int, std::less<int>, ZoneIntAllocator> VirtualRegisterSet; 874 typedef std::set<int, std::less<int>, ZoneIntAllocator> VirtualRegisterSet;
876 875
877 Graph* graph_; 876 Zone* zone_;
877 int node_count_;
878 int* node_map_; 878 int* node_map_;
879 Linkage* linkage_; 879 Linkage* linkage_;
880 Schedule* schedule_; 880 Schedule* schedule_;
881 ConstantMap constants_; 881 ConstantMap constants_;
882 ConstantDeque immediates_; 882 ConstantDeque immediates_;
883 InstructionDeque instructions_; 883 InstructionDeque instructions_;
884 int next_virtual_register_; 884 int next_virtual_register_;
885 PointerMapDeque pointer_maps_; 885 PointerMapDeque pointer_maps_;
886 VirtualRegisterSet doubles_; 886 VirtualRegisterSet doubles_;
887 VirtualRegisterSet references_; 887 VirtualRegisterSet references_;
888 Frame frame_; 888 Frame frame_;
889 DeoptimizationVector deoptimization_entries_; 889 DeoptimizationVector deoptimization_entries_;
890 }; 890 };
891 891
892 std::ostream& operator<<(std::ostream& os, const InstructionSequence& code); 892 std::ostream& operator<<(std::ostream& os, const InstructionSequence& code);
893 893
894 } // namespace compiler 894 } // namespace compiler
895 } // namespace internal 895 } // namespace internal
896 } // namespace v8 896 } // namespace v8
897 897
898 #endif // V8_COMPILER_INSTRUCTION_H_ 898 #endif // V8_COMPILER_INSTRUCTION_H_
OLDNEW
« no previous file with comments | « src/compiler/code-generator.h ('k') | src/compiler/instruction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698