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

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

Issue 573703002: Add handling for deopt and argument adaptor frames. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Minor improvements. Created 6 years, 3 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
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 <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 size_t parameters_count, size_t locals_count,
706 size_t stack_count,
706 FrameStateDescriptor* outer_state = NULL) 707 FrameStateDescriptor* outer_state = NULL)
707 : bailout_id_(state_info.bailout_id()), 708 : type_(state_info.type()),
709 bailout_id_(state_info.bailout_id()),
708 frame_state_combine_(state_info.state_combine()), 710 frame_state_combine_(state_info.state_combine()),
709 parameters_count_(parameters_count), 711 parameters_count_(parameters_count),
710 locals_count_(locals_count), 712 locals_count_(locals_count),
711 stack_count_(stack_count), 713 stack_count_(stack_count),
712 outer_state_(outer_state) {} 714 outer_state_(outer_state),
715 jsfunction_(state_info.jsfunction()) {}
713 716
717 FrameStateType type() const { return type_; }
714 BailoutId bailout_id() const { return bailout_id_; } 718 BailoutId bailout_id() const { return bailout_id_; }
715 OutputFrameStateCombine state_combine() const { return frame_state_combine_; } 719 OutputFrameStateCombine state_combine() const { return frame_state_combine_; }
716 int parameters_count() { return parameters_count_; } 720 size_t parameters_count() { return parameters_count_; }
717 int locals_count() { return locals_count_; } 721 size_t locals_count() { return locals_count_; }
718 int stack_count() { return stack_count_; } 722 size_t stack_count() { return stack_count_; }
719 FrameStateDescriptor* outer_state() { return outer_state_; } 723 FrameStateDescriptor* outer_state() { return outer_state_; }
720 void set_outer_state(FrameStateDescriptor* outer_state) { 724 Unique<JSFunction> jsfunction() { return jsfunction_; }
721 outer_state_ = outer_state; 725
726 size_t size() {
727 return parameters_count_ + locals_count_ + stack_count_ +
728 (type_ == JS_FRAME ? 1 : 0); // JS_FRAME includes context.
722 } 729 }
723 730
724 int size() { 731 size_t GetTotalSize() {
725 return parameters_count_ + locals_count_ + stack_count_ + 732 size_t total_size = 0;
726 1; // Includes context.
727 }
728
729 int total_size() {
730 int total_size = 0;
731 for (FrameStateDescriptor* iter = this; iter != NULL; 733 for (FrameStateDescriptor* iter = this; iter != NULL;
732 iter = iter->outer_state_) { 734 iter = iter->outer_state_) {
733 total_size += iter->size(); 735 total_size += iter->size();
734 } 736 }
735 return total_size; 737 return total_size;
736 } 738 }
737 739
738 int GetFrameCount() { 740 size_t GetHeight(OutputFrameStateCombine override) {
739 int count = 0; 741 int height = size() - parameters_count();
742 switch (override) {
743 case kPushOutput:
744 ++height;
745 break;
746 case kIgnoreOutput:
747 break;
748 }
749 return height;
750 }
751
752 size_t GetFrameCount() {
753 size_t count = 0;
740 for (FrameStateDescriptor* iter = this; iter != NULL; 754 for (FrameStateDescriptor* iter = this; iter != NULL;
741 iter = iter->outer_state_) { 755 iter = iter->outer_state_) {
742 ++count; 756 ++count;
743 } 757 }
744 return count; 758 return count;
745 } 759 }
746 760
761 size_t GetJSFrameCount() {
762 size_t count = 0;
763 for (FrameStateDescriptor* iter = this; iter != NULL;
764 iter = iter->outer_state_) {
765 if (iter->type_ == JS_FRAME) {
766 ++count;
767 }
768 }
769 return count;
770 }
771
747 private: 772 private:
773 FrameStateType type_;
748 BailoutId bailout_id_; 774 BailoutId bailout_id_;
749 OutputFrameStateCombine frame_state_combine_; 775 OutputFrameStateCombine frame_state_combine_;
750 int parameters_count_; 776 size_t parameters_count_;
751 int locals_count_; 777 size_t locals_count_;
752 int stack_count_; 778 size_t stack_count_;
753 FrameStateDescriptor* outer_state_; 779 FrameStateDescriptor* outer_state_;
780 Unique<JSFunction> jsfunction_;
754 }; 781 };
755 782
756 OStream& operator<<(OStream& os, const Constant& constant); 783 OStream& operator<<(OStream& os, const Constant& constant);
757 784
758 typedef ZoneDeque<Constant> ConstantDeque; 785 typedef ZoneDeque<Constant> ConstantDeque;
759 typedef std::map<int, Constant, std::less<int>, 786 typedef std::map<int, Constant, std::less<int>,
760 zone_allocator<std::pair<int, Constant> > > ConstantMap; 787 zone_allocator<std::pair<int, Constant> > > ConstantMap;
761 788
762 typedef ZoneDeque<Instruction*> InstructionDeque; 789 typedef ZoneDeque<Instruction*> InstructionDeque;
763 typedef ZoneDeque<PointerMap*> PointerMapDeque; 790 typedef ZoneDeque<PointerMap*> PointerMapDeque;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 DeoptimizationVector deoptimization_entries_; 929 DeoptimizationVector deoptimization_entries_;
903 }; 930 };
904 931
905 OStream& operator<<(OStream& os, const InstructionSequence& code); 932 OStream& operator<<(OStream& os, const InstructionSequence& code);
906 933
907 } // namespace compiler 934 } // namespace compiler
908 } // namespace internal 935 } // namespace internal
909 } // namespace v8 936 } // namespace v8
910 937
911 #endif // V8_COMPILER_INSTRUCTION_H_ 938 #endif // V8_COMPILER_INSTRUCTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698