| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 static const int kFrameSize = | 172 static const int kFrameSize = |
| 173 StandardFrameConstants::kFixedFrameSize + 4 * kPointerSize; | 173 StandardFrameConstants::kFixedFrameSize + 4 * kPointerSize; |
| 174 }; | 174 }; |
| 175 | 175 |
| 176 | 176 |
| 177 class InterpreterFrameConstants : public AllStatic { | 177 class InterpreterFrameConstants : public AllStatic { |
| 178 public: | 178 public: |
| 179 // Fixed frame includes new.target and bytecode offset. | 179 // Fixed frame includes new.target and bytecode offset. |
| 180 static const int kFixedFrameSize = | 180 static const int kFixedFrameSize = |
| 181 StandardFrameConstants::kFixedFrameSize + 2 * kPointerSize; | 181 StandardFrameConstants::kFixedFrameSize + 3 * kPointerSize; |
| 182 static const int kFixedFrameSizeFromFp = | 182 static const int kFixedFrameSizeFromFp = |
| 183 StandardFrameConstants::kFixedFrameSizeFromFp + 2 * kPointerSize; | 183 StandardFrameConstants::kFixedFrameSizeFromFp + 3 * kPointerSize; |
| 184 | 184 |
| 185 // FP-relative. | 185 // FP-relative. |
| 186 static const int kNewTargetFromFp = |
| 187 -StandardFrameConstants::kFixedFrameSizeFromFp - 1 * kPointerSize; |
| 188 static const int kDispatchTableFromFp = |
| 189 -StandardFrameConstants::kFixedFrameSizeFromFp - 2 * kPointerSize; |
| 186 static const int kBytecodeOffsetFromFp = | 190 static const int kBytecodeOffsetFromFp = |
| 187 -StandardFrameConstants::kFixedFrameSizeFromFp - 2 * kPointerSize; | 191 -StandardFrameConstants::kFixedFrameSizeFromFp - 3 * kPointerSize; |
| 188 static const int kRegisterFilePointerFromFp = | 192 static const int kRegisterFilePointerFromFp = |
| 189 -StandardFrameConstants::kFixedFrameSizeFromFp - 3 * kPointerSize; | 193 -StandardFrameConstants::kFixedFrameSizeFromFp - 4 * kPointerSize; |
| 190 | 194 |
| 191 // Expression index for {StandardFrame::GetExpressionAddress}. | 195 // Expression index for {StandardFrame::GetExpressionAddress}. |
| 192 static const int kBytecodeOffsetExpressionIndex = 1; | 196 static const int kBytecodeOffsetExpressionIndex = 2; |
| 193 static const int kRegisterFileExpressionIndex = 2; | 197 static const int kRegisterFileExpressionIndex = 3; |
| 194 | 198 |
| 195 // Register file pointer relative. | 199 // Register file pointer relative. |
| 196 static const int kLastParamFromRegisterPointer = | 200 static const int kLastParamFromRegisterPointer = |
| 197 StandardFrameConstants::kFixedFrameSize + 3 * kPointerSize; | 201 StandardFrameConstants::kFixedFrameSize + 4 * kPointerSize; |
| 198 | 202 |
| 199 static const int kBytecodeOffsetFromRegisterPointer = 1 * kPointerSize; | 203 static const int kBytecodeOffsetFromRegisterPointer = 1 * kPointerSize; |
| 200 static const int kNewTargetFromRegisterPointer = 2 * kPointerSize; | 204 static const int kDispatchTableFromRegisterPointer = 2 * kPointerSize; |
| 201 static const int kFunctionFromRegisterPointer = 3 * kPointerSize; | 205 static const int kNewTargetFromRegisterPointer = 3 * kPointerSize; |
| 202 static const int kContextFromRegisterPointer = 4 * kPointerSize; | 206 static const int kFunctionFromRegisterPointer = 4 * kPointerSize; |
| 207 static const int kContextFromRegisterPointer = 5 * kPointerSize; |
| 203 }; | 208 }; |
| 204 | 209 |
| 205 | 210 |
| 206 // Abstract base class for all stack frames. | 211 // Abstract base class for all stack frames. |
| 207 class StackFrame BASE_EMBEDDED { | 212 class StackFrame BASE_EMBEDDED { |
| 208 public: | 213 public: |
| 209 #define DECLARE_TYPE(type, ignore) type, | 214 #define DECLARE_TYPE(type, ignore) type, |
| 210 enum Type { | 215 enum Type { |
| 211 NONE = 0, | 216 NONE = 0, |
| 212 STACK_FRAME_TYPE_LIST(DECLARE_TYPE) | 217 STACK_FRAME_TYPE_LIST(DECLARE_TYPE) |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 friend class StackFrameIteratorBase; | 721 friend class StackFrameIteratorBase; |
| 717 | 722 |
| 718 Object* StackSlotAt(int index) const; | 723 Object* StackSlotAt(int index) const; |
| 719 }; | 724 }; |
| 720 | 725 |
| 721 | 726 |
| 722 class InterpretedFrame : public JavaScriptFrame { | 727 class InterpretedFrame : public JavaScriptFrame { |
| 723 public: | 728 public: |
| 724 Type type() const override { return INTERPRETED; } | 729 Type type() const override { return INTERPRETED; } |
| 725 | 730 |
| 731 // GC support. |
| 732 void Iterate(ObjectVisitor* v) const override; |
| 733 |
| 726 // Lookup exception handler for current {pc}, returns -1 if none found. | 734 // Lookup exception handler for current {pc}, returns -1 if none found. |
| 727 int LookupExceptionHandlerInTable( | 735 int LookupExceptionHandlerInTable( |
| 728 int* data, HandlerTable::CatchPrediction* prediction) override; | 736 int* data, HandlerTable::CatchPrediction* prediction) override; |
| 729 | 737 |
| 730 // Returns the current offset into the bytecode stream. | 738 // Returns the current offset into the bytecode stream. |
| 731 int GetBytecodeOffset() const; | 739 int GetBytecodeOffset() const; |
| 732 | 740 |
| 733 // Updates the current offset into the bytecode stream, mainly used for stack | 741 // Updates the current offset into the bytecode stream, mainly used for stack |
| 734 // unwinding to continue execution at a different bytecode offset. | 742 // unwinding to continue execution at a different bytecode offset. |
| 735 void PatchBytecodeOffset(int new_offset); | 743 void PatchBytecodeOffset(int new_offset); |
| 736 | 744 |
| 745 // Returns the current dispatch table pointer. |
| 746 Address GetDispatchTable() const; |
| 747 |
| 748 // Updates the current dispatch table pointer with |dispatch_table|. Used by |
| 749 // the debugger to swap execution onto the debugger dispatch table. |
| 750 void PatchDispatchTable(Address dispatch_table); |
| 751 |
| 737 // Access to the interpreter register file for this frame. | 752 // Access to the interpreter register file for this frame. |
| 738 Object* GetInterpreterRegister(int register_index) const; | 753 Object* GetInterpreterRegister(int register_index) const; |
| 739 | 754 |
| 740 // Build a list with summaries for this frame including all inlined frames. | 755 // Build a list with summaries for this frame including all inlined frames. |
| 741 void Summarize(List<FrameSummary>* frames) override; | 756 void Summarize(List<FrameSummary>* frames) override; |
| 742 | 757 |
| 743 protected: | 758 protected: |
| 744 inline explicit InterpretedFrame(StackFrameIteratorBase* iterator); | 759 inline explicit InterpretedFrame(StackFrameIteratorBase* iterator); |
| 745 | 760 |
| 746 private: | 761 private: |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 | 1007 |
| 993 | 1008 |
| 994 // Reads all frames on the current stack and copies them into the current | 1009 // Reads all frames on the current stack and copies them into the current |
| 995 // zone memory. | 1010 // zone memory. |
| 996 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); | 1011 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); |
| 997 | 1012 |
| 998 } // namespace internal | 1013 } // namespace internal |
| 999 } // namespace v8 | 1014 } // namespace v8 |
| 1000 | 1015 |
| 1001 #endif // V8_FRAMES_H_ | 1016 #endif // V8_FRAMES_H_ |
| OLD | NEW |