OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef V8_DEBUG_DEBUG_FRAMES_H_ |
| 6 #define V8_DEBUG_DEBUG_FRAMES_H_ |
| 7 |
| 8 #include "src/deoptimizer.h" |
| 9 #include "src/frames.h" |
| 10 #include "src/isolate.h" |
| 11 #include "src/objects.h" |
| 12 |
| 13 namespace v8 { |
| 14 namespace internal { |
| 15 |
| 16 class FrameInspector { |
| 17 public: |
| 18 FrameInspector(JavaScriptFrame* frame, int inlined_jsframe_index, |
| 19 Isolate* isolate); |
| 20 |
| 21 ~FrameInspector(); |
| 22 |
| 23 int GetParametersCount(); |
| 24 int expression_count(); |
| 25 Object* GetFunction(); |
| 26 Object* GetParameter(int index); |
| 27 Object* GetExpression(int index); |
| 28 int GetSourcePosition(); |
| 29 bool IsConstructor(); |
| 30 Object* GetContext(); |
| 31 |
| 32 JavaScriptFrame* GetArgumentsFrame() { return frame_; } |
| 33 void SetArgumentsFrame(JavaScriptFrame* frame); |
| 34 |
| 35 void MaterializeStackLocals(Handle<JSObject> target, |
| 36 Handle<ScopeInfo> scope_info); |
| 37 |
| 38 void MaterializeStackLocals(Handle<JSObject> target, |
| 39 Handle<JSFunction> function); |
| 40 |
| 41 void UpdateStackLocalsFromMaterializedObject(Handle<JSObject> object, |
| 42 Handle<ScopeInfo> scope_info); |
| 43 |
| 44 private: |
| 45 bool ParameterIsShadowedByContextLocal(Handle<ScopeInfo> info, |
| 46 Handle<String> parameter_name); |
| 47 |
| 48 JavaScriptFrame* frame_; |
| 49 DeoptimizedFrameInfo* deoptimized_frame_; |
| 50 Isolate* isolate_; |
| 51 bool is_optimized_; |
| 52 bool is_bottommost_; |
| 53 bool has_adapted_arguments_; |
| 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(FrameInspector); |
| 56 }; |
| 57 |
| 58 |
| 59 class DebugFrameHelper : public AllStatic { |
| 60 public: |
| 61 static SaveContext* FindSavedContextForFrame(Isolate* isolate, |
| 62 JavaScriptFrame* frame); |
| 63 // 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. |
| 65 static int FindIndexedNonNativeFrame(JavaScriptFrameIterator* it, int index); |
| 66 |
| 67 // Helper functions for wrapping and unwrapping stack frame ids. |
| 68 static Smi* WrapFrameId(StackFrame::Id id) { |
| 69 DCHECK(IsAligned(OffsetFrom(id), static_cast<intptr_t>(4))); |
| 70 return Smi::FromInt(id >> 2); |
| 71 } |
| 72 |
| 73 static StackFrame::Id UnwrapFrameId(int wrapped) { |
| 74 return static_cast<StackFrame::Id>(wrapped << 2); |
| 75 } |
| 76 }; |
| 77 |
| 78 } // namespace internal |
| 79 } // namespace v8 |
| 80 |
| 81 #endif // V8_DEBUG_DEBUG_FRAMES_H_ |
OLD | NEW |