#include "src/execution/frames.h"
#include <cstdint>
#include <memory>
#include <optional>
#include <sstream>
#include "src/api/api-arguments.h"
#include "src/api/api-natives.h"
#include "src/base/bits.h"
#include "src/codegen/interface-descriptors.h"
#include "src/codegen/linkage-location.h"
#include "src/codegen/macro-assembler.h"
#include "src/codegen/maglev-safepoint-table.h"
#include "src/codegen/register-configuration.h"
#include "src/codegen/safepoint-table.h"
#include "src/common/globals.h"
#include "src/deoptimizer/deoptimizer.h"
#include "src/execution/arguments.h"
#include "src/execution/frame-constants.h"
#include "src/execution/frames-inl.h"
#include "src/execution/vm-state-inl.h"
#include "src/ic/ic-stats.h"
#include "src/logging/counters.h"
#include "src/objects/code.h"
#include "src/objects/slots.h"
#include "src/objects/smi.h"
#include "src/objects/visitors.h"
#include "src/roots/roots.h"
#include "src/snapshot/embedded/embedded-data-inl.h"
#include "src/strings/string-stream.h"
#include "src/zone/zone-containers.h"
#if V8_ENABLE_WEBASSEMBLY
#include "src/debug/debug-wasm-objects.h"
#include "src/wasm/serialized-signature-inl.h"
#include "src/wasm/stacks.h"
#include "src/wasm/wasm-code-manager.h"
#include "src/wasm/wasm-engine.h"
#include "src/wasm/wasm-linkage.h"
#include "src/wasm/wasm-objects-inl.h"
#if V8_ENABLE_DRUMBRAKE
#include "src/wasm/interpreter/wasm-interpreter-runtime.h"
#endif
#endif
namespace v8 {
namespace internal {
ReturnAddressLocationResolver StackFrame::return_address_location_resolver_ = …;
namespace {
Address AddressOf(const StackHandler* handler) { … }
}
class StackHandlerIterator { … };
StackFrameIteratorBase::StackFrameIteratorBase(Isolate* isolate)
: … { … }
StackFrameIterator::StackFrameIterator(Isolate* isolate)
: … { … }
StackFrameIterator::StackFrameIterator(Isolate* isolate, ThreadLocalTop* t)
: … { … }
#if V8_ENABLE_WEBASSEMBLY
StackFrameIterator::StackFrameIterator(Isolate* isolate,
wasm::StackMemory* stack)
: … { … }
#endif
void StackFrameIterator::Advance() { … }
StackFrame* StackFrameIterator::Reframe() { … }
namespace {
StackFrame::Type GetStateForFastCCallCallerFP(Isolate* isolate, Address fp,
Address pc, Address pc_address,
StackFrame::State* state) { … }
}
void StackFrameIterator::Reset(ThreadLocalTop* top) { … }
#if V8_ENABLE_WEBASSEMBLY
void StackFrameIterator::Reset(ThreadLocalTop* top, wasm::StackMemory* stack) { … }
#endif
void StackFrameIteratorBase::SetNewFrame(StackFrame::Type type,
StackFrame::State* state) { … }
void StackFrameIteratorBase::SetNewFrame(StackFrame::Type type) { … }
void TypedFrameWithJSLinkage::Iterate(RootVisitor* v) const { … }
void ConstructFrame::Iterate(RootVisitor* v) const { … }
void JavaScriptStackFrameIterator::Advance() { … }
DebuggableStackFrameIterator::DebuggableStackFrameIterator(Isolate* isolate)
: … { … }
DebuggableStackFrameIterator::DebuggableStackFrameIterator(Isolate* isolate,
StackFrameId id)
: … { … }
void DebuggableStackFrameIterator::Advance() { … }
int DebuggableStackFrameIterator::FrameFunctionCount() const { … }
FrameSummary DebuggableStackFrameIterator::GetTopValidFrame() const { … }
bool DebuggableStackFrameIterator::IsValidFrame(StackFrame* frame) { … }
namespace {
std::optional<bool> IsInterpreterFramePc(Isolate* isolate, Address pc,
StackFrame::State* state) { … }
}
bool StackFrameIteratorForProfiler::IsNoFrameBytecodeHandlerPc(
Isolate* isolate, Address pc, Address fp) const { … }
StackFrameIteratorForProfiler::StackFrameIteratorForProfiler(
Isolate* isolate, Address pc, Address fp, Address sp, Address lr,
Address js_entry_sp)
: … { … }
bool StackFrameIteratorForProfiler::IsValidTop(ThreadLocalTop* top) const { … }
void StackFrameIteratorForProfiler::AdvanceOneFrame() { … }
bool StackFrameIteratorForProfiler::IsValidState(
const StackFrame::State& state) const { … }
bool StackFrameIteratorForProfiler::HasValidExitIfEntryFrame(
const StackFrame* frame) const { … }
bool StackFrameIteratorForProfiler::IsValidExitFrame(Address fp) const { … }
void StackFrameIteratorForProfiler::Advance() { … }
StackFrameIteratorForProfilerForTesting::
StackFrameIteratorForProfilerForTesting(Isolate* isolate, Address pc,
Address fp, Address sp, Address lr,
Address js_entry_sp)
: … { … }
void StackFrameIteratorForProfilerForTesting::Advance() { … }
namespace {
std::optional<Tagged<GcSafeCode>> GetContainingCode(Isolate* isolate,
Address pc) { … }
}
Tagged<GcSafeCode> StackFrame::GcSafeLookupCode() const { … }
Tagged<Code> StackFrame::LookupCode() const { … }
void StackFrame::IteratePc(RootVisitor* v, Address* constant_pool_address,
Tagged<GcSafeCode> holder) const { … }
void StackFrame::SetReturnAddressLocationResolver(
ReturnAddressLocationResolver resolver) { … }
namespace {
StackFrame::Type ComputeBuiltinFrameType(Tagged<GcSafeCode> code) { … }
StackFrame::Type SafeStackFrameType(StackFrame::Type candidate) { … }
}
StackFrame::Type StackFrameIterator::ComputeStackFrameType(
StackFrame::State* state) const { … }
StackFrame::Type StackFrameIteratorForProfiler::ComputeStackFrameType(
StackFrame::State* state) const { … }
StackFrame::Type StackFrame::GetCallerState(State* state) const { … }
Address CommonFrame::GetCallerStackPointer() const { … }
void NativeFrame::ComputeCallerState(State* state) const { … }
Tagged<HeapObject> EntryFrame::unchecked_code() const { … }
void EntryFrame::ComputeCallerState(State* state) const { … }
StackFrame::Type EntryFrame::GetCallerState(State* state) const { … }
#if V8_ENABLE_WEBASSEMBLY
StackFrame::Type CWasmEntryFrame::GetCallerState(State* state) const { … }
#if V8_ENABLE_DRUMBRAKE
void CWasmEntryFrame::Iterate(RootVisitor* v) const {
if (!v8_flags.wasm_jitless) {
StubFrame::Iterate(v);
}
}
#endif
#endif
Tagged<HeapObject> ConstructEntryFrame::unchecked_code() const { … }
void ExitFrame::ComputeCallerState(State* state) const { … }
void ExitFrame::Iterate(RootVisitor* v) const { … }
StackFrame::Type ExitFrame::GetStateForFramePointer(Address fp, State* state) { … }
StackFrame::Type ExitFrame::ComputeFrameType(Address fp) { … }
Address ExitFrame::ComputeStackPointer(Address fp) { … }
#if V8_ENABLE_WEBASSEMBLY
Address WasmExitFrame::ComputeStackPointer(Address fp) { … }
#endif
void ExitFrame::FillState(Address fp, Address sp, State* state) { … }
void BuiltinExitFrame::Summarize(std::vector<FrameSummary>* frames) const { … }
Tagged<JSFunction> BuiltinExitFrame::function() const { … }
Tagged<Object> BuiltinExitFrame::receiver() const { … }
Tagged<Object> BuiltinExitFrame::GetParameter(int i) const { … }
int BuiltinExitFrame::ComputeParametersCount() const { … }
Handle<FixedArray> BuiltinExitFrame::GetParameters() const { … }
bool BuiltinExitFrame::IsConstructor() const { … }
namespace ensure_layout {
FC;
FCA;
static_assert …;
static_assert(FC::kFunctionCallbackInfoReturnValueIndex ==
FCA::kReturnValueIndex);
static_assert …;
static_assert …;
static_assert …;
}
Handle<JSFunction> ApiCallbackExitFrame::GetFunction() const { … }
Handle<FunctionTemplateInfo> ApiCallbackExitFrame::GetFunctionTemplateInfo()
const { … }
Handle<FixedArray> ApiCallbackExitFrame::GetParameters() const { … }
void ApiCallbackExitFrame::Summarize(std::vector<FrameSummary>* frames) const { … }
static_assert …;
static_assert(
ApiAccessorExitFrameConstants::kPropertyCallbackInfoReturnValueIndex ==
PropertyCallbackArguments::kReturnValueIndex);
static_assert …;
static_assert …;
static_assert …;
void ApiAccessorExitFrame::Summarize(std::vector<FrameSummary>* frames) const { … }
namespace {
void PrintIndex(StringStream* accumulator, StackFrame::PrintMode mode,
int index) { … }
const char* StringForStackFrameType(StackFrame::Type type) { … }
}
void StackFrame::Print(StringStream* accumulator, PrintMode mode,
int index) const { … }
void BuiltinExitFrame::Print(StringStream* accumulator, PrintMode mode,
int index) const { … }
void ApiCallbackExitFrame::Print(StringStream* accumulator, PrintMode mode,
int index) const { … }
void ApiAccessorExitFrame::Print(StringStream* accumulator, PrintMode mode,
int index) const { … }
Address CommonFrame::GetExpressionAddress(int n) const { … }
Address UnoptimizedFrame::GetExpressionAddress(int n) const { … }
Tagged<Object> CommonFrame::context() const { … }
int CommonFrame::position() const { … }
int CommonFrame::ComputeExpressionsCount() const { … }
void CommonFrame::ComputeCallerState(State* state) const { … }
void CommonFrame::Summarize(std::vector<FrameSummary>* functions) const { … }
namespace {
void VisitSpillSlot(Isolate* isolate, RootVisitor* v,
FullObjectSlot spill_slot) { … }
void VisitSpillSlots(Isolate* isolate, RootVisitor* v,
FullObjectSlot first_slot_offset,
base::Vector<const uint8_t> tagged_slots) { … }
SafepointEntry GetSafepointEntryFromCodeCache(
Isolate* isolate, Address inner_pointer,
InnerPointerToCodeCache::InnerPointerToCodeCacheEntry* entry) { … }
MaglevSafepointEntry GetMaglevSafepointEntryFromCodeCache(
Isolate* isolate, Address inner_pointer,
InnerPointerToCodeCache::InnerPointerToCodeCacheEntry* entry) { … }
}
#ifdef V8_ENABLE_WEBASSEMBLY
#if V8_ENABLE_DRUMBRAKE
class DrumBrakeWasmCode {
public:
explicit DrumBrakeWasmCode(wasm::WasmCode* wasm_code)
: wasm_code_(wasm_code) {}
static std::unique_ptr<DrumBrakeWasmCode> Interpreted() {
return std::make_unique<DrumBrakeWasmCode>(nullptr);
}
static std::unique_ptr<DrumBrakeWasmCode> Compiled(
wasm::WasmCode* wasm_code) {
return std::make_unique<DrumBrakeWasmCode>(wasm_code);
}
bool is_liftoff() const {
return wasm_code_ ? wasm_code_->is_liftoff() : false;
}
bool frame_has_feedback_slot() const {
return wasm_code_ ? wasm_code_->frame_has_feedback_slot() : false;
}
int stack_slots() const { return wasm_code_ ? wasm_code_->stack_slots() : 0; }
wasm::WasmCode::Kind kind() const {
return wasm_code_ ? wasm_code_->kind() : wasm::WasmCode::kInterpreterEntry;
}
uint16_t first_tagged_parameter_slot() const {
return wasm_code_ ? wasm_code_->first_tagged_parameter_slot() : 0;
}
uint16_t num_tagged_parameter_slots() const {
return wasm_code_ ? wasm_code_->num_tagged_parameter_slots() : 0;
}
private:
const wasm::WasmCode* wasm_code_;
};
#endif
void WasmFrame::Iterate(RootVisitor* v) const { … }
void TypedFrame::IterateParamsOfGenericWasmToJSWrapper(RootVisitor* v) const { … }
void TypedFrame::IterateParamsOfOptimizedWasmToJSWrapper(RootVisitor* v) const { … }
#endif
void TypedFrame::Iterate(RootVisitor* v) const { … }
void MaglevFrame::Iterate(RootVisitor* v) const { … }
Handle<JSFunction> MaglevFrame::GetInnermostFunction() const { … }
BytecodeOffset MaglevFrame::GetBytecodeOffsetForOSR() const { … }
bool CommonFrame::HasTaggedOutgoingParams(
Tagged<GcSafeCode> code_lookup) const { … }
Tagged<HeapObject> TurbofanStubWithContextFrame::unchecked_code() const { … }
void CommonFrame::IterateTurbofanOptimizedFrame(RootVisitor* v) const { … }
void TurbofanStubWithContextFrame::Iterate(RootVisitor* v) const { … }
void TurbofanFrame::Iterate(RootVisitor* v) const { … }
Tagged<HeapObject> StubFrame::unchecked_code() const { … }
int StubFrame::LookupExceptionHandlerInTable() { … }
void StubFrame::Summarize(std::vector<FrameSummary>* frames) const { … }
void JavaScriptFrame::SetParameterValue(int index, Tagged<Object> value) const { … }
bool JavaScriptFrame::IsConstructor() const { … }
Tagged<HeapObject> CommonFrameWithJSLinkage::unchecked_code() const { … }
int TurbofanFrame::ComputeParametersCount() const { … }
Address JavaScriptFrame::GetCallerStackPointer() const { … }
void JavaScriptFrame::GetFunctions(
std::vector<Tagged<SharedFunctionInfo>>* functions) const { … }
void JavaScriptFrame::GetFunctions(
std::vector<Handle<SharedFunctionInfo>>* functions) const { … }
bool CommonFrameWithJSLinkage::IsConstructor() const { … }
void CommonFrameWithJSLinkage::Summarize(
std::vector<FrameSummary>* functions) const { … }
Tagged<JSFunction> JavaScriptFrame::function() const { … }
Tagged<Object> JavaScriptFrame::unchecked_function() const { … }
Tagged<Object> CommonFrameWithJSLinkage::receiver() const { … }
Tagged<Object> JavaScriptFrame::context() const { … }
Tagged<Script> JavaScriptFrame::script() const { … }
int CommonFrameWithJSLinkage::LookupExceptionHandlerInTable(
int* stack_depth, HandlerTable::CatchPrediction* prediction) { … }
void JavaScriptFrame::PrintFunctionAndOffset(Isolate* isolate,
Tagged<JSFunction> function,
Tagged<AbstractCode> code,
int code_offset, FILE* file,
bool print_line_number) { … }
void JavaScriptFrame::PrintTop(Isolate* isolate, FILE* file, bool print_args,
bool print_line_number) { … }
void JavaScriptFrame::CollectFunctionAndOffsetForICStats(
Isolate* isolate, Tagged<JSFunction> function, Tagged<AbstractCode> code,
int code_offset) { … }
Tagged<Object> CommonFrameWithJSLinkage::GetParameter(int index) const { … }
int CommonFrameWithJSLinkage::ComputeParametersCount() const { … }
int JavaScriptFrame::GetActualArgumentCount() const { … }
Handle<FixedArray> CommonFrameWithJSLinkage::GetParameters() const { … }
Tagged<JSFunction> JavaScriptBuiltinContinuationFrame::function() const { … }
int JavaScriptBuiltinContinuationFrame::ComputeParametersCount() const { … }
intptr_t JavaScriptBuiltinContinuationFrame::GetSPToFPDelta() const { … }
Tagged<Object> JavaScriptBuiltinContinuationFrame::context() const { … }
void JavaScriptBuiltinContinuationWithCatchFrame::SetException(
Tagged<Object> exception) { … }
FrameSummary::JavaScriptFrameSummary::JavaScriptFrameSummary(
Isolate* isolate, Tagged<Object> receiver, Tagged<JSFunction> function,
Tagged<AbstractCode> abstract_code, int code_offset, bool is_constructor,
Tagged<FixedArray> parameters)
: … { … }
void FrameSummary::EnsureSourcePositionsAvailable() { … }
bool FrameSummary::AreSourcePositionsAvailable() const { … }
void FrameSummary::JavaScriptFrameSummary::EnsureSourcePositionsAvailable() { … }
bool FrameSummary::JavaScriptFrameSummary::AreSourcePositionsAvailable() const { … }
bool FrameSummary::JavaScriptFrameSummary::is_subject_to_debugging() const { … }
int FrameSummary::JavaScriptFrameSummary::SourcePosition() const { … }
int FrameSummary::JavaScriptFrameSummary::SourceStatementPosition() const { … }
Handle<Object> FrameSummary::JavaScriptFrameSummary::script() const { … }
Handle<Context> FrameSummary::JavaScriptFrameSummary::native_context() const { … }
Handle<StackFrameInfo>
FrameSummary::JavaScriptFrameSummary::CreateStackFrameInfo() const { … }
#if V8_ENABLE_WEBASSEMBLY
FrameSummary::WasmFrameSummary::WasmFrameSummary(
Isolate* isolate, Handle<WasmTrustedInstanceData> instance_data,
wasm::WasmCode* code, int byte_offset, int function_index,
bool at_to_number_conversion)
: … { … }
Handle<Object> FrameSummary::WasmFrameSummary::receiver() const { … }
uint32_t FrameSummary::WasmFrameSummary::function_index() const { … }
int FrameSummary::WasmFrameSummary::SourcePosition() const { … }
Handle<Script> FrameSummary::WasmFrameSummary::script() const { … }
Handle<WasmInstanceObject> FrameSummary::WasmFrameSummary::wasm_instance()
const { … }
Handle<Context> FrameSummary::WasmFrameSummary::native_context() const { … }
Handle<StackFrameInfo> FrameSummary::WasmFrameSummary::CreateStackFrameInfo()
const { … }
FrameSummary::WasmInlinedFrameSummary::WasmInlinedFrameSummary(
Isolate* isolate, Handle<WasmTrustedInstanceData> instance_data,
int function_index, int op_wire_bytes_offset)
: … { … }
Handle<WasmInstanceObject>
FrameSummary::WasmInlinedFrameSummary::wasm_instance() const { … }
Handle<Object> FrameSummary::WasmInlinedFrameSummary::receiver() const { … }
uint32_t FrameSummary::WasmInlinedFrameSummary::function_index() const { … }
int FrameSummary::WasmInlinedFrameSummary::SourcePosition() const { … }
Handle<Script> FrameSummary::WasmInlinedFrameSummary::script() const { … }
Handle<Context> FrameSummary::WasmInlinedFrameSummary::native_context() const { … }
Handle<StackFrameInfo>
FrameSummary::WasmInlinedFrameSummary::CreateStackFrameInfo() const { … }
#if V8_ENABLE_DRUMBRAKE
FrameSummary::WasmInterpretedFrameSummary::WasmInterpretedFrameSummary(
Isolate* isolate, Handle<WasmInstanceObject> instance,
uint32_t function_index, int byte_offset)
: FrameSummaryBase(isolate, WASM_INTERPRETED),
wasm_instance_(instance),
function_index_(function_index),
byte_offset_(byte_offset) {}
Handle<Object> FrameSummary::WasmInterpretedFrameSummary::receiver() const {
return wasm_instance_->GetIsolate()->global_proxy();
}
int FrameSummary::WasmInterpretedFrameSummary::SourcePosition() const {
const wasm::WasmModule* module = wasm_instance()->module_object()->module();
return GetSourcePosition(module, function_index(), byte_offset(),
false );
}
Handle<WasmTrustedInstanceData>
FrameSummary::WasmInterpretedFrameSummary::instance_data() const {
return handle(wasm_instance_->trusted_data(isolate()), isolate());
}
Handle<Script> FrameSummary::WasmInterpretedFrameSummary::script() const {
return handle(wasm_instance()->module_object()->script(),
wasm_instance()->GetIsolate());
}
Handle<Context> FrameSummary::WasmInterpretedFrameSummary::native_context()
const {
return handle(wasm_instance_->trusted_data(isolate())->native_context(),
isolate());
}
Handle<StackFrameInfo>
FrameSummary::WasmInterpretedFrameSummary::CreateStackFrameInfo() const {
Handle<String> function_name =
GetWasmFunctionDebugName(isolate(), instance_data(), function_index());
return isolate()->factory()->NewStackFrameInfo(script(), SourcePosition(),
function_name, false);
}
#endif
FrameSummary::BuiltinFrameSummary::BuiltinFrameSummary(Isolate* isolate,
Builtin builtin)
: … { … }
Handle<Object> FrameSummary::BuiltinFrameSummary::receiver() const { … }
Handle<Object> FrameSummary::BuiltinFrameSummary::script() const { … }
Handle<Context> FrameSummary::BuiltinFrameSummary::native_context() const { … }
Handle<StackFrameInfo> FrameSummary::BuiltinFrameSummary::CreateStackFrameInfo()
const { … }
#endif
FrameSummary::~FrameSummary() { … }
FrameSummary FrameSummary::GetTop(const CommonFrame* frame) { … }
FrameSummary FrameSummary::GetBottom(const CommonFrame* frame) { … }
FrameSummary FrameSummary::GetSingle(const CommonFrame* frame) { … }
FrameSummary FrameSummary::Get(const CommonFrame* frame, int index) { … }
#if V8_ENABLE_WEBASSEMBLY
#ifdef V8_ENABLE_DRUMBRAKE
#define CASE_WASM_INTERPRETED …
#else
#define CASE_WASM_INTERPRETED …
#endif
#define FRAME_SUMMARY_DISPATCH …
#else
#define FRAME_SUMMARY_DISPATCH …
#endif
FRAME_SUMMARY_DISPATCH
FRAME_SUMMARY_DISPATCH
FRAME_SUMMARY_DISPATCH
FRAME_SUMMARY_DISPATCH
FRAME_SUMMARY_DISPATCH
FRAME_SUMMARY_DISPATCH
FRAME_SUMMARY_DISPATCH
FRAME_SUMMARY_DISPATCH
FRAME_SUMMARY_DISPATCH
#undef CASE_WASM_INTERPRETED
#undef FRAME_SUMMARY_DISPATCH
void OptimizedFrame::Summarize(std::vector<FrameSummary>* frames) const { … }
int OptimizedFrame::LookupExceptionHandlerInTable(
int* data, HandlerTable::CatchPrediction* prediction) { … }
int MaglevFrame::FindReturnPCForTrampoline(Tagged<Code> code,
int trampoline_pc) const { … }
int TurbofanFrame::FindReturnPCForTrampoline(Tagged<Code> code,
int trampoline_pc) const { … }
Tagged<DeoptimizationData> OptimizedFrame::GetDeoptimizationData(
Tagged<Code> code, int* deopt_index) const { … }
void OptimizedFrame::GetFunctions(
std::vector<Tagged<SharedFunctionInfo>>* functions) const { … }
int OptimizedFrame::StackSlotOffsetRelativeToFp(int slot_index) { … }
int UnoptimizedFrame::position() const { … }
int UnoptimizedFrame::LookupExceptionHandlerInTable(
int* context_register, HandlerTable::CatchPrediction* prediction) { … }
Tagged<BytecodeArray> UnoptimizedFrame::GetBytecodeArray() const { … }
Tagged<Object> UnoptimizedFrame::ReadInterpreterRegister(
int register_index) const { … }
void UnoptimizedFrame::Summarize(std::vector<FrameSummary>* functions) const { … }
int InterpretedFrame::GetBytecodeOffset() const { … }
int InterpretedFrame::GetBytecodeOffset(Address fp) { … }
void InterpretedFrame::PatchBytecodeOffset(int new_offset) { … }
void InterpretedFrame::PatchBytecodeArray(
Tagged<BytecodeArray> bytecode_array) { … }
int BaselineFrame::GetBytecodeOffset() const { … }
intptr_t BaselineFrame::GetPCForBytecodeOffset(int bytecode_offset) const { … }
void BaselineFrame::PatchContext(Tagged<Context> value) { … }
Tagged<JSFunction> BuiltinFrame::function() const { … }
int BuiltinFrame::ComputeParametersCount() const { … }
#if V8_ENABLE_WEBASSEMBLY
void WasmFrame::Print(StringStream* accumulator, PrintMode mode,
int index) const { … }
wasm::WasmCode* WasmFrame::wasm_code() const { … }
Tagged<WasmInstanceObject> WasmFrame::wasm_instance() const { … }
Tagged<WasmTrustedInstanceData> WasmFrame::trusted_instance_data() const { … }
wasm::NativeModule* WasmFrame::native_module() const { … }
Tagged<WasmModuleObject> WasmFrame::module_object() const { … }
int WasmFrame::function_index() const { … }
Tagged<Script> WasmFrame::script() const { … }
int WasmFrame::position() const { … }
int WasmFrame::generated_code_offset() const { … }
bool WasmFrame::is_inspectable() const { … }
Tagged<Object> WasmFrame::context() const { … }
void WasmFrame::Summarize(std::vector<FrameSummary>* functions) const { … }
bool WasmFrame::at_to_number_conversion() const { … }
int WasmFrame::LookupExceptionHandlerInTable() { … }
void WasmDebugBreakFrame::Iterate(RootVisitor* v) const { … }
void WasmDebugBreakFrame::Print(StringStream* accumulator, PrintMode mode,
int index) const { … }
Tagged<WasmInstanceObject> WasmToJsFrame::wasm_instance() const { … }
Tagged<WasmTrustedInstanceData> WasmToJsFrame::trusted_instance_data() const { … }
void JsToWasmFrame::Iterate(RootVisitor* v) const { … }
#if V8_ENABLE_DRUMBRAKE
void WasmToJsFrame::Iterate(RootVisitor* v) const {
if (v8_flags.wasm_jitless) {
CHECK(v8_flags.jitless);
intptr_t scan_count = *reinterpret_cast<intptr_t*>(
fp() + WasmToJSInterpreterFrameConstants::kGCScanSlotCountOffset);
Address original_sp = *reinterpret_cast<Address*>(
fp() + WasmToJSInterpreterFrameConstants::kGCSPOffset);
if (original_sp == 0) original_sp = sp();
if (sp() != original_sp) {
FullObjectSlot additional_spill_slot_base(&Memory<Address>(sp()));
FullObjectSlot additional_spill_slot_limit(original_sp);
v->VisitRootPointers(Root::kStackRoots, nullptr,
additional_spill_slot_base,
additional_spill_slot_limit);
}
FullObjectSlot spill_slot_base(&Memory<Address>(original_sp));
FullObjectSlot spill_slot_limit(
&Memory<Address>(original_sp + scan_count * kSystemPointerSize));
v->VisitRootPointers(Root::kStackRoots, nullptr, spill_slot_base,
spill_slot_limit);
return;
}
WasmFrame::Iterate(v);
}
#endif
void StackSwitchFrame::Iterate(RootVisitor* v) const { … }
#if V8_ENABLE_DRUMBRAKE
void WasmInterpreterEntryFrame::Iterate(RootVisitor* v) const {
static constexpr int kWasmInstanceObjOffset = -2 * kSystemPointerSize;
FullObjectSlot slot_base(&Memory<Address>(fp() + kWasmInstanceObjOffset));
FullObjectSlot slot_limit(
&Memory<Address>(fp() + kWasmInstanceObjOffset + kSystemPointerSize));
v->VisitRootPointers(Root::kStackRoots, nullptr, slot_base, slot_limit);
}
void WasmInterpreterEntryFrame::Print(StringStream* accumulator, PrintMode mode,
int index) const {
PrintIndex(accumulator, mode, index);
accumulator->Add("WASM INTERPRETER ENTRY [");
Tagged<Script> script = this->script();
accumulator->PrintName(script->name());
accumulator->Add("]");
if (mode != OVERVIEW) accumulator->Add("\n");
}
void WasmInterpreterEntryFrame::Summarize(
std::vector<FrameSummary>* functions) const {
Handle<WasmInstanceObject> instance(wasm_instance(), isolate());
std::vector<WasmInterpreterStackEntry> interpreted_stack =
WasmInterpreterObject::GetInterpretedStack(
trusted_instance_data()->interpreter_object(), fp());
for (auto& e : interpreted_stack) {
FrameSummary::WasmInterpretedFrameSummary summary(
isolate(), instance, e.function_index, e.byte_offset);
functions->push_back(summary);
}
}
Tagged<HeapObject> WasmInterpreterEntryFrame::unchecked_code() const {
return InstructionStream();
}
Tagged<WasmInstanceObject> WasmInterpreterEntryFrame::wasm_instance() const {
Tagged<Object> instance(Memory<Address>(
fp() + WasmInterpreterFrameConstants::kWasmInstanceObjectOffset));
return Cast<WasmInstanceObject>(instance);
}
Tagged<WasmTrustedInstanceData>
WasmInterpreterEntryFrame::trusted_instance_data() const {
return wasm_instance()->trusted_data(isolate());
}
Tagged<Tuple2> WasmInterpreterEntryFrame::interpreter_object() const {
return trusted_instance_data()->interpreter_object();
}
Tagged<WasmModuleObject> WasmInterpreterEntryFrame::module_object() const {
return trusted_instance_data()->module_object();
}
int WasmInterpreterEntryFrame::function_index(
int inlined_function_index) const {
return WasmInterpreterObject::GetFunctionIndex(
trusted_instance_data()->interpreter_object(), fp(),
inlined_function_index);
}
int WasmInterpreterEntryFrame::position() const {
return FrameSummary::GetBottom(this).AsWasmInterpreted().SourcePosition();
}
Tagged<Object> WasmInterpreterEntryFrame::context() const {
return trusted_instance_data()->native_context();
}
Address WasmInterpreterEntryFrame::GetCallerStackPointer() const {
return fp() + CommonFrameConstants::kCallerSPOffset;
}
#endif
void StackSwitchFrame::GetStateForJumpBuffer(wasm::JumpBuffer* jmpbuf,
State* state) { … }
int WasmLiftoffSetupFrame::GetDeclaredFunctionIndex() const { … }
wasm::NativeModule* WasmLiftoffSetupFrame::GetNativeModule() const { … }
FullObjectSlot WasmLiftoffSetupFrame::wasm_instance_data_slot() const { … }
void WasmLiftoffSetupFrame::Iterate(RootVisitor* v) const { … }
#endif
namespace {
void PrintFunctionSource(StringStream* accumulator,
Tagged<SharedFunctionInfo> shared) { … }
}
void JavaScriptFrame::Print(StringStream* accumulator, PrintMode mode,
int index) const { … }
void EntryFrame::Iterate(RootVisitor* v) const { … }
void CommonFrame::IterateExpressions(RootVisitor* v) const { … }
void JavaScriptFrame::Iterate(RootVisitor* v) const { … }
void InternalFrame::Iterate(RootVisitor* v) const { … }
namespace {
uint32_t PcAddressForHashing(Isolate* isolate, Address address) { … }
}
InnerPointerToCodeCache::InnerPointerToCodeCacheEntry*
InnerPointerToCodeCache::GetCacheEntry(Address inner_pointer) { … }
namespace {
constexpr int TopOfStackRegisterPaddingSlots() { … }
bool BuiltinContinuationModeIsWithCatch(BuiltinContinuationMode mode) { … }
}
UnoptimizedFrameInfo::UnoptimizedFrameInfo(int parameters_count_with_receiver,
int translation_height,
bool is_topmost, bool pad_arguments,
FrameInfoKind frame_info_kind) { … }
uint32_t UnoptimizedFrameInfo::GetStackSizeForAdditionalArguments(
int parameters_count) { … }
ConstructStubFrameInfo::ConstructStubFrameInfo(int translation_height,
bool is_topmost,
FrameInfoKind frame_info_kind) { … }
FastConstructStubFrameInfo::FastConstructStubFrameInfo(bool is_topmost) { … }
BuiltinContinuationFrameInfo::BuiltinContinuationFrameInfo(
int translation_height,
const CallInterfaceDescriptor& continuation_descriptor,
const RegisterConfiguration* register_config, bool is_topmost,
DeoptimizeKind deopt_kind, BuiltinContinuationMode continuation_mode,
FrameInfoKind frame_info_kind) { … }
}
}