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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 | 729 |
730 FrameStateType type() const { return type_; } | 730 FrameStateType type() const { return type_; } |
731 BailoutId bailout_id() const { return bailout_id_; } | 731 BailoutId bailout_id() const { return bailout_id_; } |
732 OutputFrameStateCombine state_combine() const { return frame_state_combine_; } | 732 OutputFrameStateCombine state_combine() const { return frame_state_combine_; } |
733 size_t parameters_count() const { return parameters_count_; } | 733 size_t parameters_count() const { return parameters_count_; } |
734 size_t locals_count() const { return locals_count_; } | 734 size_t locals_count() const { return locals_count_; } |
735 size_t stack_count() const { return stack_count_; } | 735 size_t stack_count() const { return stack_count_; } |
736 FrameStateDescriptor* outer_state() const { return outer_state_; } | 736 FrameStateDescriptor* outer_state() const { return outer_state_; } |
737 MaybeHandle<JSFunction> jsfunction() const { return jsfunction_; } | 737 MaybeHandle<JSFunction> jsfunction() const { return jsfunction_; } |
738 | 738 |
739 size_t size() const { | 739 size_t GetSize(OutputFrameStateCombine combine = |
740 return parameters_count_ + locals_count_ + stack_count_ + | 740 OutputFrameStateCombine::Ignore()) const { |
741 (HasContext() ? 1 : 0); | 741 size_t size = parameters_count_ + locals_count_ + stack_count_ + |
| 742 (HasContext() ? 1 : 0); |
| 743 switch (combine.kind()) { |
| 744 case OutputFrameStateCombine::kPushOutput: |
| 745 size += combine.GetPushCount(); |
| 746 break; |
| 747 case OutputFrameStateCombine::kPokeAt: |
| 748 break; |
| 749 } |
| 750 return size; |
742 } | 751 } |
743 | 752 |
744 size_t GetTotalSize() const { | 753 size_t GetTotalSize() const { |
745 size_t total_size = 0; | 754 size_t total_size = 0; |
746 for (const FrameStateDescriptor* iter = this; iter != NULL; | 755 for (const FrameStateDescriptor* iter = this; iter != NULL; |
747 iter = iter->outer_state_) { | 756 iter = iter->outer_state_) { |
748 total_size += iter->size(); | 757 total_size += iter->GetSize(); |
749 } | 758 } |
750 return total_size; | 759 return total_size; |
751 } | 760 } |
752 | 761 |
753 size_t GetHeight(OutputFrameStateCombine override) const { | |
754 size_t height = size() - parameters_count(); | |
755 switch (override) { | |
756 case kPushOutput: | |
757 ++height; | |
758 break; | |
759 case kIgnoreOutput: | |
760 break; | |
761 } | |
762 return height; | |
763 } | |
764 | |
765 size_t GetFrameCount() const { | 762 size_t GetFrameCount() const { |
766 size_t count = 0; | 763 size_t count = 0; |
767 for (const FrameStateDescriptor* iter = this; iter != NULL; | 764 for (const FrameStateDescriptor* iter = this; iter != NULL; |
768 iter = iter->outer_state_) { | 765 iter = iter->outer_state_) { |
769 ++count; | 766 ++count; |
770 } | 767 } |
771 return count; | 768 return count; |
772 } | 769 } |
773 | 770 |
774 size_t GetJSFrameCount() const { | 771 size_t GetJSFrameCount() const { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
944 DeoptimizationVector deoptimization_entries_; | 941 DeoptimizationVector deoptimization_entries_; |
945 }; | 942 }; |
946 | 943 |
947 OStream& operator<<(OStream& os, const InstructionSequence& code); | 944 OStream& operator<<(OStream& os, const InstructionSequence& code); |
948 | 945 |
949 } // namespace compiler | 946 } // namespace compiler |
950 } // namespace internal | 947 } // namespace internal |
951 } // namespace v8 | 948 } // namespace v8 |
952 | 949 |
953 #endif // V8_COMPILER_INSTRUCTION_H_ | 950 #endif // V8_COMPILER_INSTRUCTION_H_ |
OLD | NEW |