// Copyright 2015 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "src/debug/debug-frames.h" #include "src/frames-inl.h" namespace v8 { namespace internal { FrameInspector::FrameInspector(StandardFrame* frame, int inlined_jsframe_index, Isolate* isolate) : frame_(frame), deoptimized_frame_(NULL), isolate_(isolate) { JavaScriptFrame* js_frame = frame->is_java_script() ? javascript_frame() : nullptr; DCHECK(js_frame || frame->is_wasm()); has_adapted_arguments_ = js_frame && js_frame->has_adapted_arguments(); is_bottommost_ = inlined_jsframe_index == 0; is_optimized_ = frame_->is_optimized(); is_interpreted_ = frame_->is_interpreted(); // Calculate the deoptimized frame. if (frame->is_optimized()) { DCHECK(js_frame != nullptr); // TODO(turbofan): Revisit once we support deoptimization. if (js_frame->LookupCode()->is_turbofanned() && js_frame->function()->shared()->asm_function() && !FLAG_turbo_asm_deoptimization) { is_optimized_ = false; return; } deoptimized_frame_ = Deoptimizer::DebuggerInspectableFrame( js_frame, inlined_jsframe_index, isolate); } } FrameInspector::~FrameInspector() { // Get rid of the calculated deoptimized frame if any. if (deoptimized_frame_ != nullptr) { delete deoptimized_frame_; } } int FrameInspector::GetParametersCount() { return is_optimized_ ? deoptimized_frame_->parameters_count() : frame_->ComputeParametersCount(); } Handle