• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "src/wasm/wasm-interpreter.h"
13 
14 namespace v8 {
15 namespace internal {
16 
17 class FrameInspector {
18  public:
19   FrameInspector(StandardFrame* frame, int inlined_frame_index,
20                  Isolate* isolate);
21 
22   ~FrameInspector();
23 
24   int GetParametersCount();
GetFunction()25   Handle<JSFunction> GetFunction() const { return function_; }
GetScript()26   Handle<Script> GetScript() { return script_; }
27   Handle<Object> GetParameter(int index);
28   Handle<Object> GetExpression(int index);
GetSourcePosition()29   int GetSourcePosition() { return source_position_; }
IsConstructor()30   bool IsConstructor() { return is_constructor_; }
31   Handle<Object> GetContext();
GetReceiver()32   Handle<Object> GetReceiver() { return receiver_; }
33 
GetFunctionName()34   Handle<String> GetFunctionName() { return function_name_; }
35 
36   bool IsWasm();
37   bool IsJavaScript();
38 
javascript_frame()39   inline JavaScriptFrame* javascript_frame() {
40     return frame_->is_arguments_adaptor() ? ArgumentsAdaptorFrame::cast(frame_)
41                                           : JavaScriptFrame::cast(frame_);
42   }
43 
inlined_frame_index()44   int inlined_frame_index() const { return inlined_frame_index_; }
45 
46  private:
47   bool ParameterIsShadowedByContextLocal(Handle<ScopeInfo> info,
48                                          Handle<String> parameter_name);
49 
50   StandardFrame* frame_;
51   int inlined_frame_index_;
52   std::unique_ptr<DeoptimizedFrameInfo> deoptimized_frame_;
53   wasm::WasmInterpreter::FramePtr wasm_interpreted_frame_;
54   Isolate* isolate_;
55   Handle<Script> script_;
56   Handle<Object> receiver_;
57   Handle<JSFunction> function_;
58   Handle<String> function_name_;
59   int source_position_ = -1;
60   bool is_optimized_ = false;
61   bool is_interpreted_ = false;
62   bool has_adapted_arguments_ = false;
63   bool is_constructor_ = false;
64 
65   DISALLOW_COPY_AND_ASSIGN(FrameInspector);
66 };
67 }  // namespace internal
68 }  // namespace v8
69 
70 #endif  // V8_DEBUG_DEBUG_FRAMES_H_
71