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

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

Issue 505133003: Introduce subclass wrappers for STL containers that make them a lot easier (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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/graph-reducer.cc ('k') | src/compiler/instruction-selector.h » ('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 <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // Calls SetUpCache()/TearDownCache() for each subclass. 82 // Calls SetUpCache()/TearDownCache() for each subclass.
83 static void SetUpCaches(); 83 static void SetUpCaches();
84 static void TearDownCaches(); 84 static void TearDownCaches();
85 85
86 protected: 86 protected:
87 typedef BitField<Kind, 0, 3> KindField; 87 typedef BitField<Kind, 0, 3> KindField;
88 88
89 unsigned value_; 89 unsigned value_;
90 }; 90 };
91 91
92 typedef std::vector<InstructionOperand*, zone_allocator<InstructionOperand*> > 92 typedef ZoneVector<InstructionOperand*> InstructionOperandVector;
93 InstructionOperandVector;
94 93
95 OStream& operator<<(OStream& os, const InstructionOperand& op); 94 OStream& operator<<(OStream& os, const InstructionOperand& op);
96 95
97 class UnallocatedOperand : public InstructionOperand { 96 class UnallocatedOperand : public InstructionOperand {
98 public: 97 public:
99 enum BasicPolicy { FIXED_SLOT, EXTENDED_POLICY }; 98 enum BasicPolicy { FIXED_SLOT, EXTENDED_POLICY };
100 99
101 enum ExtendedPolicy { 100 enum ExtendedPolicy {
102 NONE, 101 NONE,
103 ANY, 102 ANY,
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 717
719 private: 718 private:
720 BailoutId bailout_id_; 719 BailoutId bailout_id_;
721 int parameters_count_; 720 int parameters_count_;
722 int locals_count_; 721 int locals_count_;
723 int stack_count_; 722 int stack_count_;
724 }; 723 };
725 724
726 OStream& operator<<(OStream& os, const Constant& constant); 725 OStream& operator<<(OStream& os, const Constant& constant);
727 726
728 typedef std::deque<Constant, zone_allocator<Constant> > ConstantDeque; 727 typedef ZoneDeque<Constant> ConstantDeque;
729 typedef std::map<int, Constant, std::less<int>, 728 typedef std::map<int, Constant, std::less<int>,
730 zone_allocator<std::pair<int, Constant> > > ConstantMap; 729 zone_allocator<std::pair<int, Constant> > > ConstantMap;
731 730
732 731 typedef ZoneDeque<Instruction*> InstructionDeque;
733 typedef std::deque<Instruction*, zone_allocator<Instruction*> > 732 typedef ZoneDeque<PointerMap*> PointerMapDeque;
734 InstructionDeque; 733 typedef ZoneVector<FrameStateDescriptor*> DeoptimizationVector;
735 typedef std::deque<PointerMap*, zone_allocator<PointerMap*> > PointerMapDeque;
736 typedef std::vector<FrameStateDescriptor*,
737 zone_allocator<FrameStateDescriptor*> >
738 DeoptimizationVector;
739
740 734
741 // Represents architecture-specific generated code before, during, and after 735 // Represents architecture-specific generated code before, during, and after
742 // register allocation. 736 // register allocation.
743 // TODO(titzer): s/IsDouble/IsFloat64/ 737 // TODO(titzer): s/IsDouble/IsFloat64/
744 class InstructionSequence V8_FINAL { 738 class InstructionSequence V8_FINAL {
745 public: 739 public:
746 InstructionSequence(Linkage* linkage, Graph* graph, Schedule* schedule) 740 InstructionSequence(Linkage* linkage, Graph* graph, Schedule* schedule)
747 : graph_(graph), 741 : graph_(graph),
748 linkage_(linkage), 742 linkage_(linkage),
749 schedule_(schedule), 743 schedule_(schedule),
750 constants_(ConstantMap::key_compare(), 744 constants_(ConstantMap::key_compare(),
751 ConstantMap::allocator_type(zone())), 745 ConstantMap::allocator_type(zone())),
752 immediates_(ConstantDeque::allocator_type(zone())), 746 immediates_(zone()),
753 instructions_(InstructionDeque::allocator_type(zone())), 747 instructions_(zone()),
754 next_virtual_register_(graph->NodeCount()), 748 next_virtual_register_(graph->NodeCount()),
755 pointer_maps_(PointerMapDeque::allocator_type(zone())), 749 pointer_maps_(zone()),
756 doubles_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())), 750 doubles_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())),
757 references_(std::less<int>(), 751 references_(std::less<int>(),
758 VirtualRegisterSet::allocator_type(zone())), 752 VirtualRegisterSet::allocator_type(zone())),
759 deoptimization_entries_(DeoptimizationVector::allocator_type(zone())) {} 753 deoptimization_entries_(zone()) {}
760 754
761 int NextVirtualRegister() { return next_virtual_register_++; } 755 int NextVirtualRegister() { return next_virtual_register_++; }
762 int VirtualRegisterCount() const { return next_virtual_register_; } 756 int VirtualRegisterCount() const { return next_virtual_register_; }
763 757
764 int ValueCount() const { return graph_->NodeCount(); } 758 int ValueCount() const { return graph_->NodeCount(); }
765 759
766 int BasicBlockCount() const { 760 int BasicBlockCount() const {
767 return static_cast<int>(schedule_->rpo_order()->size()); 761 return static_cast<int>(schedule_->rpo_order()->size());
768 } 762 }
769 763
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 DeoptimizationVector deoptimization_entries_; 861 DeoptimizationVector deoptimization_entries_;
868 }; 862 };
869 863
870 OStream& operator<<(OStream& os, const InstructionSequence& code); 864 OStream& operator<<(OStream& os, const InstructionSequence& code);
871 865
872 } // namespace compiler 866 } // namespace compiler
873 } // namespace internal 867 } // namespace internal
874 } // namespace v8 868 } // namespace v8
875 869
876 #endif // V8_COMPILER_INSTRUCTION_H_ 870 #endif // V8_COMPILER_INSTRUCTION_H_
OLDNEW
« no previous file with comments | « src/compiler/graph-reducer.cc ('k') | src/compiler/instruction-selector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698