| 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) |
| 706 : bailout_id_(state_info.bailout_id()), | 707 : bailout_id_(state_info.bailout_id()), |
| 707 frame_state_combine_(state_info.state_combine()), | 708 frame_state_combine_(state_info.state_combine()), |
| 708 parameters_count_(parameters_count), | 709 parameters_count_(parameters_count), |
| 709 locals_count_(locals_count), | 710 locals_count_(locals_count), |
| 710 stack_count_(stack_count) {} | 711 stack_count_(stack_count), |
| 712 outer_state_(outer_state) {} |
| 711 | 713 |
| 712 BailoutId bailout_id() const { return bailout_id_; } | 714 BailoutId bailout_id() const { return bailout_id_; } |
| 713 OutputFrameStateCombine state_combine() const { return frame_state_combine_; } | 715 OutputFrameStateCombine state_combine() const { return frame_state_combine_; } |
| 714 int parameters_count() { return parameters_count_; } | 716 int parameters_count() { return parameters_count_; } |
| 715 int locals_count() { return locals_count_; } | 717 int locals_count() { return locals_count_; } |
| 716 int stack_count() { return stack_count_; } | 718 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 } |
| 717 | 723 |
| 718 int size() { | 724 int size() { |
| 719 return parameters_count_ + locals_count_ + stack_count_ + | 725 return parameters_count_ + locals_count_ + stack_count_ + |
| 720 1; // Includes context. | 726 1; // Includes context. |
| 721 } | 727 } |
| 722 | 728 |
| 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 |
| 723 private: | 747 private: |
| 724 BailoutId bailout_id_; | 748 BailoutId bailout_id_; |
| 725 OutputFrameStateCombine frame_state_combine_; | 749 OutputFrameStateCombine frame_state_combine_; |
| 726 int parameters_count_; | 750 int parameters_count_; |
| 727 int locals_count_; | 751 int locals_count_; |
| 728 int stack_count_; | 752 int stack_count_; |
| 753 FrameStateDescriptor* outer_state_; |
| 729 }; | 754 }; |
| 730 | 755 |
| 731 OStream& operator<<(OStream& os, const Constant& constant); | 756 OStream& operator<<(OStream& os, const Constant& constant); |
| 732 | 757 |
| 733 typedef ZoneDeque<Constant> ConstantDeque; | 758 typedef ZoneDeque<Constant> ConstantDeque; |
| 734 typedef std::map<int, Constant, std::less<int>, | 759 typedef std::map<int, Constant, std::less<int>, |
| 735 zone_allocator<std::pair<int, Constant> > > ConstantMap; | 760 zone_allocator<std::pair<int, Constant> > > ConstantMap; |
| 736 | 761 |
| 737 typedef ZoneDeque<Instruction*> InstructionDeque; | 762 typedef ZoneDeque<Instruction*> InstructionDeque; |
| 738 typedef ZoneDeque<PointerMap*> PointerMapDeque; | 763 typedef ZoneDeque<PointerMap*> PointerMapDeque; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 DeoptimizationVector deoptimization_entries_; | 902 DeoptimizationVector deoptimization_entries_; |
| 878 }; | 903 }; |
| 879 | 904 |
| 880 OStream& operator<<(OStream& os, const InstructionSequence& code); | 905 OStream& operator<<(OStream& os, const InstructionSequence& code); |
| 881 | 906 |
| 882 } // namespace compiler | 907 } // namespace compiler |
| 883 } // namespace internal | 908 } // namespace internal |
| 884 } // namespace v8 | 909 } // namespace v8 |
| 885 | 910 |
| 886 #endif // V8_COMPILER_INSTRUCTION_H_ | 911 #endif // V8_COMPILER_INSTRUCTION_H_ |
| OLD | NEW |