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

Side by Side Diff: src/frames.h

Issue 2069823003: [wasm] Enable wasm frame inspection for debugging (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@split-wasm-debug
Patch Set: Add two DCHECKs Created 4 years, 6 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
« no previous file with comments | « src/debug/mirrors.js ('k') | src/frames.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 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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 int code_offset_; 675 int code_offset_;
676 bool is_constructor_; 676 bool is_constructor_;
677 }; 677 };
678 678
679 class StandardFrame : public StackFrame { 679 class StandardFrame : public StackFrame {
680 public: 680 public:
681 // Testers. 681 // Testers.
682 bool is_standard() const override { return true; } 682 bool is_standard() const override { return true; }
683 683
684 // Accessors. 684 // Accessors.
685 inline Object* context() const; 685 virtual Object* receiver() const;
686 virtual Script* script() const;
687 virtual Object* context() const;
686 688
687 // Access the expressions in the stack frame including locals. 689 // Access the expressions in the stack frame including locals.
688 inline Object* GetExpression(int index) const; 690 inline Object* GetExpression(int index) const;
689 inline void SetExpression(int index, Object* value); 691 inline void SetExpression(int index, Object* value);
690 int ComputeExpressionsCount() const; 692 int ComputeExpressionsCount() const;
691 693
694 // Access the parameters.
695 virtual Object* GetParameter(int index) const;
696 virtual int ComputeParametersCount() const;
697
692 void SetCallerFp(Address caller_fp) override; 698 void SetCallerFp(Address caller_fp) override;
693 699
700 // Check if this frame is a constructor frame invoked through 'new'.
701 virtual bool IsConstructor() const;
702
694 static StandardFrame* cast(StackFrame* frame) { 703 static StandardFrame* cast(StackFrame* frame) {
695 DCHECK(frame->is_standard()); 704 DCHECK(frame->is_standard());
696 return static_cast<StandardFrame*>(frame); 705 return static_cast<StandardFrame*>(frame);
697 } 706 }
698 707
699 protected: 708 protected:
700 inline explicit StandardFrame(StackFrameIteratorBase* iterator); 709 inline explicit StandardFrame(StackFrameIteratorBase* iterator);
701 710
702 void ComputeCallerState(State* state) const override; 711 void ComputeCallerState(State* state) const override;
703 712
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 public: 749 public:
741 Type type() const override { return JAVA_SCRIPT; } 750 Type type() const override { return JAVA_SCRIPT; }
742 751
743 // Build a list with summaries for this frame including all inlined frames. 752 // Build a list with summaries for this frame including all inlined frames.
744 virtual void Summarize( 753 virtual void Summarize(
745 List<FrameSummary>* frames, 754 List<FrameSummary>* frames,
746 FrameSummary::Mode mode = FrameSummary::kExactSummary) const; 755 FrameSummary::Mode mode = FrameSummary::kExactSummary) const;
747 756
748 // Accessors. 757 // Accessors.
749 virtual JSFunction* function() const; 758 virtual JSFunction* function() const;
750 virtual Object* receiver() const; 759 Object* receiver() const override;
760 Object* context() const override;
761 Script* script() const override;
751 762
752 inline void set_receiver(Object* value); 763 inline void set_receiver(Object* value);
753 764
754 // Access the parameters. 765 // Access the parameters.
755 inline Address GetParameterSlot(int index) const; 766 inline Address GetParameterSlot(int index) const;
756 inline Object* GetParameter(int index) const; 767 Object* GetParameter(int index) const override;
757 inline int ComputeParametersCount() const { 768 int ComputeParametersCount() const override;
758 return GetNumberOfIncomingArguments();
759 }
760 769
761 // Access the operand stack. 770 // Access the operand stack.
762 inline Address GetOperandSlot(int index) const; 771 inline Address GetOperandSlot(int index) const;
763 inline Object* GetOperand(int index) const; 772 inline Object* GetOperand(int index) const;
764 inline int ComputeOperandsCount() const; 773 inline int ComputeOperandsCount() const;
765 774
766 // Generator support to preserve operand stack. 775 // Generator support to preserve operand stack.
767 void SaveOperandStack(FixedArray* store) const; 776 void SaveOperandStack(FixedArray* store) const;
768 777
769 // Debugger access. 778 // Debugger access.
770 void SetParameterValue(int index, Object* value) const; 779 void SetParameterValue(int index, Object* value) const;
771 780
772 // Check if this frame is a constructor frame invoked through 'new'. 781 // Check if this frame is a constructor frame invoked through 'new'.
773 bool IsConstructor() const; 782 bool IsConstructor() const override;
774 783
775 // Determines whether this frame includes inlined activations. To get details 784 // Determines whether this frame includes inlined activations. To get details
776 // about the inlined frames use {GetFunctions} and {Summarize}. 785 // about the inlined frames use {GetFunctions} and {Summarize}.
777 bool HasInlinedFrames() const; 786 bool HasInlinedFrames() const;
778 787
779 // Check if this frame has "adapted" arguments in the sense that the 788 // Check if this frame has "adapted" arguments in the sense that the
780 // actual passed arguments are available in an arguments adaptor 789 // actual passed arguments are available in an arguments adaptor
781 // frame below it on the stack. 790 // frame below it on the stack.
782 inline bool has_adapted_arguments() const; 791 inline bool has_adapted_arguments() const;
783 int GetArgumentsLength() const; 792 int GetArgumentsLength() const;
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 // GC support. 1003 // GC support.
995 void Iterate(ObjectVisitor* v) const override; 1004 void Iterate(ObjectVisitor* v) const override;
996 1005
997 // Printing support. 1006 // Printing support.
998 void Print(StringStream* accumulator, PrintMode mode, 1007 void Print(StringStream* accumulator, PrintMode mode,
999 int index) const override; 1008 int index) const override;
1000 1009
1001 // Determine the code for the frame. 1010 // Determine the code for the frame.
1002 Code* unchecked_code() const override; 1011 Code* unchecked_code() const override;
1003 1012
1004 Object* wasm_obj(); 1013 // Accessors.
1005 uint32_t function_index(); 1014 Object* wasm_obj() const;
1015 uint32_t function_index() const;
1016 Script* script() const override;
1006 1017
1007 static WasmFrame* cast(StackFrame* frame) { 1018 static WasmFrame* cast(StackFrame* frame) {
1008 DCHECK(frame->is_wasm()); 1019 DCHECK(frame->is_wasm());
1009 return static_cast<WasmFrame*>(frame); 1020 return static_cast<WasmFrame*>(frame);
1010 } 1021 }
1011 1022
1012 protected: 1023 protected:
1013 inline explicit WasmFrame(StackFrameIteratorBase* iterator); 1024 inline explicit WasmFrame(StackFrameIteratorBase* iterator);
1014 1025
1015 Address GetCallerStackPointer() const override; 1026 Address GetCallerStackPointer() const override;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 private: 1196 private:
1186 StackFrameIterator iterator_; 1197 StackFrameIterator iterator_;
1187 }; 1198 };
1188 1199
1189 // NOTE: The stack trace frame iterator is an iterator that only traverse proper 1200 // NOTE: The stack trace frame iterator is an iterator that only traverse proper
1190 // JavaScript frames that have proper JavaScript functions and WASM frames. 1201 // JavaScript frames that have proper JavaScript functions and WASM frames.
1191 // This excludes the problematic functions in runtime.js. 1202 // This excludes the problematic functions in runtime.js.
1192 class StackTraceFrameIterator BASE_EMBEDDED { 1203 class StackTraceFrameIterator BASE_EMBEDDED {
1193 public: 1204 public:
1194 explicit StackTraceFrameIterator(Isolate* isolate); 1205 explicit StackTraceFrameIterator(Isolate* isolate);
1206 StackTraceFrameIterator(Isolate* isolate, StackFrame::Id id);
1195 bool done() const { return iterator_.done(); } 1207 bool done() const { return iterator_.done(); }
1196 void Advance(); 1208 void Advance();
1197 1209
1198 inline StandardFrame* frame() const; 1210 inline StandardFrame* frame() const;
1199 1211
1200 inline bool is_javascript() const; 1212 inline bool is_javascript() const;
1201 inline bool is_wasm() const; 1213 inline bool is_wasm() const;
1202 inline JavaScriptFrame* javascript_frame() const; 1214 inline JavaScriptFrame* javascript_frame() const;
1203 inline WasmFrame* wasm_frame() const; 1215 inline WasmFrame* wasm_frame() const;
1204 1216
1217 // Advance to the frame holding the arguments for the current
1218 // frame. This only affects the current frame if it is a javascript frame and
1219 // has adapted arguments.
1220 void AdvanceToArgumentsFrame();
1221
1205 private: 1222 private:
1206 StackFrameIterator iterator_; 1223 StackFrameIterator iterator_;
1207 bool IsValidFrame(StackFrame* frame) const; 1224 bool IsValidFrame(StackFrame* frame) const;
1208 }; 1225 };
1209 1226
1210 1227
1211 class SafeStackFrameIterator: public StackFrameIteratorBase { 1228 class SafeStackFrameIterator: public StackFrameIteratorBase {
1212 public: 1229 public:
1213 SafeStackFrameIterator(Isolate* isolate, 1230 SafeStackFrameIterator(Isolate* isolate,
1214 Address fp, Address sp, 1231 Address fp, Address sp,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 1268
1252 1269
1253 // Reads all frames on the current stack and copies them into the current 1270 // Reads all frames on the current stack and copies them into the current
1254 // zone memory. 1271 // zone memory.
1255 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); 1272 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone);
1256 1273
1257 } // namespace internal 1274 } // namespace internal
1258 } // namespace v8 1275 } // namespace v8
1259 1276
1260 #endif // V8_FRAMES_H_ 1277 #endif // V8_FRAMES_H_
OLDNEW
« no previous file with comments | « src/debug/mirrors.js ('k') | src/frames.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698