#include "src/profiler/profiler-listener.h"
#include <algorithm>
#include "src/base/vector.h"
#include "src/codegen/reloc-info.h"
#include "src/codegen/source-position-table.h"
#include "src/deoptimizer/deoptimizer.h"
#include "src/handles/handles-inl.h"
#include "src/objects/code-inl.h"
#include "src/objects/code.h"
#include "src/objects/objects-inl.h"
#include "src/objects/script-inl.h"
#include "src/objects/shared-function-info-inl.h"
#include "src/objects/string-inl.h"
#include "src/profiler/cpu-profiler.h"
#include "src/profiler/profile-generator-inl.h"
#if V8_ENABLE_WEBASSEMBLY
#include "src/wasm/wasm-code-manager.h"
#endif
namespace v8 {
namespace internal {
ProfilerListener::ProfilerListener(Isolate* isolate,
CodeEventObserver* observer,
CodeEntryStorage& code_entry_storage,
WeakCodeRegistry& weak_code_registry,
CpuProfilingNamingMode naming_mode)
: … { … }
ProfilerListener::~ProfilerListener() = default;
void ProfilerListener::CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
const char* name) { … }
void ProfilerListener::CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<Name> name) { … }
void ProfilerListener::CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<SharedFunctionInfo> shared,
Handle<Name> script_name) { … }
namespace {
CodeEntry* GetOrInsertCachedEntry(
std::unordered_set<CodeEntry*, CodeEntry::Hasher, CodeEntry::Equals>*
entries,
CodeEntry* search_value, CodeEntryStorage& storage) { … }
}
void ProfilerListener::CodeCreateEvent(CodeTag tag,
Handle<AbstractCode> abstract_code,
Handle<SharedFunctionInfo> shared,
Handle<Name> script_name, int line,
int column) { … }
#if V8_ENABLE_WEBASSEMBLY
void ProfilerListener::CodeCreateEvent(CodeTag tag, const wasm::WasmCode* code,
wasm::WasmName name,
const char* source_url, int code_offset,
int script_id) { … }
#endif
void ProfilerListener::CallbackEvent(Handle<Name> name, Address entry_point) { … }
void ProfilerListener::GetterCallbackEvent(Handle<Name> name,
Address entry_point) { … }
void ProfilerListener::SetterCallbackEvent(Handle<Name> name,
Address entry_point) { … }
void ProfilerListener::RegExpCodeCreateEvent(Handle<AbstractCode> code,
Handle<String> source) { … }
void ProfilerListener::CodeMoveEvent(Tagged<InstructionStream> from,
Tagged<InstructionStream> to) { … }
void ProfilerListener::BytecodeMoveEvent(Tagged<BytecodeArray> from,
Tagged<BytecodeArray> to) { … }
void ProfilerListener::NativeContextMoveEvent(Address from, Address to) { … }
void ProfilerListener::CodeDisableOptEvent(Handle<AbstractCode> code,
Handle<SharedFunctionInfo> shared) { … }
void ProfilerListener::CodeDeoptEvent(Handle<Code> code, DeoptimizeKind kind,
Address pc, int fp_to_sp_delta) { … }
void ProfilerListener::WeakCodeClearEvent() { … }
void ProfilerListener::OnHeapObjectDeletion(CodeEntry* entry) { … }
void ProfilerListener::CodeSweepEvent() { … }
const char* ProfilerListener::GetName(base::Vector<const char> name) { … }
Tagged<Name> ProfilerListener::InferScriptName(
Tagged<Name> name, Tagged<SharedFunctionInfo> info) { … }
const char* ProfilerListener::GetFunctionName(
Tagged<SharedFunctionInfo> shared) { … }
void ProfilerListener::AttachDeoptInlinedFrames(DirectHandle<Code> code,
CodeDeoptEventRecord* rec) { … }
}
}