#include "src/tracing/perfetto-logger.h"
#include <memory>
#include "absl/container/flat_hash_map.h"
#include "protos/perfetto/common/builtin_clock.pbzero.h"
#include "protos/perfetto/trace/chrome/v8.pbzero.h"
#include "protos/perfetto/trace/trace_packet.pbzero.h"
#include "protos/perfetto/trace/trace_packet_defaults.pbzero.h"
#include "src/base/logging.h"
#include "src/base/platform/mutex.h"
#include "src/base/platform/platform.h"
#include "src/base/platform/time.h"
#include "src/builtins/builtins.h"
#include "src/execution/isolate.h"
#include "src/handles/handles.h"
#include "src/heap/spaces.h"
#include "src/logging/log.h"
#include "src/objects/abstract-code.h"
#include "src/objects/code-kind.h"
#include "src/objects/heap-object.h"
#include "src/objects/objects-inl.h"
#include "src/objects/oddball.h"
#include "src/objects/script.h"
#include "src/objects/string.h"
#include "src/objects/tagged.h"
#include "src/tracing/code-data-source.h"
#include "src/tracing/code-trace-context.h"
#include "src/tracing/perfetto-utils.h"
namespace v8 {
namespace internal {
namespace {
BuiltinClock;
TracePacket;
V8InternalCode;
V8JsCode;
CodeDataSource::TraceContext::TracePacketHandle NewTracePacket(
CodeDataSource::TraceContext& context) { … }
CodeTraceContext NewCodeTraceContext(CodeDataSource::TraceContext& ctx) { … }
class IsolateRegistry { … };
void WriteJsCode(const CodeTraceContext& ctx,
Tagged<AbstractCode> abstract_code, V8JsCode& code_proto) { … }
}
void PerfettoLogger::RegisterIsolate(Isolate* isolate) { … }
void PerfettoLogger::UnregisterIsolate(Isolate* isolate) { … }
void PerfettoLogger::OnCodeDataSourceStart() { … }
void PerfettoLogger::OnCodeDataSourceStop() { … }
void PerfettoLogger::LogExistingCode() { … }
PerfettoLogger::PerfettoLogger(Isolate* isolate) : … { … }
PerfettoLogger::~PerfettoLogger() { … }
void PerfettoLogger::CodeCreateEvent(CodeTag tag,
Handle<AbstractCode> abstract_code,
const char* name) { … }
void PerfettoLogger::CodeCreateEvent(CodeTag tag,
Handle<AbstractCode> abstract_code,
Handle<Name> name) { … }
void PerfettoLogger::CodeCreateEvent(CodeTag tag,
Handle<AbstractCode> abstract_code,
Handle<SharedFunctionInfo> info,
Handle<Name> script_name) { … }
void PerfettoLogger::CodeCreateEvent(CodeTag tag,
Handle<AbstractCode> abstract_code,
Handle<SharedFunctionInfo> info,
Handle<Name> script_name, int line,
int column) { … }
#if V8_ENABLE_WEBASSEMBLY
void PerfettoLogger::CodeCreateEvent(CodeTag tag, const wasm::WasmCode* code,
wasm::WasmName name,
const char* source_url, int code_offset,
int script_id) { … }
#endif
void PerfettoLogger::CallbackEvent(Handle<Name> name, Address entry_point) { … }
void PerfettoLogger::GetterCallbackEvent(Handle<Name> name,
Address entry_point) { … }
void PerfettoLogger::SetterCallbackEvent(Handle<Name> name,
Address entry_point) { … }
void PerfettoLogger::RegExpCodeCreateEvent(Handle<AbstractCode> abstract_code,
Handle<String> pattern) { … }
void PerfettoLogger::CodeMoveEvent(Tagged<InstructionStream> from,
Tagged<InstructionStream> to) { … }
void PerfettoLogger::BytecodeMoveEvent(Tagged<BytecodeArray> from,
Tagged<BytecodeArray> to) { … }
void PerfettoLogger::SharedFunctionInfoMoveEvent(Address from, Address to) { … }
void PerfettoLogger::NativeContextMoveEvent(Address from, Address to) { … }
void PerfettoLogger::CodeMovingGCEvent() { … }
void PerfettoLogger::CodeDisableOptEvent(Handle<AbstractCode> code,
Handle<SharedFunctionInfo> shared) { … }
void PerfettoLogger::CodeDeoptEvent(Handle<Code> code, DeoptimizeKind kind,
Address pc, int fp_to_sp_delta) { … }
void PerfettoLogger::CodeDependencyChangeEvent(
Handle<Code> code, Handle<SharedFunctionInfo> shared, const char* reason) { … }
void PerfettoLogger::WeakCodeClearEvent() { … }
bool PerfettoLogger::is_listening_to_code_events() { … }
}
}