| 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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 enum PrintMode { OVERVIEW, DETAILS }; | 555 enum PrintMode { OVERVIEW, DETAILS }; |
| 556 virtual void Print(StringStream* accumulator, | 556 virtual void Print(StringStream* accumulator, |
| 557 PrintMode mode, | 557 PrintMode mode, |
| 558 int index) const { } | 558 int index) const { } |
| 559 | 559 |
| 560 Isolate* isolate() const { return isolate_; } | 560 Isolate* isolate() const { return isolate_; } |
| 561 | 561 |
| 562 void operator=(const StackFrame& original) = delete; | 562 void operator=(const StackFrame& original) = delete; |
| 563 | 563 |
| 564 protected: | 564 protected: |
| 565 const StackFrameIteratorBase* iterator_; |
| 566 |
| 565 inline explicit StackFrame(StackFrameIteratorBase* iterator); | 567 inline explicit StackFrame(StackFrameIteratorBase* iterator); |
| 566 virtual ~StackFrame() { } | 568 virtual ~StackFrame() { } |
| 567 | 569 |
| 568 // Compute the stack pointer for the calling frame. | 570 // Compute the stack pointer for the calling frame. |
| 569 virtual Address GetCallerStackPointer() const = 0; | 571 virtual Address GetCallerStackPointer() const = 0; |
| 570 | 572 |
| 571 // Printing support. | 573 // Printing support. |
| 572 static void PrintIndex(StringStream* accumulator, | 574 static void PrintIndex(StringStream* accumulator, |
| 573 PrintMode mode, | 575 PrintMode mode, |
| 574 int index); | 576 int index); |
| 575 | 577 |
| 576 // Compute the stack frame type for the given state. | 578 // Compute the stack frame type for the given state. |
| 577 static Type ComputeType(const StackFrameIteratorBase* iterator, State* state); | 579 static Type ComputeType(const StackFrameIteratorBase* iterator, State* state); |
| 578 | 580 |
| 579 #ifdef DEBUG | 581 #ifdef DEBUG |
| 580 bool can_access_heap_objects() const; | 582 bool can_access_heap_objects() const; |
| 581 #endif | 583 #endif |
| 582 | 584 |
| 583 private: | 585 private: |
| 584 const StackFrameIteratorBase* iterator_; | |
| 585 Isolate* isolate_; | 586 Isolate* isolate_; |
| 586 State state_; | 587 State state_; |
| 587 | 588 |
| 588 static ReturnAddressLocationResolver return_address_location_resolver_; | 589 static ReturnAddressLocationResolver return_address_location_resolver_; |
| 589 | 590 |
| 590 // Fill in the state of the calling frame. | 591 // Fill in the state of the calling frame. |
| 591 virtual void ComputeCallerState(State* state) const = 0; | 592 virtual void ComputeCallerState(State* state) const = 0; |
| 592 | 593 |
| 593 // Get the type and the state of the calling frame. | 594 // Get the type and the state of the calling frame. |
| 594 virtual Type GetCallerState(State* state) const; | 595 virtual Type GetCallerState(State* state) const; |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 int LookupExceptionHandlerInTable(int* data); | 1100 int LookupExceptionHandlerInTable(int* data); |
| 1100 | 1101 |
| 1101 // Determine the code for the frame. | 1102 // Determine the code for the frame. |
| 1102 Code* unchecked_code() const override; | 1103 Code* unchecked_code() const override; |
| 1103 | 1104 |
| 1104 // Accessors. | 1105 // Accessors. |
| 1105 Object* wasm_instance() const; | 1106 Object* wasm_instance() const; |
| 1106 uint32_t function_index() const; | 1107 uint32_t function_index() const; |
| 1107 Script* script() const override; | 1108 Script* script() const override; |
| 1108 int position() const override; | 1109 int position() const override; |
| 1110 bool at_to_number_conversion() const; |
| 1109 | 1111 |
| 1110 static WasmFrame* cast(StackFrame* frame) { | 1112 static WasmFrame* cast(StackFrame* frame) { |
| 1111 DCHECK(frame->is_wasm()); | 1113 DCHECK(frame->is_wasm()); |
| 1112 return static_cast<WasmFrame*>(frame); | 1114 return static_cast<WasmFrame*>(frame); |
| 1113 } | 1115 } |
| 1114 | 1116 |
| 1115 protected: | 1117 protected: |
| 1116 inline explicit WasmFrame(StackFrameIteratorBase* iterator); | 1118 inline explicit WasmFrame(StackFrameIteratorBase* iterator); |
| 1117 | 1119 |
| 1118 Address GetCallerStackPointer() const override; | 1120 Address GetCallerStackPointer() const override; |
| 1119 | 1121 |
| 1120 private: | 1122 private: |
| 1121 friend class StackFrameIteratorBase; | 1123 friend class StackFrameIteratorBase; |
| 1122 }; | 1124 }; |
| 1123 | 1125 |
| 1124 class WasmToJsFrame : public StubFrame { | 1126 class WasmToJsFrame : public StubFrame { |
| 1125 public: | 1127 public: |
| 1126 Type type() const override { return WASM_TO_JS; } | 1128 Type type() const override { return WASM_TO_JS; } |
| 1127 | 1129 |
| 1128 protected: | 1130 protected: |
| 1129 inline explicit WasmToJsFrame(StackFrameIteratorBase* iterator); | 1131 inline explicit WasmToJsFrame(StackFrameIteratorBase* iterator); |
| 1130 | 1132 |
| 1131 private: | 1133 private: |
| 1134 void ComputeCallerState(State* state) const override; |
| 1135 |
| 1132 friend class StackFrameIteratorBase; | 1136 friend class StackFrameIteratorBase; |
| 1133 }; | 1137 }; |
| 1134 | 1138 |
| 1135 class JsToWasmFrame : public StubFrame { | 1139 class JsToWasmFrame : public StubFrame { |
| 1136 public: | 1140 public: |
| 1137 Type type() const override { return JS_TO_WASM; } | 1141 Type type() const override { return JS_TO_WASM; } |
| 1138 | 1142 |
| 1139 protected: | 1143 protected: |
| 1140 inline explicit JsToWasmFrame(StackFrameIteratorBase* iterator); | 1144 inline explicit JsToWasmFrame(StackFrameIteratorBase* iterator); |
| 1141 | 1145 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1360 | 1364 |
| 1361 | 1365 |
| 1362 // Reads all frames on the current stack and copies them into the current | 1366 // Reads all frames on the current stack and copies them into the current |
| 1363 // zone memory. | 1367 // zone memory. |
| 1364 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); | 1368 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); |
| 1365 | 1369 |
| 1366 } // namespace internal | 1370 } // namespace internal |
| 1367 } // namespace v8 | 1371 } // namespace v8 |
| 1368 | 1372 |
| 1369 #endif // V8_FRAMES_H_ | 1373 #endif // V8_FRAMES_H_ |
| OLD | NEW |