| 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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 Handle<AbstractCode> abstract_code_; | 664 Handle<AbstractCode> abstract_code_; |
| 665 int code_offset_; | 665 int code_offset_; |
| 666 bool is_constructor_; | 666 bool is_constructor_; |
| 667 }; | 667 }; |
| 668 | 668 |
| 669 class StandardFrame : public StackFrame { | 669 class StandardFrame : public StackFrame { |
| 670 public: | 670 public: |
| 671 // Testers. | 671 // Testers. |
| 672 bool is_standard() const override { return true; } | 672 bool is_standard() const override { return true; } |
| 673 | 673 |
| 674 // Accessors. | |
| 675 inline Object* context() const; | |
| 676 | |
| 677 // Access the expressions in the stack frame including locals. | 674 // Access the expressions in the stack frame including locals. |
| 678 inline Object* GetExpression(int index) const; | 675 inline Object* GetExpression(int index) const; |
| 679 inline void SetExpression(int index, Object* value); | 676 inline void SetExpression(int index, Object* value); |
| 680 int ComputeExpressionsCount() const; | 677 int ComputeExpressionsCount() const; |
| 681 | 678 |
| 682 void SetCallerFp(Address caller_fp) override; | 679 void SetCallerFp(Address caller_fp) override; |
| 683 | 680 |
| 684 static StandardFrame* cast(StackFrame* frame) { | 681 static StandardFrame* cast(StackFrame* frame) { |
| 685 DCHECK(frame->is_standard()); | 682 DCHECK(frame->is_standard()); |
| 686 return static_cast<StandardFrame*>(frame); | 683 return static_cast<StandardFrame*>(frame); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 Type type() const override { return JAVA_SCRIPT; } | 728 Type type() const override { return JAVA_SCRIPT; } |
| 732 | 729 |
| 733 // Build a list with summaries for this frame including all inlined frames. | 730 // Build a list with summaries for this frame including all inlined frames. |
| 734 virtual void Summarize( | 731 virtual void Summarize( |
| 735 List<FrameSummary>* frames, | 732 List<FrameSummary>* frames, |
| 736 FrameSummary::Mode mode = FrameSummary::kExactSummary) const; | 733 FrameSummary::Mode mode = FrameSummary::kExactSummary) const; |
| 737 | 734 |
| 738 // Accessors. | 735 // Accessors. |
| 739 virtual JSFunction* function() const; | 736 virtual JSFunction* function() const; |
| 740 virtual Object* receiver() const; | 737 virtual Object* receiver() const; |
| 738 inline Object* context() const; |
| 741 | 739 |
| 742 inline void set_receiver(Object* value); | 740 inline void set_receiver(Object* value); |
| 743 | 741 |
| 744 // Access the parameters. | 742 // Access the parameters. |
| 745 inline Address GetParameterSlot(int index) const; | 743 inline Address GetParameterSlot(int index) const; |
| 746 inline Object* GetParameter(int index) const; | 744 inline Object* GetParameter(int index) const; |
| 747 inline int ComputeParametersCount() const { | 745 inline int ComputeParametersCount() const { |
| 748 return GetNumberOfIncomingArguments(); | 746 return GetNumberOfIncomingArguments(); |
| 749 } | 747 } |
| 750 | 748 |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 // GC support. | 961 // GC support. |
| 964 void Iterate(ObjectVisitor* v) const override; | 962 void Iterate(ObjectVisitor* v) const override; |
| 965 | 963 |
| 966 // Printing support. | 964 // Printing support. |
| 967 void Print(StringStream* accumulator, PrintMode mode, | 965 void Print(StringStream* accumulator, PrintMode mode, |
| 968 int index) const override; | 966 int index) const override; |
| 969 | 967 |
| 970 // Determine the code for the frame. | 968 // Determine the code for the frame. |
| 971 Code* unchecked_code() const override; | 969 Code* unchecked_code() const override; |
| 972 | 970 |
| 973 Object* wasm_obj(); | 971 // Accessors. |
| 974 uint32_t function_index(); | 972 Object* wasm_obj() const; |
| 973 uint32_t function_index() const; |
| 975 | 974 |
| 976 static WasmFrame* cast(StackFrame* frame) { | 975 static WasmFrame* cast(StackFrame* frame) { |
| 977 DCHECK(frame->is_wasm()); | 976 DCHECK(frame->is_wasm()); |
| 978 return static_cast<WasmFrame*>(frame); | 977 return static_cast<WasmFrame*>(frame); |
| 979 } | 978 } |
| 980 | 979 |
| 981 protected: | 980 protected: |
| 982 inline explicit WasmFrame(StackFrameIteratorBase* iterator); | 981 inline explicit WasmFrame(StackFrameIteratorBase* iterator); |
| 983 | 982 |
| 984 Address GetCallerStackPointer() const override; | 983 Address GetCallerStackPointer() const override; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 private: | 1153 private: |
| 1155 StackFrameIterator iterator_; | 1154 StackFrameIterator iterator_; |
| 1156 }; | 1155 }; |
| 1157 | 1156 |
| 1158 // NOTE: The stack trace frame iterator is an iterator that only traverse proper | 1157 // NOTE: The stack trace frame iterator is an iterator that only traverse proper |
| 1159 // JavaScript frames that have proper JavaScript functions and WASM frames. | 1158 // JavaScript frames that have proper JavaScript functions and WASM frames. |
| 1160 // This excludes the problematic functions in runtime.js. | 1159 // This excludes the problematic functions in runtime.js. |
| 1161 class StackTraceFrameIterator BASE_EMBEDDED { | 1160 class StackTraceFrameIterator BASE_EMBEDDED { |
| 1162 public: | 1161 public: |
| 1163 explicit StackTraceFrameIterator(Isolate* isolate); | 1162 explicit StackTraceFrameIterator(Isolate* isolate); |
| 1163 StackTraceFrameIterator(Isolate* isolate, StackFrame::Id id); |
| 1164 bool done() const { return iterator_.done(); } | 1164 bool done() const { return iterator_.done(); } |
| 1165 void Advance(); | 1165 void Advance(); |
| 1166 | 1166 |
| 1167 inline StandardFrame* frame() const; | 1167 inline StandardFrame* frame() const; |
| 1168 | 1168 |
| 1169 inline bool is_javascript() const; | 1169 inline bool is_javascript() const; |
| 1170 inline bool is_wasm() const; | 1170 inline bool is_wasm() const; |
| 1171 inline JavaScriptFrame* javascript_frame() const; | 1171 inline JavaScriptFrame* javascript_frame() const; |
| 1172 inline WasmFrame* wasm_frame() const; | 1172 inline WasmFrame* wasm_frame() const; |
| 1173 | 1173 |
| 1174 // Advance to the frame holding the arguments for the current |
| 1175 // frame. This only affects the current frame if it is a javascript frame and |
| 1176 // has adapted arguments. |
| 1177 void AdvanceToArgumentsFrame(); |
| 1178 |
| 1174 private: | 1179 private: |
| 1175 StackFrameIterator iterator_; | 1180 StackFrameIterator iterator_; |
| 1176 bool IsValidFrame(StackFrame* frame) const; | 1181 bool IsValidFrame(StackFrame* frame) const; |
| 1177 }; | 1182 }; |
| 1178 | 1183 |
| 1179 | 1184 |
| 1180 class SafeStackFrameIterator: public StackFrameIteratorBase { | 1185 class SafeStackFrameIterator: public StackFrameIteratorBase { |
| 1181 public: | 1186 public: |
| 1182 SafeStackFrameIterator(Isolate* isolate, | 1187 SafeStackFrameIterator(Isolate* isolate, |
| 1183 Address fp, Address sp, | 1188 Address fp, Address sp, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1220 | 1225 |
| 1221 | 1226 |
| 1222 // Reads all frames on the current stack and copies them into the current | 1227 // Reads all frames on the current stack and copies them into the current |
| 1223 // zone memory. | 1228 // zone memory. |
| 1224 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); | 1229 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); |
| 1225 | 1230 |
| 1226 } // namespace internal | 1231 } // namespace internal |
| 1227 } // namespace v8 | 1232 } // namespace v8 |
| 1228 | 1233 |
| 1229 #endif // V8_FRAMES_H_ | 1234 #endif // V8_FRAMES_H_ |
| OLD | NEW |