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 <iosfwd> | 9 #include <iosfwd> |
10 #include <map> | 10 #include <map> |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
704 } | 704 } |
705 | 705 |
706 private: | 706 private: |
707 Type type_; | 707 Type type_; |
708 int64_t value_; | 708 int64_t value_; |
709 }; | 709 }; |
710 | 710 |
711 | 711 |
712 class FrameStateDescriptor : public ZoneObject { | 712 class FrameStateDescriptor : public ZoneObject { |
713 public: | 713 public: |
714 FrameStateDescriptor(const FrameStateCallInfo& state_info, | 714 FrameStateDescriptor(Zone* zone, const FrameStateCallInfo& state_info, |
715 size_t parameters_count, size_t locals_count, | 715 size_t parameters_count, size_t locals_count, |
716 size_t stack_count, | 716 size_t stack_count, |
717 FrameStateDescriptor* outer_state = NULL) | 717 FrameStateDescriptor* outer_state = NULL); |
718 : type_(state_info.type()), | |
719 bailout_id_(state_info.bailout_id()), | |
720 frame_state_combine_(state_info.state_combine()), | |
721 parameters_count_(parameters_count), | |
722 locals_count_(locals_count), | |
723 stack_count_(stack_count), | |
724 outer_state_(outer_state), | |
725 jsfunction_(state_info.jsfunction()) {} | |
726 | 718 |
727 FrameStateType type() const { return type_; } | 719 FrameStateType type() const { return type_; } |
728 BailoutId bailout_id() const { return bailout_id_; } | 720 BailoutId bailout_id() const { return bailout_id_; } |
729 OutputFrameStateCombine state_combine() const { return frame_state_combine_; } | 721 OutputFrameStateCombine state_combine() const { return frame_state_combine_; } |
730 size_t parameters_count() const { return parameters_count_; } | 722 size_t parameters_count() const { return parameters_count_; } |
731 size_t locals_count() const { return locals_count_; } | 723 size_t locals_count() const { return locals_count_; } |
732 size_t stack_count() const { return stack_count_; } | 724 size_t stack_count() const { return stack_count_; } |
733 FrameStateDescriptor* outer_state() const { return outer_state_; } | 725 FrameStateDescriptor* outer_state() const { return outer_state_; } |
734 MaybeHandle<JSFunction> jsfunction() const { return jsfunction_; } | 726 MaybeHandle<JSFunction> jsfunction() const { return jsfunction_; } |
727 bool HasContext() const { return type_ == JS_FRAME; } | |
735 | 728 |
736 size_t GetSize(OutputFrameStateCombine combine = | 729 size_t GetSize(OutputFrameStateCombine combine = |
737 OutputFrameStateCombine::Ignore()) const { | 730 OutputFrameStateCombine::Ignore()) const; |
738 size_t size = parameters_count_ + locals_count_ + stack_count_ + | 731 size_t GetTotalSize() const; |
739 (HasContext() ? 1 : 0); | 732 size_t GetFrameCount() const; |
740 switch (combine.kind()) { | 733 size_t GetJSFrameCount() const; |
741 case OutputFrameStateCombine::kPushOutput: | 734 MachineType GetType(size_t index) const; |
742 size += combine.GetPushCount(); | |
743 break; | |
744 case OutputFrameStateCombine::kPokeAt: | |
745 break; | |
746 } | |
747 return size; | |
748 } | |
749 | 735 |
750 size_t GetTotalSize() const { | 736 void SetTypes(ZoneVector<MachineType>* types); |
titzer
2014/10/06 08:54:11
The types vector only describes this frame state's
Jarin
2014/10/06 09:45:27
Done.
| |
751 size_t total_size = 0; | |
752 for (const FrameStateDescriptor* iter = this; iter != NULL; | |
753 iter = iter->outer_state_) { | |
754 total_size += iter->GetSize(); | |
755 } | |
756 return total_size; | |
757 } | |
758 | |
759 size_t GetFrameCount() const { | |
760 size_t count = 0; | |
761 for (const FrameStateDescriptor* iter = this; iter != NULL; | |
762 iter = iter->outer_state_) { | |
763 ++count; | |
764 } | |
765 return count; | |
766 } | |
767 | |
768 size_t GetJSFrameCount() const { | |
769 size_t count = 0; | |
770 for (const FrameStateDescriptor* iter = this; iter != NULL; | |
771 iter = iter->outer_state_) { | |
772 if (iter->type_ == JS_FRAME) { | |
773 ++count; | |
774 } | |
775 } | |
776 return count; | |
777 } | |
778 | |
779 bool HasContext() const { return type_ == JS_FRAME; } | |
780 | 737 |
781 private: | 738 private: |
782 FrameStateType type_; | 739 FrameStateType type_; |
783 BailoutId bailout_id_; | 740 BailoutId bailout_id_; |
784 OutputFrameStateCombine frame_state_combine_; | 741 OutputFrameStateCombine frame_state_combine_; |
785 size_t parameters_count_; | 742 size_t parameters_count_; |
786 size_t locals_count_; | 743 size_t locals_count_; |
787 size_t stack_count_; | 744 size_t stack_count_; |
745 ZoneVector<MachineType> types_; | |
788 FrameStateDescriptor* outer_state_; | 746 FrameStateDescriptor* outer_state_; |
789 MaybeHandle<JSFunction> jsfunction_; | 747 MaybeHandle<JSFunction> jsfunction_; |
790 }; | 748 }; |
791 | 749 |
792 std::ostream& operator<<(std::ostream& os, const Constant& constant); | 750 std::ostream& operator<<(std::ostream& os, const Constant& constant); |
793 | 751 |
794 typedef ZoneDeque<Constant> ConstantDeque; | 752 typedef ZoneDeque<Constant> ConstantDeque; |
795 typedef std::map<int, Constant, std::less<int>, | 753 typedef std::map<int, Constant, std::less<int>, |
796 zone_allocator<std::pair<int, Constant> > > ConstantMap; | 754 zone_allocator<std::pair<int, Constant> > > ConstantMap; |
797 | 755 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
939 DeoptimizationVector deoptimization_entries_; | 897 DeoptimizationVector deoptimization_entries_; |
940 }; | 898 }; |
941 | 899 |
942 std::ostream& operator<<(std::ostream& os, const InstructionSequence& code); | 900 std::ostream& operator<<(std::ostream& os, const InstructionSequence& code); |
943 | 901 |
944 } // namespace compiler | 902 } // namespace compiler |
945 } // namespace internal | 903 } // namespace internal |
946 } // namespace v8 | 904 } // namespace v8 |
947 | 905 |
948 #endif // V8_COMPILER_INSTRUCTION_H_ | 906 #endif // V8_COMPILER_INSTRUCTION_H_ |
OLD | NEW |