28#ifndef V8_DIAGNOSTICS_PERF_JIT_H_
29#define V8_DIAGNOSTICS_PERF_JIT_H_
42class LinuxPerfJitLogger :
public CodeEventLogger {
44 explicit LinuxPerfJitLogger(Isolate* isolate);
45 ~LinuxPerfJitLogger()
override;
47 void CodeMoveEvent(Tagged<InstructionStream> from,
48 Tagged<InstructionStream> to)
override {
51 void BytecodeMoveEvent(Tagged<BytecodeArray> from,
52 Tagged<BytecodeArray> to)
override {}
53 void CodeDisableOptEvent(DirectHandle<AbstractCode> code,
54 DirectHandle<SharedFunctionInfo> shared)
override {}
57 void OpenJitDumpFile();
58 void CloseJitDumpFile();
59 void* OpenMarkerFile(
int fd);
60 void CloseMarkerFile(
void* marker_address);
62 uint64_t GetTimestamp();
63 void LogRecordedBuffer(Tagged<AbstractCode> code,
64 MaybeDirectHandle<SharedFunctionInfo> maybe_shared,
65 const char* name,
size_t length)
override;
66#if V8_ENABLE_WEBASSEMBLY
67 void LogRecordedBuffer(
const wasm::WasmCode* code,
const char* name,
68 size_t length)
override;
72 static const char kFilenameFormatString[];
73 static const int kFilenameBufferPadding;
77 static const int kLogBufferSize = 2 *
MB;
79 void WriteJitCodeLoadEntry(
const uint8_t* code_pointer, uint32_t code_size,
80 const char* name,
size_t name_length);
82 void LogWriteBytes(
const char* bytes,
size_t size);
83 void LogWriteHeader();
84 void LogWriteDebugInfo(Tagged<Code> code,
85 DirectHandle<SharedFunctionInfo> shared);
86#if V8_ENABLE_WEBASSEMBLY
87 void LogWriteDebugInfo(
const wasm::WasmCode* code);
89 void LogWriteUnwindingInfo(Tagged<Code> code);
91 static const uint32_t kElfMachIA32 = 3;
92 static const uint32_t kElfMachX64 = 62;
93 static const uint32_t kElfMachARM = 40;
94 static const uint32_t kElfMachMIPS64 = 8;
95 static const uint32_t kElfMachLOONG64 = 258;
96 static const uint32_t kElfMachARM64 = 183;
97 static const uint32_t kElfMachS390x = 22;
98 static const uint32_t kElfMachPPC64 = 21;
99 static const uint32_t kElfMachRISCV = 243;
101 uint32_t GetElfMach() {
102#if V8_TARGET_ARCH_IA32
104#elif V8_TARGET_ARCH_X64
106#elif V8_TARGET_ARCH_ARM
108#elif V8_TARGET_ARCH_MIPS64
109 return kElfMachMIPS64;
110#elif V8_TARGET_ARCH_LOONG64
111 return kElfMachLOONG64;
112#elif V8_TARGET_ARCH_ARM64
113 return kElfMachARM64;
114#elif V8_TARGET_ARCH_S390X
115 return kElfMachS390x;
116#elif V8_TARGET_ARCH_PPC64
117 return kElfMachPPC64;
118#elif V8_TARGET_ARCH_RISCV32 || V8_TARGET_ARCH_RISCV64
119 return kElfMachRISCV;
126#if V8_TARGET_ARCH_32_BIT
127 static const int kElfHeaderSize = 0x34;
128#elif V8_TARGET_ARCH_64_BIT
129 static const int kElfHeaderSize = 0x40;
131#error Unknown target architecture pointer size
136 static FILE* perf_output_handle_;
137 static uint64_t reference_count_;
138 static void* marker_address_;
139 static uint64_t code_index_;
140 static int process_id_;
too high values may cause the compiler to set high thresholds for inlining to as much as possible avoid inlined allocation of objects that cannot escape trace load stores from virtual maglev objects use TurboFan fast string builder analyze liveness of environment slots and zap dead values trace TurboFan load elimination emit data about basic block usage in builtins to this enable builtin reordering when run mksnapshot flag for emit warnings when applying builtin profile data verify register allocation in TurboFan randomly schedule instructions to stress dependency tracking enable store store elimination in TurboFan rewrite far to near simulate GC compiler thread race related to allow float parameters to be passed in simulator mode JS Wasm Run additional turbo_optimize_inlined_js_wasm_wrappers enable experimental feedback collection in generic lowering enable Turboshaft s WasmLoadElimination enable Turboshaft s low level load elimination for JS enable Turboshaft s escape analysis for string concatenation use enable Turbolev features that we want to ship in the not too far future trace individual Turboshaft reduction steps trace intermediate Turboshaft reduction steps invocation count threshold for early optimization Enables optimizations which favor memory size over execution speed Enables sampling allocation profiler with X as a sample interval min size of a semi the new space consists of two semi spaces max size of the Collect garbage after Collect garbage after keeps maps alive for< n > old space garbage collections print one detailed trace line in allocation gc speed threshold for starting incremental marking via a task in percent of available threshold for starting incremental marking immediately in percent of available Use a single schedule for determining a marking schedule between JS and C objects schedules the minor GC task with kUserVisible priority max worker number of concurrent for NumberOfWorkerThreads start background threads that allocate memory concurrent_array_buffer_sweeping use parallel threads to clear weak refs in the atomic pause trace progress of the incremental marking trace object counts and memory usage * MB