OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_DEBUG_DEBUG_FRAMES_H_ | 5 #ifndef V8_DEBUG_DEBUG_FRAMES_H_ |
6 #define V8_DEBUG_DEBUG_FRAMES_H_ | 6 #define V8_DEBUG_DEBUG_FRAMES_H_ |
7 | 7 |
8 #include "src/deoptimizer.h" | 8 #include "src/deoptimizer.h" |
9 #include "src/frames.h" | 9 #include "src/frames.h" |
10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
11 #include "src/objects.h" | 11 #include "src/objects.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 class FrameInspector { | 16 class FrameInspector { |
17 public: | 17 public: |
18 FrameInspector(JavaScriptFrame* frame, int inlined_jsframe_index, | 18 FrameInspector(StandardFrame* frame, int inlined_jsframe_index, |
19 Isolate* isolate); | 19 Isolate* isolate); |
20 | 20 |
21 ~FrameInspector(); | 21 ~FrameInspector(); |
22 | 22 |
23 int GetParametersCount(); | 23 int GetParametersCount(); |
24 Handle<Object> GetFunction(); | 24 Handle<JSFunction> GetFunction(); |
| 25 Handle<Script> GetScript(); |
25 Handle<Object> GetParameter(int index); | 26 Handle<Object> GetParameter(int index); |
26 Handle<Object> GetExpression(int index); | 27 Handle<Object> GetExpression(int index); |
27 int GetSourcePosition(); | 28 int GetSourcePosition(); |
28 bool IsConstructor(); | 29 bool IsConstructor(); |
29 Handle<Object> GetContext(); | 30 Handle<Object> GetContext(); |
30 | 31 |
31 JavaScriptFrame* GetArgumentsFrame() { return frame_; } | 32 inline JavaScriptFrame* javascript_frame() { |
32 void SetArgumentsFrame(JavaScriptFrame* frame); | 33 return frame_->is_arguments_adaptor() ? ArgumentsAdaptorFrame::cast(frame_) |
| 34 : JavaScriptFrame::cast(frame_); |
| 35 } |
| 36 inline WasmFrame* wasm_frame() { return WasmFrame::cast(frame_); } |
| 37 |
| 38 JavaScriptFrame* GetArgumentsFrame() { return javascript_frame(); } |
| 39 void SetArgumentsFrame(StandardFrame* frame); |
33 | 40 |
34 void MaterializeStackLocals(Handle<JSObject> target, | 41 void MaterializeStackLocals(Handle<JSObject> target, |
35 Handle<ScopeInfo> scope_info); | 42 Handle<ScopeInfo> scope_info); |
36 | 43 |
37 void MaterializeStackLocals(Handle<JSObject> target, | 44 void MaterializeStackLocals(Handle<JSObject> target, |
38 Handle<JSFunction> function); | 45 Handle<JSFunction> function); |
39 | 46 |
40 void UpdateStackLocalsFromMaterializedObject(Handle<JSObject> object, | 47 void UpdateStackLocalsFromMaterializedObject(Handle<JSObject> object, |
41 Handle<ScopeInfo> scope_info); | 48 Handle<ScopeInfo> scope_info); |
42 | 49 |
43 private: | 50 private: |
44 bool ParameterIsShadowedByContextLocal(Handle<ScopeInfo> info, | 51 bool ParameterIsShadowedByContextLocal(Handle<ScopeInfo> info, |
45 Handle<String> parameter_name); | 52 Handle<String> parameter_name); |
46 | 53 |
47 JavaScriptFrame* frame_; | 54 StandardFrame* frame_; |
48 DeoptimizedFrameInfo* deoptimized_frame_; | 55 DeoptimizedFrameInfo* deoptimized_frame_; |
49 Isolate* isolate_; | 56 Isolate* isolate_; |
50 bool is_optimized_; | 57 bool is_optimized_; |
51 bool is_interpreted_; | 58 bool is_interpreted_; |
52 bool is_bottommost_; | 59 bool is_bottommost_; |
53 bool has_adapted_arguments_; | 60 bool has_adapted_arguments_; |
54 | 61 |
55 DISALLOW_COPY_AND_ASSIGN(FrameInspector); | 62 DISALLOW_COPY_AND_ASSIGN(FrameInspector); |
56 }; | 63 }; |
57 | 64 |
58 | 65 |
59 class DebugFrameHelper : public AllStatic { | 66 class DebugFrameHelper : public AllStatic { |
60 public: | 67 public: |
61 static SaveContext* FindSavedContextForFrame(Isolate* isolate, | 68 static SaveContext* FindSavedContextForFrame(Isolate* isolate, |
62 JavaScriptFrame* frame); | 69 StandardFrame* frame); |
63 // Advances the iterator to the frame that matches the index and returns the | 70 // Advances the iterator to the frame that matches the index and returns the |
64 // inlined frame index, or -1 if not found. Skips native JS functions. | 71 // inlined frame index, or -1 if not found. Skips native JS functions. |
65 static int FindIndexedNonNativeFrame(JavaScriptFrameIterator* it, int index); | 72 static int FindIndexedNonNativeFrame(StackTraceFrameIterator* it, int index); |
66 | 73 |
67 // Helper functions for wrapping and unwrapping stack frame ids. | 74 // Helper functions for wrapping and unwrapping stack frame ids. |
68 static Smi* WrapFrameId(StackFrame::Id id) { | 75 static Smi* WrapFrameId(StackFrame::Id id) { |
69 DCHECK(IsAligned(OffsetFrom(id), static_cast<intptr_t>(4))); | 76 DCHECK(IsAligned(OffsetFrom(id), static_cast<intptr_t>(4))); |
70 return Smi::FromInt(id >> 2); | 77 return Smi::FromInt(id >> 2); |
71 } | 78 } |
72 | 79 |
73 static StackFrame::Id UnwrapFrameId(int wrapped) { | 80 static StackFrame::Id UnwrapFrameId(int wrapped) { |
74 return static_cast<StackFrame::Id>(wrapped << 2); | 81 return static_cast<StackFrame::Id>(wrapped << 2); |
75 } | 82 } |
76 }; | 83 }; |
77 | 84 |
78 } // namespace internal | 85 } // namespace internal |
79 } // namespace v8 | 86 } // namespace v8 |
80 | 87 |
81 #endif // V8_DEBUG_DEBUG_FRAMES_H_ | 88 #endif // V8_DEBUG_DEBUG_FRAMES_H_ |
OLD | NEW |