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_; | |
Michael Starzinger
2016/12/08 11:38:05
nit: AFAICT this is only made protected due to a D
Clemens Hammacher
2016/12/08 12:15:37
Sure, I just dropped the DCHECK.
| |
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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1104 int LookupExceptionHandlerInTable(int* data); | 1105 int LookupExceptionHandlerInTable(int* data); |
1105 | 1106 |
1106 // Determine the code for the frame. | 1107 // Determine the code for the frame. |
1107 Code* unchecked_code() const override; | 1108 Code* unchecked_code() const override; |
1108 | 1109 |
1109 // Accessors. | 1110 // Accessors. |
1110 Object* wasm_instance() const; | 1111 Object* wasm_instance() const; |
1111 uint32_t function_index() const; | 1112 uint32_t function_index() const; |
1112 Script* script() const override; | 1113 Script* script() const override; |
1113 int position() const override; | 1114 int position() const override; |
1115 bool at_to_number_conversion() const; | |
1114 | 1116 |
1115 static WasmFrame* cast(StackFrame* frame) { | 1117 static WasmFrame* cast(StackFrame* frame) { |
1116 DCHECK(frame->is_wasm()); | 1118 DCHECK(frame->is_wasm()); |
1117 return static_cast<WasmFrame*>(frame); | 1119 return static_cast<WasmFrame*>(frame); |
1118 } | 1120 } |
1119 | 1121 |
1120 protected: | 1122 protected: |
1121 inline explicit WasmFrame(StackFrameIteratorBase* iterator); | 1123 inline explicit WasmFrame(StackFrameIteratorBase* iterator); |
1122 | 1124 |
1123 Address GetCallerStackPointer() const override; | 1125 Address GetCallerStackPointer() const override; |
1124 | 1126 |
1125 private: | 1127 private: |
1126 friend class StackFrameIteratorBase; | 1128 friend class StackFrameIteratorBase; |
1127 }; | 1129 }; |
1128 | 1130 |
1129 class WasmToJsFrame : public StubFrame { | 1131 class WasmToJsFrame : public StubFrame { |
1130 public: | 1132 public: |
1131 Type type() const override { return WASM_TO_JS; } | 1133 Type type() const override { return WASM_TO_JS; } |
1132 | 1134 |
1133 protected: | 1135 protected: |
1134 inline explicit WasmToJsFrame(StackFrameIteratorBase* iterator); | 1136 inline explicit WasmToJsFrame(StackFrameIteratorBase* iterator); |
1135 | 1137 |
1136 private: | 1138 private: |
1139 void ComputeCallerState(State* state) const override; | |
1140 | |
1137 friend class StackFrameIteratorBase; | 1141 friend class StackFrameIteratorBase; |
1138 }; | 1142 }; |
1139 | 1143 |
1140 class JsToWasmFrame : public StubFrame { | 1144 class JsToWasmFrame : public StubFrame { |
1141 public: | 1145 public: |
1142 Type type() const override { return JS_TO_WASM; } | 1146 Type type() const override { return JS_TO_WASM; } |
1143 | 1147 |
1144 protected: | 1148 protected: |
1145 inline explicit JsToWasmFrame(StackFrameIteratorBase* iterator); | 1149 inline explicit JsToWasmFrame(StackFrameIteratorBase* iterator); |
1146 | 1150 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1365 | 1369 |
1366 | 1370 |
1367 // Reads all frames on the current stack and copies them into the current | 1371 // Reads all frames on the current stack and copies them into the current |
1368 // zone memory. | 1372 // zone memory. |
1369 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); | 1373 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); |
1370 | 1374 |
1371 } // namespace internal | 1375 } // namespace internal |
1372 } // namespace v8 | 1376 } // namespace v8 |
1373 | 1377 |
1374 #endif // V8_FRAMES_H_ | 1378 #endif // V8_FRAMES_H_ |
OLD | NEW |