| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 + 2 * kPointerSize; |
| 182 static const int kFixedFrameSizeFromFp = | 182 static const int kFixedFrameSizeFromFp = |
| 183 StandardFrameConstants::kFixedFrameSizeFromFp + 2 * kPointerSize; | 183 StandardFrameConstants::kFixedFrameSizeFromFp + 2 * kPointerSize; |
| 184 | 184 |
| 185 // FP-relative. | 185 // FP-relative. |
| 186 static const int kBytecodeOffsetFromFp = |
| 187 -StandardFrameConstants::kFixedFrameSizeFromFp - 2 * kPointerSize; |
| 186 static const int kRegisterFilePointerFromFp = | 188 static const int kRegisterFilePointerFromFp = |
| 187 -StandardFrameConstants::kFixedFrameSizeFromFp - 3 * kPointerSize; | 189 -StandardFrameConstants::kFixedFrameSizeFromFp - 3 * kPointerSize; |
| 188 | 190 |
| 191 // Expression index for {StandardFrame::GetExpressionAddress}. |
| 192 static const int kBytecodeOffsetExpressionIndex = 1; |
| 193 |
| 189 // Register file pointer relative. | 194 // Register file pointer relative. |
| 190 static const int kLastParamFromRegisterPointer = | 195 static const int kLastParamFromRegisterPointer = |
| 191 StandardFrameConstants::kFixedFrameSize + 3 * kPointerSize; | 196 StandardFrameConstants::kFixedFrameSize + 3 * kPointerSize; |
| 192 | 197 |
| 193 static const int kBytecodeOffsetFromRegisterPointer = 1 * kPointerSize; | 198 static const int kBytecodeOffsetFromRegisterPointer = 1 * kPointerSize; |
| 194 static const int kNewTargetFromRegisterPointer = 2 * kPointerSize; | 199 static const int kNewTargetFromRegisterPointer = 2 * kPointerSize; |
| 195 static const int kFunctionFromRegisterPointer = 3 * kPointerSize; | 200 static const int kFunctionFromRegisterPointer = 3 * kPointerSize; |
| 196 static const int kContextFromRegisterPointer = 4 * kPointerSize; | 201 static const int kContextFromRegisterPointer = 4 * kPointerSize; |
| 197 }; | 202 }; |
| 198 | 203 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 this->state_ = original.state_; | 247 this->state_ = original.state_; |
| 243 this->iterator_ = NULL; | 248 this->iterator_ = NULL; |
| 244 this->isolate_ = original.isolate_; | 249 this->isolate_ = original.isolate_; |
| 245 } | 250 } |
| 246 | 251 |
| 247 // Type testers. | 252 // Type testers. |
| 248 bool is_entry() const { return type() == ENTRY; } | 253 bool is_entry() const { return type() == ENTRY; } |
| 249 bool is_entry_construct() const { return type() == ENTRY_CONSTRUCT; } | 254 bool is_entry_construct() const { return type() == ENTRY_CONSTRUCT; } |
| 250 bool is_exit() const { return type() == EXIT; } | 255 bool is_exit() const { return type() == EXIT; } |
| 251 bool is_optimized() const { return type() == OPTIMIZED; } | 256 bool is_optimized() const { return type() == OPTIMIZED; } |
| 257 bool is_interpreted() const { return type() == INTERPRETED; } |
| 252 bool is_arguments_adaptor() const { return type() == ARGUMENTS_ADAPTOR; } | 258 bool is_arguments_adaptor() const { return type() == ARGUMENTS_ADAPTOR; } |
| 253 bool is_internal() const { return type() == INTERNAL; } | 259 bool is_internal() const { return type() == INTERNAL; } |
| 254 bool is_stub_failure_trampoline() const { | 260 bool is_stub_failure_trampoline() const { |
| 255 return type() == STUB_FAILURE_TRAMPOLINE; | 261 return type() == STUB_FAILURE_TRAMPOLINE; |
| 256 } | 262 } |
| 257 bool is_construct() const { return type() == CONSTRUCT; } | 263 bool is_construct() const { return type() == CONSTRUCT; } |
| 258 virtual bool is_standard() const { return false; } | 264 virtual bool is_standard() const { return false; } |
| 259 | 265 |
| 260 bool is_java_script() const { | 266 bool is_java_script() const { |
| 261 Type type = this->type(); | 267 Type type = this->type(); |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 inline explicit OptimizedFrame(StackFrameIteratorBase* iterator); | 710 inline explicit OptimizedFrame(StackFrameIteratorBase* iterator); |
| 705 | 711 |
| 706 private: | 712 private: |
| 707 friend class StackFrameIteratorBase; | 713 friend class StackFrameIteratorBase; |
| 708 | 714 |
| 709 Object* StackSlotAt(int index) const; | 715 Object* StackSlotAt(int index) const; |
| 710 }; | 716 }; |
| 711 | 717 |
| 712 | 718 |
| 713 class InterpretedFrame : public JavaScriptFrame { | 719 class InterpretedFrame : public JavaScriptFrame { |
| 720 public: |
| 714 Type type() const override { return INTERPRETED; } | 721 Type type() const override { return INTERPRETED; } |
| 715 | 722 |
| 723 // Lookup exception handler for current {pc}, returns -1 if none found. Also |
| 724 // returns the expected number of stack slots at the handler site. |
| 725 int LookupExceptionHandlerInTable( |
| 726 int* stack_slots, HandlerTable::CatchPrediction* prediction) override; |
| 727 |
| 728 // Returns the current offset into the bytecode stream. |
| 729 int GetBytecodeOffset() const; |
| 730 |
| 731 // Updates the current offset into the bytecode stream, mainly used for stack |
| 732 // unwinding to continue execution at a different bytecode offset. |
| 733 void PatchBytecodeOffset(int new_offset); |
| 734 |
| 716 protected: | 735 protected: |
| 717 inline explicit InterpretedFrame(StackFrameIteratorBase* iterator); | 736 inline explicit InterpretedFrame(StackFrameIteratorBase* iterator); |
| 718 | 737 |
| 719 private: | 738 private: |
| 720 friend class StackFrameIteratorBase; | 739 friend class StackFrameIteratorBase; |
| 721 }; | 740 }; |
| 722 | 741 |
| 723 | 742 |
| 724 // Arguments adaptor frames are automatically inserted below | 743 // Arguments adaptor frames are automatically inserted below |
| 725 // JavaScript frames when the actual number of parameters does not | 744 // JavaScript frames when the actual number of parameters does not |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 | 984 |
| 966 | 985 |
| 967 // Reads all frames on the current stack and copies them into the current | 986 // Reads all frames on the current stack and copies them into the current |
| 968 // zone memory. | 987 // zone memory. |
| 969 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); | 988 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); |
| 970 | 989 |
| 971 } // namespace internal | 990 } // namespace internal |
| 972 } // namespace v8 | 991 } // namespace v8 |
| 973 | 992 |
| 974 #endif // V8_FRAMES_H_ | 993 #endif // V8_FRAMES_H_ |
| OLD | NEW |