5 #include "src/debug/debug-frames.h" 7 #include "src/accessors.h" 8 #include "src/frames-inl.h" 9 #include "src/wasm/wasm-interpreter.h" 10 #include "src/wasm/wasm-objects-inl.h" 15 FrameInspector::FrameInspector(StandardFrame* frame,
int inlined_frame_index,
18 inlined_frame_index_(inlined_frame_index),
21 FrameSummary summary = FrameSummary::Get(frame, inlined_frame_index);
23 is_constructor_ = summary.is_constructor();
24 source_position_ = summary.SourcePosition();
25 function_name_ = summary.FunctionName();
26 script_ = Handle<Script>::cast(summary.script());
27 receiver_ = summary.receiver();
29 if (summary.IsJavaScript()) {
30 function_ = summary.AsJavaScript().function();
33 JavaScriptFrame* js_frame =
34 frame->is_java_script() ? javascript_frame() : nullptr;
35 DCHECK(js_frame || frame->is_wasm());
36 has_adapted_arguments_ = js_frame && js_frame->has_adapted_arguments();
37 is_optimized_ = frame_->is_optimized();
38 is_interpreted_ = frame_->is_interpreted();
42 DCHECK_NOT_NULL(js_frame);
43 deoptimized_frame_.reset(Deoptimizer::DebuggerInspectableFrame(
44 js_frame, inlined_frame_index, isolate));
45 }
else if (frame_->is_wasm_interpreter_entry()) {
46 wasm_interpreted_frame_ =
47 WasmInterpreterEntryFrame::cast(frame_)
49 ->GetInterpretedFrame(frame_->fp(), inlined_frame_index);
50 DCHECK(wasm_interpreted_frame_);
55 FrameInspector::~FrameInspector() {
60 int FrameInspector::GetParametersCount() {
61 if (is_optimized_)
return deoptimized_frame_->parameters_count();
62 if (wasm_interpreted_frame_)
63 return wasm_interpreted_frame_->GetParameterCount();
64 return frame_->ComputeParametersCount();
67 Handle<Object> FrameInspector::GetParameter(
int index) {
68 if (is_optimized_)
return deoptimized_frame_->GetParameter(index);
70 return handle(frame_->GetParameter(index), isolate_);
73 Handle<Object> FrameInspector::GetExpression(
int index) {
74 return is_optimized_ ? deoptimized_frame_->GetExpression(index)
75 : handle(frame_->GetExpression(index), isolate_);
78 Handle<Object> FrameInspector::GetContext() {
79 return deoptimized_frame_ ? deoptimized_frame_->GetContext()
80 : handle(frame_->context(), isolate_);
83 bool FrameInspector::IsWasm() {
return frame_->is_wasm(); }
85 bool FrameInspector::IsJavaScript() {
return frame_->is_java_script(); }
87 bool FrameInspector::ParameterIsShadowedByContextLocal(
88 Handle<ScopeInfo> info, Handle<String> parameter_name) {
90 InitializationFlag init_flag;
91 MaybeAssignedFlag maybe_assigned_flag;
92 return ScopeInfo::ContextSlotIndex(info, parameter_name, &mode, &init_flag,
93 &maybe_assigned_flag) != -1;