OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_FRAMES_H_ | 5 #ifndef V8_FRAMES_H_ |
6 #define V8_FRAMES_H_ | 6 #define V8_FRAMES_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/handles.h" | 9 #include "src/handles.h" |
10 #include "src/safepoint-table.h" | 10 #include "src/safepoint-table.h" |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 private: | 628 private: |
629 void ComputeCallerState(State* state) const override; | 629 void ComputeCallerState(State* state) const override; |
630 | 630 |
631 friend class StackFrameIteratorBase; | 631 friend class StackFrameIteratorBase; |
632 }; | 632 }; |
633 | 633 |
634 class JavaScriptFrame; | 634 class JavaScriptFrame; |
635 | 635 |
636 class FrameSummary BASE_EMBEDDED { | 636 class FrameSummary BASE_EMBEDDED { |
637 public: | 637 public: |
638 // Mode for StandardFrame::Summarize. Exact summary is required to produce an | 638 // Mode for JavaScriptFrame::Summarize. Exact summary is required to produce |
639 // exact stack trace. It will trigger an assertion failure if that is not | 639 // an exact stack trace. It will trigger an assertion failure if that is not |
640 // possible, e.g., because of missing deoptimization information. The | 640 // possible, e.g., because of missing deoptimization information. The |
641 // approximate mode should produce a summary even without deoptimization | 641 // approximate mode should produce a summary even without deoptimization |
642 // information, but it might miss frames. | 642 // information, but it might miss frames. |
643 enum Mode { kExactSummary, kApproximateSummary }; | 643 enum Mode { kExactSummary, kApproximateSummary }; |
644 | 644 |
645 FrameSummary(Object* receiver, JSFunction* function, | 645 FrameSummary(Object* receiver, JSFunction* function, |
646 AbstractCode* abstract_code, int code_offset, | 646 AbstractCode* abstract_code, int code_offset, |
647 bool is_constructor, Mode mode = kExactSummary); | 647 bool is_constructor, Mode mode = kExactSummary); |
648 | 648 |
649 static FrameSummary GetFirst(JavaScriptFrame* frame); | 649 static FrameSummary GetFirst(JavaScriptFrame* frame); |
(...skipping 27 matching lines...) Expand all Loading... |
677 inline void SetExpression(int index, Object* value); | 677 inline void SetExpression(int index, Object* value); |
678 int ComputeExpressionsCount() const; | 678 int ComputeExpressionsCount() const; |
679 | 679 |
680 void SetCallerFp(Address caller_fp) override; | 680 void SetCallerFp(Address caller_fp) override; |
681 | 681 |
682 static StandardFrame* cast(StackFrame* frame) { | 682 static StandardFrame* cast(StackFrame* frame) { |
683 DCHECK(frame->is_standard()); | 683 DCHECK(frame->is_standard()); |
684 return static_cast<StandardFrame*>(frame); | 684 return static_cast<StandardFrame*>(frame); |
685 } | 685 } |
686 | 686 |
687 // Build a list with summaries for this frame including all inlined frames. | |
688 virtual void Summarize( | |
689 List<FrameSummary>* frames, | |
690 FrameSummary::Mode mode = FrameSummary::kExactSummary) const; | |
691 | |
692 // Accessors. | |
693 virtual JSFunction* function() const; | |
694 virtual Object* receiver() const; | |
695 | |
696 protected: | 687 protected: |
697 inline explicit StandardFrame(StackFrameIteratorBase* iterator); | 688 inline explicit StandardFrame(StackFrameIteratorBase* iterator); |
698 | 689 |
699 void ComputeCallerState(State* state) const override; | 690 void ComputeCallerState(State* state) const override; |
700 | 691 |
701 // Accessors. | 692 // Accessors. |
702 inline Address caller_fp() const; | 693 inline Address caller_fp() const; |
703 inline Address caller_pc() const; | 694 inline Address caller_pc() const; |
704 | 695 |
705 // Computes the address of the PC field in the standard frame given | 696 // Computes the address of the PC field in the standard frame given |
(...skipping 24 matching lines...) Expand all Loading... |
730 | 721 |
731 private: | 722 private: |
732 friend class StackFrame; | 723 friend class StackFrame; |
733 friend class SafeStackFrameIterator; | 724 friend class SafeStackFrameIterator; |
734 }; | 725 }; |
735 | 726 |
736 class JavaScriptFrame : public StandardFrame { | 727 class JavaScriptFrame : public StandardFrame { |
737 public: | 728 public: |
738 Type type() const override { return JAVA_SCRIPT; } | 729 Type type() const override { return JAVA_SCRIPT; } |
739 | 730 |
740 JSFunction* function() const override; | 731 // Build a list with summaries for this frame including all inlined frames. |
741 Object* receiver() const override; | 732 virtual void Summarize( |
| 733 List<FrameSummary>* frames, |
| 734 FrameSummary::Mode mode = FrameSummary::kExactSummary) const; |
| 735 |
| 736 // Accessors. |
| 737 virtual JSFunction* function() const; |
| 738 virtual Object* receiver() const; |
742 | 739 |
743 inline void set_receiver(Object* value); | 740 inline void set_receiver(Object* value); |
744 | 741 |
745 // Access the parameters. | 742 // Access the parameters. |
746 inline Address GetParameterSlot(int index) const; | 743 inline Address GetParameterSlot(int index) const; |
747 inline Object* GetParameter(int index) const; | 744 inline Object* GetParameter(int index) const; |
748 inline int ComputeParametersCount() const { | 745 inline int ComputeParametersCount() const { |
749 return GetNumberOfIncomingArguments(); | 746 return GetNumberOfIncomingArguments(); |
750 } | 747 } |
751 | 748 |
(...skipping 27 matching lines...) Expand all Loading... |
779 // Printing support. | 776 // Printing support. |
780 void Print(StringStream* accumulator, PrintMode mode, | 777 void Print(StringStream* accumulator, PrintMode mode, |
781 int index) const override; | 778 int index) const override; |
782 | 779 |
783 // Determine the code for the frame. | 780 // Determine the code for the frame. |
784 Code* unchecked_code() const override; | 781 Code* unchecked_code() const override; |
785 | 782 |
786 // Return a list with JSFunctions of this frame. | 783 // Return a list with JSFunctions of this frame. |
787 virtual void GetFunctions(List<JSFunction*>* functions) const; | 784 virtual void GetFunctions(List<JSFunction*>* functions) const; |
788 | 785 |
789 void Summarize( | |
790 List<FrameSummary>* frames, | |
791 FrameSummary::Mode mode = FrameSummary::kExactSummary) const override; | |
792 | |
793 // Lookup exception handler for current {pc}, returns -1 if none found. Also | 786 // Lookup exception handler for current {pc}, returns -1 if none found. Also |
794 // returns data associated with the handler site specific to the frame type: | 787 // returns data associated with the handler site specific to the frame type: |
795 // - JavaScriptFrame : Data is the stack depth at entry of the try-block. | 788 // - JavaScriptFrame : Data is the stack depth at entry of the try-block. |
796 // - OptimizedFrame : Data is the stack slot count of the entire frame. | 789 // - OptimizedFrame : Data is the stack slot count of the entire frame. |
797 // - InterpretedFrame: Data is the register index holding the context. | 790 // - InterpretedFrame: Data is the register index holding the context. |
798 virtual int LookupExceptionHandlerInTable( | 791 virtual int LookupExceptionHandlerInTable( |
799 int* data, HandlerTable::CatchPrediction* prediction); | 792 int* data, HandlerTable::CatchPrediction* prediction); |
800 | 793 |
801 // Architecture-specific register description. | 794 // Architecture-specific register description. |
802 static Register fp_register(); | 795 static Register fp_register(); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 // GC support. | 961 // GC support. |
969 void Iterate(ObjectVisitor* v) const override; | 962 void Iterate(ObjectVisitor* v) const override; |
970 | 963 |
971 // Printing support. | 964 // Printing support. |
972 void Print(StringStream* accumulator, PrintMode mode, | 965 void Print(StringStream* accumulator, PrintMode mode, |
973 int index) const override; | 966 int index) const override; |
974 | 967 |
975 // Determine the code for the frame. | 968 // Determine the code for the frame. |
976 Code* unchecked_code() const override; | 969 Code* unchecked_code() const override; |
977 | 970 |
| 971 Object* wasm_obj(); |
| 972 uint32_t function_index(); |
| 973 |
| 974 Object* function_name(); |
| 975 |
978 static WasmFrame* cast(StackFrame* frame) { | 976 static WasmFrame* cast(StackFrame* frame) { |
979 DCHECK(frame->is_wasm()); | 977 DCHECK(frame->is_wasm()); |
980 return static_cast<WasmFrame*>(frame); | 978 return static_cast<WasmFrame*>(frame); |
981 } | 979 } |
982 | 980 |
983 JSFunction* function() const override; | |
984 | |
985 void Summarize( | |
986 List<FrameSummary>* frames, | |
987 FrameSummary::Mode mode = FrameSummary::kExactSummary) const override; | |
988 | |
989 protected: | 981 protected: |
990 inline explicit WasmFrame(StackFrameIteratorBase* iterator); | 982 inline explicit WasmFrame(StackFrameIteratorBase* iterator); |
991 | 983 |
992 Address GetCallerStackPointer() const override; | 984 Address GetCallerStackPointer() const override; |
993 | 985 |
994 private: | 986 private: |
995 friend class StackFrameIteratorBase; | 987 friend class StackFrameIteratorBase; |
996 }; | 988 }; |
997 | 989 |
998 class WasmToJsFrame : public StubFrame { | 990 class WasmToJsFrame : public StubFrame { |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1228 | 1220 |
1229 | 1221 |
1230 // Reads all frames on the current stack and copies them into the current | 1222 // Reads all frames on the current stack and copies them into the current |
1231 // zone memory. | 1223 // zone memory. |
1232 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); | 1224 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); |
1233 | 1225 |
1234 } // namespace internal | 1226 } // namespace internal |
1235 } // namespace v8 | 1227 } // namespace v8 |
1236 | 1228 |
1237 #endif // V8_FRAMES_H_ | 1229 #endif // V8_FRAMES_H_ |
OLD | NEW |