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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 | 695 |
696 private: | 696 private: |
697 Type type_; | 697 Type type_; |
698 int64_t value_; | 698 int64_t value_; |
699 }; | 699 }; |
700 | 700 |
701 | 701 |
702 class FrameStateDescriptor : public ZoneObject { | 702 class FrameStateDescriptor : public ZoneObject { |
703 public: | 703 public: |
704 FrameStateDescriptor(const FrameStateCallInfo& state_info, | 704 FrameStateDescriptor(const FrameStateCallInfo& state_info, |
705 int parameters_count, int locals_count, int stack_count, | 705 int parameters_count, int locals_count, int stack_count) |
706 FrameStateDescriptor* outer_state = NULL) | |
707 : bailout_id_(state_info.bailout_id()), | 706 : bailout_id_(state_info.bailout_id()), |
708 frame_state_combine_(state_info.state_combine()), | 707 frame_state_combine_(state_info.state_combine()), |
709 parameters_count_(parameters_count), | 708 parameters_count_(parameters_count), |
710 locals_count_(locals_count), | 709 locals_count_(locals_count), |
711 stack_count_(stack_count), | 710 stack_count_(stack_count) {} |
712 outer_state_(outer_state) {} | |
713 | 711 |
714 BailoutId bailout_id() const { return bailout_id_; } | 712 BailoutId bailout_id() const { return bailout_id_; } |
715 OutputFrameStateCombine state_combine() const { return frame_state_combine_; } | 713 OutputFrameStateCombine state_combine() const { return frame_state_combine_; } |
716 int parameters_count() { return parameters_count_; } | 714 int parameters_count() { return parameters_count_; } |
717 int locals_count() { return locals_count_; } | 715 int locals_count() { return locals_count_; } |
718 int stack_count() { return stack_count_; } | 716 int stack_count() { return stack_count_; } |
719 FrameStateDescriptor* outer_state() { return outer_state_; } | |
720 void set_outer_state(FrameStateDescriptor* outer_state) { | |
721 outer_state_ = outer_state; | |
722 } | |
723 | 717 |
724 int size() { | 718 int size() { |
725 return parameters_count_ + locals_count_ + stack_count_ + | 719 return parameters_count_ + locals_count_ + stack_count_ + |
726 1; // Includes context. | 720 1; // Includes context. |
727 } | 721 } |
728 | 722 |
729 int total_size() { | |
730 int total_size = 0; | |
731 for (FrameStateDescriptor* iter = this; iter != NULL; | |
732 iter = iter->outer_state_) { | |
733 total_size += iter->size(); | |
734 } | |
735 return total_size; | |
736 } | |
737 | |
738 int GetFrameCount() { | |
739 int count = 0; | |
740 for (FrameStateDescriptor* iter = this; iter != NULL; | |
741 iter = iter->outer_state_) { | |
742 ++count; | |
743 } | |
744 return count; | |
745 } | |
746 | |
747 private: | 723 private: |
748 BailoutId bailout_id_; | 724 BailoutId bailout_id_; |
749 OutputFrameStateCombine frame_state_combine_; | 725 OutputFrameStateCombine frame_state_combine_; |
750 int parameters_count_; | 726 int parameters_count_; |
751 int locals_count_; | 727 int locals_count_; |
752 int stack_count_; | 728 int stack_count_; |
753 FrameStateDescriptor* outer_state_; | |
754 }; | 729 }; |
755 | 730 |
756 OStream& operator<<(OStream& os, const Constant& constant); | 731 OStream& operator<<(OStream& os, const Constant& constant); |
757 | 732 |
758 typedef ZoneDeque<Constant> ConstantDeque; | 733 typedef ZoneDeque<Constant> ConstantDeque; |
759 typedef std::map<int, Constant, std::less<int>, | 734 typedef std::map<int, Constant, std::less<int>, |
760 zone_allocator<std::pair<int, Constant> > > ConstantMap; | 735 zone_allocator<std::pair<int, Constant> > > ConstantMap; |
761 | 736 |
762 typedef ZoneDeque<Instruction*> InstructionDeque; | 737 typedef ZoneDeque<Instruction*> InstructionDeque; |
763 typedef ZoneDeque<PointerMap*> PointerMapDeque; | 738 typedef ZoneDeque<PointerMap*> PointerMapDeque; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 DeoptimizationVector deoptimization_entries_; | 877 DeoptimizationVector deoptimization_entries_; |
903 }; | 878 }; |
904 | 879 |
905 OStream& operator<<(OStream& os, const InstructionSequence& code); | 880 OStream& operator<<(OStream& os, const InstructionSequence& code); |
906 | 881 |
907 } // namespace compiler | 882 } // namespace compiler |
908 } // namespace internal | 883 } // namespace internal |
909 } // namespace v8 | 884 } // namespace v8 |
910 | 885 |
911 #endif // V8_COMPILER_INSTRUCTION_H_ | 886 #endif // V8_COMPILER_INSTRUCTION_H_ |
OLD | NEW |