OLD | NEW |
---|---|
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 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
687 Handle<HeapObject> ToHeapObject() const { | 687 Handle<HeapObject> ToHeapObject() const { |
688 DCHECK_EQ(kHeapObject, type()); | 688 DCHECK_EQ(kHeapObject, type()); |
689 return BitCast<Handle<HeapObject> >(static_cast<intptr_t>(value_)); | 689 return BitCast<Handle<HeapObject> >(static_cast<intptr_t>(value_)); |
690 } | 690 } |
691 | 691 |
692 private: | 692 private: |
693 Type type_; | 693 Type type_; |
694 int64_t value_; | 694 int64_t value_; |
695 }; | 695 }; |
696 | 696 |
697 | |
698 class FrameStateDescriptor : public ZoneObject { | |
699 public: | |
700 FrameStateDescriptor(BailoutId bailout_id, int parameters_count, | |
701 int locals_count, int stack_count) | |
702 : bailout_id_(bailout_id), | |
703 parameters_count_(parameters_count), | |
704 locals_count_(locals_count), | |
705 stack_count_(stack_count) {} | |
706 | |
707 BailoutId bailout_id() const { return bailout_id_; } | |
708 int parameters_count() { return parameters_count_; } | |
709 int locals_count() { return locals_count_; } | |
710 int stack_count() { return stack_count_; } | |
711 | |
712 int size() { return parameters_count_ + locals_count_ + stack_count_; } | |
713 | |
714 private: | |
715 BailoutId bailout_id_; | |
716 int parameters_count_; | |
717 int locals_count_; | |
718 int stack_count_; | |
719 }; | |
720 | |
697 OStream& operator<<(OStream& os, const Constant& constant); | 721 OStream& operator<<(OStream& os, const Constant& constant); |
698 | 722 |
699 typedef std::deque<Constant, zone_allocator<Constant> > ConstantDeque; | 723 typedef std::deque<Constant, zone_allocator<Constant> > ConstantDeque; |
700 typedef std::map<int, Constant, std::less<int>, | 724 typedef std::map<int, Constant, std::less<int>, |
701 zone_allocator<std::pair<int, Constant> > > ConstantMap; | 725 zone_allocator<std::pair<int, Constant> > > ConstantMap; |
702 | 726 |
703 | 727 |
704 typedef std::deque<Instruction*, zone_allocator<Instruction*> > | 728 typedef std::deque<Instruction*, zone_allocator<Instruction*> > |
705 InstructionDeque; | 729 InstructionDeque; |
706 typedef std::deque<PointerMap*, zone_allocator<PointerMap*> > PointerMapDeque; | 730 typedef std::deque<PointerMap*, zone_allocator<PointerMap*> > PointerMapDeque; |
707 typedef std::vector<FrameStateDescriptor, zone_allocator<FrameStateDescriptor> > | 731 typedef std::vector<FrameStateDescriptor*, |
Benedikt Meurer
2014/08/06 09:41:00
Why store pointers? FrameStateDescriptor is small,
Jarin
2014/08/06 10:05:05
Yeah, at the moment it is four ints. However, with
| |
732 zone_allocator<FrameStateDescriptor*> > | |
708 DeoptimizationVector; | 733 DeoptimizationVector; |
709 | 734 |
710 | 735 |
711 // Represents architecture-specific generated code before, during, and after | 736 // Represents architecture-specific generated code before, during, and after |
712 // register allocation. | 737 // register allocation. |
713 // TODO(titzer): s/IsDouble/IsFloat64/ | 738 // TODO(titzer): s/IsDouble/IsFloat64/ |
714 class InstructionSequence V8_FINAL { | 739 class InstructionSequence V8_FINAL { |
715 public: | 740 public: |
716 InstructionSequence(Linkage* linkage, Graph* graph, Schedule* schedule) | 741 InstructionSequence(Linkage* linkage, Graph* graph, Schedule* schedule) |
717 : graph_(graph), | 742 : graph_(graph), |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
807 int index = static_cast<int>(immediates_.size()); | 832 int index = static_cast<int>(immediates_.size()); |
808 immediates_.push_back(constant); | 833 immediates_.push_back(constant); |
809 return index; | 834 return index; |
810 } | 835 } |
811 Constant GetImmediate(int index) const { | 836 Constant GetImmediate(int index) const { |
812 DCHECK(index >= 0); | 837 DCHECK(index >= 0); |
813 DCHECK(index < static_cast<int>(immediates_.size())); | 838 DCHECK(index < static_cast<int>(immediates_.size())); |
814 return immediates_[index]; | 839 return immediates_[index]; |
815 } | 840 } |
816 | 841 |
817 int AddDeoptimizationEntry(const FrameStateDescriptor& descriptor); | 842 int AddDeoptimizationEntry(FrameStateDescriptor* descriptor); |
818 FrameStateDescriptor GetDeoptimizationEntry(int deoptimization_id); | 843 FrameStateDescriptor* GetDeoptimizationEntry(int deoptimization_id); |
819 int GetDeoptimizationEntryCount(); | 844 int GetDeoptimizationEntryCount(); |
820 | 845 |
821 private: | 846 private: |
822 friend OStream& operator<<(OStream& os, const InstructionSequence& code); | 847 friend OStream& operator<<(OStream& os, const InstructionSequence& code); |
823 | 848 |
824 typedef std::set<int, std::less<int>, ZoneIntAllocator> VirtualRegisterSet; | 849 typedef std::set<int, std::less<int>, ZoneIntAllocator> VirtualRegisterSet; |
825 | 850 |
826 Graph* graph_; | 851 Graph* graph_; |
827 Linkage* linkage_; | 852 Linkage* linkage_; |
828 Schedule* schedule_; | 853 Schedule* schedule_; |
829 ConstantMap constants_; | 854 ConstantMap constants_; |
830 ConstantDeque immediates_; | 855 ConstantDeque immediates_; |
831 InstructionDeque instructions_; | 856 InstructionDeque instructions_; |
832 int next_virtual_register_; | 857 int next_virtual_register_; |
833 PointerMapDeque pointer_maps_; | 858 PointerMapDeque pointer_maps_; |
834 VirtualRegisterSet doubles_; | 859 VirtualRegisterSet doubles_; |
835 VirtualRegisterSet references_; | 860 VirtualRegisterSet references_; |
836 Frame frame_; | 861 Frame frame_; |
837 DeoptimizationVector deoptimization_entries_; | 862 DeoptimizationVector deoptimization_entries_; |
838 }; | 863 }; |
839 | 864 |
840 OStream& operator<<(OStream& os, const InstructionSequence& code); | 865 OStream& operator<<(OStream& os, const InstructionSequence& code); |
841 | 866 |
842 } // namespace compiler | 867 } // namespace compiler |
843 } // namespace internal | 868 } // namespace internal |
844 } // namespace v8 | 869 } // namespace v8 |
845 | 870 |
846 #endif // V8_COMPILER_INSTRUCTION_H_ | 871 #endif // V8_COMPILER_INSTRUCTION_H_ |
OLD | NEW |