Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/compiler/instruction.h

Issue 614713002: Relax representation requirement in FrameStates. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/compiler/code-generator.cc ('k') | src/compiler/instruction.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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:
742 size += combine.GetPushCount();
743 break;
744 case OutputFrameStateCombine::kPokeAt:
745 break;
746 }
747 return size;
748 }
749 734
750 size_t GetTotalSize() const { 735 MachineType GetType(size_t index) const;
751 size_t total_size = 0; 736 void SetType(size_t index, MachineType type);
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 DeoptimizationVector deoptimization_entries_; 889 DeoptimizationVector deoptimization_entries_;
932 }; 890 };
933 891
934 std::ostream& operator<<(std::ostream& os, const InstructionSequence& code); 892 std::ostream& operator<<(std::ostream& os, const InstructionSequence& code);
935 893
936 } // namespace compiler 894 } // namespace compiler
937 } // namespace internal 895 } // namespace internal
938 } // namespace v8 896 } // namespace v8
939 897
940 #endif // V8_COMPILER_INSTRUCTION_H_ 898 #endif // V8_COMPILER_INSTRUCTION_H_
OLDNEW
« no previous file with comments | « src/compiler/code-generator.cc ('k') | src/compiler/instruction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698