53#ifdef ENABLE_GDB_JIT_INTERFACE
57#if V8_ENABLE_WEBASSEMBLY
64#if defined(V8_ENABLE_ETW_STACK_WALKING)
72#define DECLARE_EVENT(ignore1, name) name,
77#define DECLARE_EVENT(ignore1, name) #name,
83 os << kCodeTagNames[static_cast<int>(tag)];
87 os << kLogEventsNames[static_cast<int>(event)];
95 case LogEventListener::CodeTag::kLength:
98 case LogEventListener::CodeTag::kBuiltin:
99 return v8::CodeEventType::kBuiltinType;
100 case LogEventListener::CodeTag::kCallback:
101 return v8::CodeEventType::kCallbackType;
102 case LogEventListener::CodeTag::kEval:
103 return v8::CodeEventType::kEvalType;
104 case LogEventListener::CodeTag::kNativeFunction:
105 case LogEventListener::CodeTag::kFunction:
106 return v8::CodeEventType::kFunctionType;
107 case LogEventListener::CodeTag::kHandler:
108 return v8::CodeEventType::kHandlerType;
109 case LogEventListener::CodeTag::kBytecodeHandler:
110 return v8::CodeEventType::kBytecodeHandlerType;
111 case LogEventListener::CodeTag::kRegExp:
112 return v8::CodeEventType::kRegExpType;
113 case LogEventListener::CodeTag::kNativeScript:
114 case LogEventListener::CodeTag::kScript:
115 return v8::CodeEventType::kScriptType;
116 case LogEventListener::CodeTag::kStub:
117 return v8::CodeEventType::kStubType;
122#define CALL_CODE_EVENT_HANDLER(Call) \
126 PROFILE(isolate_, Call); \
135 if (
v8_flags.interpreted_frames_native_stack &&
kind == CodeKind::BUILTIN &&
136 code->has_instruction_stream(cage_base) &&
137 code->builtin_id(cage_base) == Builtin::kInterpreterEntryTrampoline) {
138 kind = CodeKind::INTERPRETED_FUNCTION;
140 if (shared->optimization_disabled() &&
141 kind == CodeKind::INTERPRETED_FUNCTION) {
145 kind, IsCode(code) && code->GetCode()->is_context_specialized());
148#if V8_ENABLE_WEBASSEMBLY
149const char* ComputeMarker(
const wasm::WasmCode* code) {
150 switch (code->kind()) {
152 return code->is_liftoff() ?
"" :
"*";
174 if (IsString(name)) {
179 if (!IsUndefined(symbol->description())) {
193 std::unique_ptr<char[]> c_str = str->ToCString(&length);
204 size_t len = strlen(bytes);
218 int size = SNPrintF(buffer,
"%d", n);
228 int size = SNPrintF(buffer,
"%x", n);
252 const char* comment) {
278 name_buffer_->AppendBytes(ComputeMarker(*shared, *code));
292 name_buffer_->AppendBytes(ComputeMarker(*shared, *code));
293 name_buffer_->AppendBytes(shared->DebugNameCStr().get());
295 if (IsString(*script_name)) {
310#if V8_ENABLE_WEBASSEMBLY
313 const char* source_url,
320 if (code->IsAnonymous()) {
326 name_buffer_->AppendBytes(ExecutionTierToString(code->tier()));
357 explicit LinuxPerfBasicLogger(
Isolate* isolate);
358 ~LinuxPerfBasicLogger()
override;
362 void BytecodeMoveEvent(Tagged<BytecodeArray> from,
363 Tagged<BytecodeArray> to)
override {}
364 void CodeDisableOptEvent(DirectHandle<AbstractCode> code,
365 DirectHandle<SharedFunctionInfo> shared)
override {}
368 void LogRecordedBuffer(Tagged<AbstractCode> code,
369 MaybeDirectHandle<SharedFunctionInfo> maybe_shared,
370 const char* name,
size_t length)
override;
371#if V8_ENABLE_WEBASSEMBLY
372 void LogRecordedBuffer(
const wasm::WasmCode* code,
const char* name,
373 size_t length)
override;
375 void WriteLogRecordedBuffer(uintptr_t address,
size_t size,
const char* name,
378 static base::LazyRecursiveMutex& GetFileMutex();
381 static const char kFilenameFormatString[];
382 static const int kFilenameBufferPadding;
386 static FILE* perf_output_handle_;
387 static uint64_t reference_count_;
391const int LinuxPerfBasicLogger::kFilenameBufferPadding = 32;
401uint64_t LinuxPerfBasicLogger::reference_count_ = 0;
402FILE* LinuxPerfBasicLogger::perf_output_handle_ =
nullptr;
404LinuxPerfBasicLogger::LinuxPerfBasicLogger(Isolate* isolate)
405 : CodeEventLogger(isolate) {
406 base::LockGuard<base::RecursiveMutex> guard_file(GetFileMutex().Pointer());
410 if (reference_count_ == 1) {
413 const char* base_dir =
v8_flags.perf_basic_prof_path;
415 base::ScopedVector<char> perf_dump_name(strlen(base_dir) +
416 kFilenameBufferPadding);
418 SNPrintF(perf_dump_name,
"%s/perf-%d.map", base_dir, process_id_);
420 perf_output_handle_ =
423 setvbuf(perf_output_handle_,
nullptr, _IOLBF, 0);
427LinuxPerfBasicLogger::~LinuxPerfBasicLogger() {
428 base::LockGuard<base::RecursiveMutex> guard_file(GetFileMutex().Pointer());
432 if (reference_count_ == 0) {
435 perf_output_handle_ =
nullptr;
439void LinuxPerfBasicLogger::WriteLogRecordedBuffer(uintptr_t address,
440 size_t size,
const char* name,
441 size_t name_length) {
449 int int_name_length =
static_cast<int>(name_length);
451 base::OS::FPrint(perf_output_handle_,
"0x%" V8PRIxPTR " 0x%zx %.*s\n",
452 address, size, int_name_length, name);
454 base::OS::FPrint(perf_output_handle_,
"%" V8PRIxPTR " %zx %.*s\n", address,
455 size, int_name_length, name);
459void LinuxPerfBasicLogger::LogRecordedBuffer(
461 const char* name,
size_t length) {
463 PtrComprCageBase cage_base(
isolate_);
464 if (
v8_flags.perf_basic_prof_only_functions &&
469 WriteLogRecordedBuffer(
470 static_cast<uintptr_t
>(code->InstructionStart(cage_base)),
471 code->InstructionSize(cage_base), name, length);
474#if V8_ENABLE_WEBASSEMBLY
475void LinuxPerfBasicLogger::LogRecordedBuffer(
const wasm::WasmCode* code,
476 const char* name,
size_t length) {
477 WriteLogRecordedBuffer(
static_cast<uintptr_t
>(code->instruction_start()),
478 code->instructions().length(), name, length);
485 : is_listening_(false),
isolate_(isolate), code_event_handler_(nullptr) {}
524 const char* comment) {
528 static_cast<uintptr_t
>(code->InstructionStart(cage_base));
529 code_event.
code_size =
static_cast<size_t>(code->InstructionSize(cage_base));
534 code_event.
code_type = GetCodeEventTypeForTag(tag);
549 static_cast<uintptr_t
>(code->InstructionStart(cage_base));
550 code_event.
code_size =
static_cast<size_t>(code->InstructionSize(cage_base));
555 code_event.
code_type = GetCodeEventTypeForTag(tag);
570 static_cast<uintptr_t
>(code->InstructionStart(cage_base));
571 code_event.
code_size =
static_cast<size_t>(code->InstructionSize(cage_base));
576 code_event.
code_type = GetCodeEventTypeForTag(tag);
585 int line,
int column) {
595 static_cast<uintptr_t
>(code->InstructionStart(cage_base));
596 code_event.
code_size =
static_cast<size_t>(code->InstructionSize(cage_base));
601 code_event.
code_type = GetCodeEventTypeForTag(tag);
607#if V8_ENABLE_WEBASSEMBLY
611 const char* source_url,
612 int code_offset,
int script_id) {
623 static_cast<uintptr_t
>(code->InstructionStart(cage_base));
624 code_event.
code_size =
static_cast<size_t>(code->InstructionSize(cage_base));
630 GetCodeEventTypeForTag(LogEventListener::CodeTag::kRegExp);
639 Address previous_code_start_address,
640 Address code_start_address,
int code_size) {
641 event->previous_code_start_address =
642 static_cast<uintptr_t
>(previous_code_start_address);
643 event->code_start_address =
static_cast<uintptr_t
>(code_start_address);
644 event->code_size =
static_cast<size_t>(code_size);
645 event->function_name = isolate->factory()->empty_string();
646 event->script_name = isolate->factory()->empty_string();
647 event->script_line = 0;
648 event->script_column = 0;
649 event->code_type = v8::CodeEventType::kRelocationType;
658 InitializeCodeEvent(
isolate_, &code_event, from->instruction_start(),
659 to->instruction_start(),
667 InitializeCodeEvent(
isolate_, &code_event, from->GetFirstBytecodeAddress(),
668 to->GetFirstBytecodeAddress(), to->length());
690 const char* name,
size_t length)
override;
691#if V8_ENABLE_WEBASSEMBLY
693 size_t length)
override;
720 template <
typename T>
723 LogWriteBytes(
reinterpret_cast<const char*
>(&tag),
sizeof(tag));
735 size_t len = strlen(name);
752#if V8_TARGET_ARCH_IA32
753 const char arch[] =
"ia32";
754#elif V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_64_BIT
755 const char arch[] =
"x64";
756#elif V8_TARGET_ARCH_ARM
757 const char arch[] =
"arm";
758#elif V8_TARGET_ARCH_PPC64
759 const char arch[] =
"ppc64";
760#elif V8_TARGET_ARCH_LOONG64
761 const char arch[] =
"loong64";
762#elif V8_TARGET_ARCH_ARM64
763 const char arch[] =
"arm64";
764#elif V8_TARGET_ARCH_S390X
765 const char arch[] =
"s390x";
766#elif V8_TARGET_ARCH_RISCV64
767 const char arch[] =
"riscv64";
768#elif V8_TARGET_ARCH_RISCV32
769 const char arch[] =
"riscv32";
771 const char arch[] =
"unknown";
778 const char* name,
size_t length) {
782 event.name_size =
static_cast<uint32_t
>(
length);
783 event.code_address = code->InstructionStart(cage_base);
784 event.
code_size = code->InstructionSize(cage_base);
788 reinterpret_cast<const char*
>(code->InstructionStart(cage_base)),
789 code->InstructionSize(cage_base));
792#if V8_ENABLE_WEBASSEMBLY
794 const char* name,
size_t length) {
795 CodeCreateStruct event;
796 event.name_size =
static_cast<uint32_t
>(
length);
797 event.code_address = code->instruction_start();
798 event.
code_size = code->instructions().length();
801 LogWriteBytes(
reinterpret_cast<const char*
>(code->instruction_start()),
802 code->instructions().length());
810 event.to_address = to->instruction_start();
818 event.to_address = to->GetFirstBytecodeAddress();
856 const char* name,
size_t length)
override;
857#if V8_ENABLE_WEBASSEMBLY
859 size_t length)
override;
879 event.code_start =
reinterpret_cast<void*
>(code->InstructionStart(cage_base));
882 event.code_len = code->InstructionSize(cage_base);
884 if (maybe_shared.
ToHandle(&shared) &&
885 IsScript(shared->script(cage_base), cage_base)) {
890 event.name.str =
name;
896#if V8_ENABLE_WEBASSEMBLY
902 event.code_start = code->instructions().begin();
903 event.code_len = code->instructions().length();
904 event.name.str =
name;
908 if (!code->IsAnonymous()) {
910 code->native_module()->GetWasmSourceMap();
912 code->native_module()->module()->functions[code->index()].code;
913 uint32_t code_offset = code_ref.
offset();
914 uint32_t code_end_offset = code_ref.
end_offset();
916 std::vector<v8::JitCodeEvent::line_info_t> mapping_info;
918 std::unique_ptr<JitCodeEvent::wasm_source_info_t> wasm_source_info;
920 if (source_map && source_map->
IsValid() &&
921 source_map->
HasSource(code_offset, code_end_offset)) {
922 size_t last_line_number = 0;
925 !iterator.
done(); iterator.Advance()) {
927 iterator.source_position().ScriptOffset() + code_offset;
932 mapping_info.push_back({
static_cast<size_t>(iterator.code_offset()),
937 wasm_source_info = std::make_unique<JitCodeEvent::wasm_source_info_t>();
938 wasm_source_info->filename =
filename.c_str();
939 wasm_source_info->filename_size =
filename.size();
940 wasm_source_info->line_number_table_size = mapping_info.size();
941 wasm_source_info->line_number_table = mapping_info.data();
943 event.wasm_source_info = wasm_source_info.get();
963 event.code_start =
reinterpret_cast<void*
>(from->instruction_start());
964 event.code_len = code->instruction_size();
965 event.new_code_start =
reinterpret_cast<void*
>(to->instruction_start());
978 event.code_start =
reinterpret_cast<void*
>(from->GetFirstBytecodeAddress());
979 event.code_len = from->length();
980 event.new_code_start =
reinterpret_cast<void*
>(to->GetFirstBytecodeAddress());
992 event.code_type = code_type;
993 event.user_data = jit_handler_data;
996 event.line_info.position_type = position_type;
1005 event.code_type = code_type;
1009 return event.user_data;
1013 void* jit_handler_data,
1017 event.code_type = code_type;
1018 event.code_start =
reinterpret_cast<void*
>(start_address);
1019 event.user_data = jit_handler_data;
1051#if defined(V8_ENABLE_ETW_STACK_WALKING)
1054 explicit ETWJitLogger(
Isolate* isolate)
1055 :
JitLogger(isolate, i::ETWJITInterface::EventHandler) {}
1081 void Run()
override;
1146 (!isolate->thread_manager()->IsLockedByThread(
1150#if V8_HEAP_USE_PKU_JIT_WRITE_PROTECT
1151 i::RwxMemoryWriteScope::SetDefaultPermissionsForSignalHandler();
1171 buffer_semaphore_(0) {
1178 std::vector<base::OS::SharedLibraryAddress> addresses =
1180 for (
const auto& address : addresses) {
1181 LOG(
isolate_, SharedLibraryEvent(address.library_path, address.start,
1182 address.end, address.aslr_slide));
1192 logger->
ticker_->SetProfiler(
this);
1209 LOG(
isolate_, UncheckedStringEvent(
"profiler",
"end"));
1214 bool overflow =
Remove(&sample);
1217 overflow =
Remove(&sample);
1224#define MSG_BUILDER() \
1225 std::unique_ptr<LogFile::MessageBuilder> msg_ptr = \
1226 log_file_->NewMessageBuilder(); \
1227 if (!msg_ptr) return; \
1228 LogFile::MessageBuilder& msg = *msg_ptr.get();
1233 is_initialized_(false),
1234 existing_code_logger_(isolate) {}
1249template <StateTag tag>
1265 msg <<
"profiler" <<
kNext <<
"begin" <<
kNext
1266 <<
v8_flags.prof_sampling_interval;
1267 msg.WriteToLogFile();
1278 msg.WriteToLogFile();
1285 msg << name <<
kNext;
1286 msg.AppendFormatString(
"%" V8PRIdPTR, value);
1287 msg.WriteToLogFile();
1292 intptr_t aslr_slide) {
1296 msg <<
"shared-library" <<
kNext << library_path.c_str() <<
kNext
1297 <<
reinterpret_cast<void*
>(
start) <<
kNext <<
reinterpret_cast<void*
>(
end)
1298 <<
kNext << aslr_slide;
1299 msg.WriteToLogFile();
1306 msg <<
"shared-library-end";
1307 msg.WriteToLogFile();
1314 msg <<
"current-time" <<
kNext <<
Time();
1315 msg.WriteToLogFile();
1324 msg <<
"timer-event-start";
1327 msg <<
"timer-event-end";
1330 msg <<
"timer-event";
1333 msg.WriteToLogFile();
1339 return is_logging_.load(std::memory_order_relaxed);
1343#define V(TimerName, expose) \
1344 template void TimerEventScope<TimerEvent##TimerName>::LogTimerEvent( \
1345 v8::LogEventStatus se);
1354 <<
static_cast<unsigned int>(
size);
1355 msg.WriteToLogFile();
1362 msg <<
"delete" <<
kNext << name <<
kNext << object;
1363 msg.WriteToLogFile();
1370 uint8_t* address,
int size, uint64_t time) {
1377void AppendCodeCreateHeader(
Isolate* isolate, LogFile::MessageBuilder& msg,
1380 PtrComprCageBase cage_base(isolate);
1381 AppendCodeCreateHeader(
1382 msg, tag, code->kind(cage_base),
1383 reinterpret_cast<uint8_t*
>(code->InstructionStart(cage_base)),
1384 code->InstructionSize(cage_base), time);
1414 if (!IsScript(script_object, cage_base))
return;
1418 if (!
v8_flags.log_source_position)
return;
1422 <<
reinterpret_cast<void*
>(code->InstructionStart(cage_base))
1428 bool hasInlined =
false;
1429 if (code->kind(cage_base) != CodeKind::BASELINE) {
1431 code->SourcePositionTable(
isolate_, *shared));
1434 msg <<
"C" << iterator.
code_offset() <<
"O" <<
pos.ScriptOffset();
1435 if (
pos.isInlined()) {
1436 msg <<
"I" <<
pos.InliningId();
1442 int maxInlinedId = -1;
1446 ->InliningPositions();
1447 for (
int i = 0;
i < inlining_positions->length();
i++) {
1458 if (
pos.isInlined()) {
1459 msg <<
"I" <<
pos.InliningId();
1468 for (
int i = 0;
i <= maxInlinedId;
i++) {
1470 <<
reinterpret_cast<void*
>(
1471 deopt_data->GetInlinedFunction(
i).address());
1475 msg.WriteToLogFile();
1479 if (!
v8_flags.log_code_disassemble)
return;
1484 <<
reinterpret_cast<void*
>(code->InstructionStart(cage_base))
1488 std::ostringstream stream;
1489 if (IsCode(*code, cage_base)) {
1490#ifdef ENABLE_DISASSEMBLER
1496 std::string
string = stream.str();
1497 msg.AppendString(
string.c_str(),
string.
length());
1499 msg.WriteToLogFile();
1510 AppendCodeCreateHeader(
isolate_, msg, tag, *code,
Time());
1512 msg.WriteToLogFile();
1524 AppendCodeCreateHeader(
isolate_, msg, tag, *code,
Time());
1526 msg.WriteToLogFile();
1544 AppendCodeCreateHeader(
isolate_, msg, tag, *code,
Time());
1545 msg << *script_name << kNext << reinterpret_cast<void*>(shared->address())
1546 <<
kNext << ComputeMarker(*shared, *code);
1547 msg.WriteToLogFile();
1556 if (!
v8_flags.log_feedback_vector)
return;
1560 msg <<
"feedback-vector" <<
kNext <<
Time();
1561 msg << kNext << reinterpret_cast<void*>(vector.address()) <<
kNext
1562 << vector->length();
1563 msg << kNext << reinterpret_cast<void*>(code->InstructionStart(cage_base));
1564#ifndef V8_ENABLE_LEAPTIERING
1565 msg <<
kNext << vector->tiering_state();
1566 msg <<
kNext << vector->maybe_has_maglev_code();
1567 msg <<
kNext << vector->maybe_has_turbofan_code();
1569 msg <<
kNext << vector->invocation_count();
1572 std::ostringstream buffer;
1573 vector->FeedbackVectorPrint(buffer);
1574 std::string
contents = buffer.str();
1577 msg <<
"object-printing-disabled";
1579 msg.WriteToLogFile();
1595 AppendCodeCreateHeader(
isolate_, msg, tag, *code,
Time());
1596 msg << shared->DebugNameCStr().get() <<
" " << *script_name <<
":" << line
1597 <<
":" << column << kNext << reinterpret_cast<void*>(shared->address())
1598 <<
kNext << ComputeMarker(*shared, *code);
1600 msg.WriteToLogFile();
1606#if V8_ENABLE_WEBASSEMBLY
1615 AppendCodeCreateHeader(msg, tag, CodeKind::WASM_FUNCTION,
1616 code->instructions().begin(),
1617 code->instructions().length(),
Time());
1619 msg.AppendString(name);
1627 const void* tag_ptr =
1628 code->native_module() !=
nullptr
1629 ?
reinterpret_cast<uint8_t*
>(code->native_module()) + code->index()
1630 :
reinterpret_cast<const uint8_t*
>(
code);
1632 msg <<
kNext << tag_ptr <<
kNext << ComputeMarker(code);
1633 msg.WriteToLogFile();
1643 msg << Event::kCodeCreation <<
kNext << CodeTag::kCallback <<
kNext << -2
1646 msg.WriteToLogFile();
1670 AppendCodeCreateHeader(
isolate_, msg, LogEventListener::CodeTag::kRegExp,
1673 msg.WriteToLogFile();
1680 to->instruction_start());
1687 to->GetFirstBytecodeAddress());
1707 msg << Event::kCodeDisableOpt <<
kNext << shared->DebugNameCStr().get()
1709 msg.WriteToLogFile();
1714 const char* reason) {
1718 << code->InstructionStreamObjectSize() <<
kNext
1719 <<
reinterpret_cast<void*
>(code->instruction_start());
1721 std::ostringstream deopt_location;
1722 int inlining_id = -1;
1723 int script_offset = -1;
1725 position.Print(deopt_location, *code);
1726 inlining_id =
position.InliningId();
1727 script_offset =
position.ScriptOffset();
1729 deopt_location <<
"<unknown>";
1733 msg << deopt_location.str().c_str() <<
kNext << reason;
1734 msg.WriteToLogFile();
1748 const char* reason) {
1783 CodeLinePosEvent(*
jit_logger_, code_start, iter, code_type);
1786#if V8_ENABLE_WEBASSEMBLY
1787void V8FileLogger::WasmCodeLinePosInfoRecordEvent(
1797 if (code_name ==
nullptr)
return;
1801 msg << Event::kSnapshotCodeName <<
kNext <<
pos <<
kNext << code_name;
1802 msg.WriteToLogFile();
1809 msg << event << kNext << reinterpret_cast<void*>(from) <<
kNext
1810 <<
reinterpret_cast<void*
>(
to);
1811 msg.WriteToLogFile();
1816 int script_id,
double time_delta,
int start_position,
1817 int end_position, uint64_t time) {
1831 double time_delta,
int start_position,
1834 if (!
v8_flags.log_function_events)
return;
1837 AppendFunctionMessage(msg, reason, script_id, time_delta, start_position,
1838 end_position,
Time());
1839 if (!function_name.
is_null()) msg << function_name;
1844 double time_delta,
int start_position,
1845 int end_position,
const char* function_name,
1846 size_t function_name_length,
1848 if (!
v8_flags.log_function_events)
return;
1851 AppendFunctionMessage(msg, reason, script_id, time_delta, start_position,
1852 end_position,
Time());
1853 if (function_name_length > 0) {
1854 msg.
AppendString(function_name, function_name_length, is_one_byte);
1860 const char* cache_type,
1862 if (!
v8_flags.log_function_events)
return;
1866 if (IsScript(sfi->script())) {
1877 if (!
v8_flags.log_function_events)
return;
1883 msg <<
"reserve-id";
1889 msg <<
"deserialize";
1892 msg <<
"background-compile";
1895 msg <<
"streaming-compile";
1898 msg <<
"streaming-compile-foreground";
1906 if (!
v8_flags.log_function_events)
return;
1912 if (IsString(script->name())) {
1913 msg << Cast<String>(script->name());
1917 if (IsString(script->source_mapping_url())) {
1918 msg << Cast<String>(script->source_mapping_url());
1926 if (!
v8_flags.log_source_code)
return true;
1929 int script_id = script->id();
1936 if (!IsString(source_object))
return false;
1938 std::unique_ptr<LogFile::MessageBuilder> msg_ptr =
1940 if (!msg_ptr)
return false;
1944 msg <<
"script-source" <<
kNext << script_id <<
kNext;
1947 if (IsString(script->name())) {
1948 msg << Cast<String>(script->name()) <<
kNext;
1950 msg <<
"<unknown>" <<
kNext;
1960#ifdef V8_RUNTIME_CALL_STATS
1963 RuntimeCallCounter* counter = stats->current_counter();
1964 if (counter ==
nullptr)
return;
1966 msg <<
"active-runtime-timer" <<
kNext << counter->name();
1979 msg << Event::kTick << kNext << reinterpret_cast<void*>(sample->pc) <<
kNext
1981 if (sample->has_external_callback) {
1983 <<
reinterpret_cast<void*
>(sample->external_callback_entry);
1985 msg << kNext << 0 << kNext << reinterpret_cast<void*>(sample->tos);
1987 msg << kNext << static_cast<int>(sample->state);
1988 if (overflow) msg <<
kNext <<
"overflow";
1989 for (
unsigned i = 0;
i < sample->frames_count; ++
i) {
1990 msg << kNext << reinterpret_cast<void*>(sample->stack[
i]);
1997 char new_state,
const char* modifier,
1998 const char* slow_stub_reason) {
2007 if (keyed) msg <<
"Keyed";
2008 msg << type << kNext << reinterpret_cast<void*>(
pc) <<
kNext <<
Time()
2010 << new_state <<
kNext
2016 }
else if (IsName(*
key)) {
2017 msg << Cast<Name>(*
key);
2020 if (slow_stub_reason !=
nullptr) {
2021 msg << slow_stub_reason;
2047 if (IsName(*name_or_sfi)) {
2048 msg << Cast<Name>(*name_or_sfi);
2049 }
else if (IsSharedFunctionInfo(*name_or_sfi)) {
2051 msg << sfi->DebugNameCStr().get();
2052 msg <<
" " << sfi->unique_id();
2075 std::ostringstream buffer;
2076 map->PrintMapDetails(buffer);
2077 msg << buffer.str().c_str();
2109 if (
auto [iter, inserted] = seen.emplace(sfi, c); inserted)
2110 compiled_funcs.emplace_back(
handle(sfi, isolate),
handle(c, isolate));
2115 obj = iterator.
Next()) {
2116 if (IsSharedFunctionInfo(obj)) {
2118 if (sfi->is_compiled() && !sfi->HasBytecodeArray()) {
2121 }
else if (IsJSFunction(obj)) {
2128 if (function->HasAttachedOptimizedCode(isolate) &&
2129 Cast<Script>(function->shared()->script())->HasValidSource()) {
2137 script = script_iterator.
Next()) {
2138 if (!script->HasValidSource())
continue;
2142 sfi = sfi_iterator.
Next()) {
2143 if (sfi->is_compiled()) {
2149 return compiled_funcs;
2152#if defined(V8_ENABLE_ETW_STACK_WALKING)
2153static std::vector<Handle<SharedFunctionInfo>> EnumerateInterpretedFunctions(
2155 HeapObjectIterator iterator(
heap);
2157 std::vector<Handle<SharedFunctionInfo>> interpreted_funcs;
2161 obj = iterator.Next()) {
2162 if (IsSharedFunctionInfo(obj)) {
2164 if (sfi->HasBytecodeArray()) {
2165 interpreted_funcs.push_back(
handle(sfi, isolate));
2170 return interpreted_funcs;
2173void V8FileLogger::LogInterpretedFunctions() {
2177void ExistingCodeLogger::LogInterpretedFunctions() {
2181 std::vector<Handle<SharedFunctionInfo>> interpreted_funcs =
2182 EnumerateInterpretedFunctions(
heap);
2184 if (sfi->HasInterpreterData(
isolate_) || !sfi->HasSourceCode() ||
2185 !sfi->HasBytecodeArray()) {
2189 sfi->is_toplevel() ? LogEventListener::CodeTag::kScript
2190 : LogEventListener::CodeTag::kFunction;
2204 bool ensure_source_positions_available) {
2215 obj = iterator.
Next()) {
2216 if (!IsAccessorInfo(obj))
continue;
2218 if (!IsName(ai->name()))
continue;
2223#if USES_FUNCTION_DESCRIPTORS
2224 getter_entry = *FUNCTION_ENTRYPOINT_ADDRESS(getter_entry);
2230#if USES_FUNCTION_DESCRIPTORS
2231 setter_entry = *FUNCTION_ENTRYPOINT_ADDRESS(setter_entry);
2242 obj = iterator.
Next()) {
2243 if (!IsMap(obj))
continue;
2251 if (!
v8_flags.logfile_per_isolate)
return;
2256 const char* file_name) {
2257 int dir_separator_count = 0;
2258 for (
const char* p = file_name; *p; p++) {
2262 for (
const char* p = file_name; *p; p++) {
2263 if (dir_separator_count == 0) {
2265 dir_separator_count--;
2303 std::ostringstream log_file_name;
2305 log_file_ = std::make_unique<LogFile>(
this, log_file_name.str());
2309 perf_basic_logger_ = std::make_unique<LinuxPerfBasicLogger>(isolate);
2310 CHECK(
logger()->AddListener(perf_basic_logger_.get()));
2314 perf_jit_logger_ = std::make_unique<LinuxPerfJitLogger>(isolate);
2315 CHECK(
logger()->AddListener(perf_jit_logger_.get()));
2320 "--perf-prof should be statically disabled on non-Linux platforms");
2323 "--perf-basic-prof should be statically disabled on non-Linux platforms");
2326#ifdef ENABLE_GDB_JIT_INTERFACE
2329 std::make_unique<JitLogger>(isolate, i::GDBJITInterface::EventHandler);
2330 CHECK(
logger()->AddListener(gdb_jit_logger_.get()));
2331 CHECK(isolate->logger()->is_listening_to_code_events());
2337 std::make_unique<LowLevelLogger>(isolate, log_file_name.str().c_str());
2340 ticker_ = std::make_unique<Ticker>(isolate,
v8_flags.prof_sampling_interval);
2346 profiler_ = std::make_unique<Profiler>(isolate);
2356 if (!isolate->logger()->is_listening_to_code_events())
return;
2358#if V8_ENABLE_WEBASSEMBLY
2363#if defined(V8_ENABLE_ETW_STACK_WALKING)
2364void V8FileLogger::SetEtwCodeEventHandler(uint32_t options) {
2366 v8_flags.enable_etw_by_custom_filter_only);
2368#if V8_ENABLE_WEBASSEMBLY
2372 if (!etw_jit_logger_) {
2373 etw_jit_logger_ = std::make_unique<ETWJitLogger>(
isolate_);
2374 CHECK(
logger()->AddListener(etw_jit_logger_.get()));
2390 if (rundown)
isolate_->SetETWIsInRundown(
true);
2396 LogInterpretedFunctions();
2399 if (rundown)
isolate_->SetETWIsInRundown(
false);
2403void V8FileLogger::ResetEtwCodeEventHandler() {
2405 v8_flags.enable_etw_by_custom_filter_only);
2406 if (etw_jit_logger_) {
2407 CHECK(
logger()->RemoveListener(etw_jit_logger_.get()));
2408 etw_jit_logger_.reset();
2421 if (event_handler) {
2422#if V8_ENABLE_WEBASSEMBLY
2461 if (perf_basic_logger_) {
2462 CHECK(
logger()->RemoveListener(perf_basic_logger_.get()));
2463 perf_basic_logger_.reset();
2466 if (perf_jit_logger_) {
2467 CHECK(
logger()->RemoveListener(perf_jit_logger_.get()));
2468 perf_jit_logger_.reset();
2496 is_logging_.store(value, std::memory_order_relaxed);
2505 const char* description =
"Unknown code from before profiling";
2507 switch (abstract_code->kind(cage_base)) {
2508 case CodeKind::INTERPRETED_FUNCTION:
2509 case CodeKind::TURBOFAN_JS:
2510 case CodeKind::BASELINE:
2511 case CodeKind::MAGLEV:
2513 case CodeKind::FOR_TESTING:
2514 description =
"STUB code";
2515 tag = CodeTag::kStub;
2517 case CodeKind::REGEXP:
2518 description =
"Regular expression code";
2519 tag = CodeTag::kRegExp;
2521 case CodeKind::BYTECODE_HANDLER:
2524 tag = CodeTag::kBytecodeHandler;
2526 case CodeKind::BUILTIN:
2527 if (abstract_code->has_instruction_stream(cage_base)) {
2528 DCHECK_EQ(abstract_code->builtin_id(cage_base),
2529 Builtin::kInterpreterEntryTrampoline);
2534 description =
Builtins::name(abstract_code->builtin_id(cage_base));
2535 tag = CodeTag::kBuiltin;
2537 case CodeKind::WASM_FUNCTION:
2538 description =
"A Wasm function";
2539 tag = CodeTag::kFunction;
2541 case CodeKind::JS_TO_WASM_FUNCTION:
2542 description =
"A JavaScript to Wasm adapter";
2543 tag = CodeTag::kStub;
2545 case CodeKind::WASM_TO_CAPI_FUNCTION:
2546 description =
"A Wasm to C-API adapter";
2547 tag = CodeTag::kStub;
2549 case CodeKind::WASM_TO_JS_FUNCTION:
2550 description =
"A Wasm to JavaScript adapter";
2551 tag = CodeTag::kStub;
2553 case CodeKind::C_WASM_ENTRY:
2554 description =
"A C to Wasm entry stub";
2555 tag = CodeTag::kStub;
2567 obj = iterator.
Next()) {
2568 InstanceType instance_type = obj->map(cage_base)->instance_type();
2569 if (InstanceTypeChecker::IsCode(instance_type) ||
2570 InstanceTypeChecker::IsBytecodeArray(instance_type)) {
2586 bool ensure_source_positions_available) {
2594 for (
auto& pair : compiled_funcs) {
2600 if (
IsSmi(script)) {
2605 if (ensure_source_positions_available) {
2608 if (shared->HasInterpreterData(
isolate_)) {
2611 shared->InterpreterTrampoline(
isolate_)),
2614 if (shared->HasBaselineCode()) {
2631#if V8_ENABLE_WEBASSEMBLY
2636 obj = iterator.
Next()) {
2637 if (!IsWasmModuleObject(obj))
continue;
2639 module_object->native_module()->LogWasmCodes(
isolate_,
2640 module_object->script());
2649 if (IsScript(shared->script())) {
2653 int line_num = info.line + 1;
2654 int column_num = info.column + 1;
2655 if (IsString(script->name())) {
2657 if (!shared->is_toplevel()) {
2660 shared, script_name, line_num, column_num))
2665 shared, script_name))
2672 }
else if (shared->IsApiFunction()) {
2676 if (fun_data->has_callback(
isolate_)) {
2678#if USES_FUNCTION_DESCRIPTORS
2679 entry_point = *FUNCTION_ENTRYPOINT_ADDRESS(entry_point);
2686 int c_functions_count = fun_data->GetCFunctionsCount();
2687 for (
int i = 0;
i < c_functions_count;
i++) {
2689 CallbackEvent(fun_name, fun_data->GetCFunction(
isolate_,
i)))
2692#if V8_ENABLE_WEBASSEMBLY
2693 }
else if (shared->HasWasmJSFunctionData()) {
2695 CodeCreateEvent(CodeTag::kFunction, code,
"wasm-to-js"));
2700#undef CALL_CODE_EVENT_HANDLER
#define BUILTIN_CODE(isolate, name)
virtual void Handle(CodeEvent *code_event)=0
TimeDelta Elapsed() const
static void Sleep(TimeDelta interval)
static void SignalCodeMovingGC()
static const char *const LogFileOpenMode
static FILE * FOpen(const char *path, const char *mode)
static int GetCurrentProcessId()
static std::vector< SharedLibraryAddress > GetSharedLibraryAddresses()
static bool isDirectorySeparator(const char ch)
Thread(const Options &options)
V8_WARN_UNUSED_RESULT bool Start()
static constexpr TimeDelta FromMicroseconds(int64_t microseconds)
int64_t InMicroseconds() const
constexpr T * begin() const
V8_EXPORT_PRIVATE Tagged< Code > code(Builtin builtin)
bool is_initialized() const
static void EmitCodeCreateEvents(Isolate *isolate)
static V8_EXPORT_PRIVATE const char * name(Builtin builtin)
void AppendName(Tagged< Name > name)
void AppendBytes(const char *bytes)
static const size_t kUtf16BufferSize
char utf8_buffer_[kUtf8BufferSize]
void AppendHex(uint32_t n)
void AppendString(Tagged< String > str)
static const size_t kUtf8BufferSize
void AppendBytes(const char *bytes, size_t size)
void RegExpCodeCreateEvent(DirectHandle< AbstractCode > code, DirectHandle< String > source, RegExpFlags flags) override
std::unique_ptr< NameBuffer > name_buffer_
bool is_listening_to_code_events() override
void CodeCreateEvent(CodeTag tag, DirectHandle< AbstractCode > code, const char *name) override
CodeEventLogger(Isolate *isolate)
virtual void LogRecordedBuffer(Tagged< AbstractCode > code, MaybeDirectHandle< SharedFunctionInfo > maybe_shared, const char *name, size_t length)=0
~CodeEventLogger() override
Tagged< HeapObject > Next()
static void InstallInterpreterTrampolineCopy(Isolate *isolate, DirectHandle< SharedFunctionInfo > shared_info, LogEventListener::CodeTag log_tag)
RuntimeCallStats * runtime_call_stats()
DeoptInfo GetDeoptInfo() const
static const char * MessageFor(DeoptimizeKind kind)
V8_INLINE bool is_null() const
void LogCompiledFunctions(bool ensure_source_positions_available=true)
void LogExistingFunction(DirectHandle< SharedFunctionInfo > shared, DirectHandle< AbstractCode > code, LogEventListener::CodeTag tag=LogEventListener::CodeTag::kFunction)
void LogCodeObject(Tagged< AbstractCode > object)
void StartListening(v8::CodeEventHandler *code_event_handler)
void CodeMoveEvent(Tagged< InstructionStream > from, Tagged< InstructionStream > to) override
void RegExpCodeCreateEvent(DirectHandle< AbstractCode > code, DirectHandle< String > source, RegExpFlags flags) override
void BytecodeMoveEvent(Tagged< BytecodeArray > from, Tagged< BytecodeArray > to) override
void CodeCreateEvent(CodeTag tag, DirectHandle< AbstractCode > code, const char *comment) override
ExternalLogEventListener(Isolate *isolate)
~ExternalLogEventListener() override
v8::CodeEventHandler * code_event_handler_
static V8_INLINE bool InTrustedSpace(Tagged< HeapObject > object)
Tagged< HeapObject > Next()
V8_EXPORT_PRIVATE double MonotonicallyIncreasingTimeInMs() const
ThreadId thread_id() const
void UpdateLogObjectRelocation()
void CollectSourcePositionsForAllBytecodeArrays()
bool was_locker_ever_used() const
Bootstrapper * bootstrapper()
bool is_profiling() const
Address GetAbstractPC(int *line, int *column)
bool interpreted_frames_native_stack() const
V8FileLogger * v8_file_logger() const
v8::internal::Factory * factory()
static V8_EXPORT_PRIVATE DirectHandle< String > StringFromFlags(Isolate *isolate, Flags flags)
static constexpr Flags AsJSRegExpFlags(RegExpFlags f)
JitCodeEventHandler code_event_handler_
void CodeMoveEvent(Tagged< InstructionStream > from, Tagged< InstructionStream > to) override
void AddCodeLinePosInfoEvent(void *jit_handler_data, int pc_offset, int position, JitCodeEvent::PositionType position_type, JitCodeEvent::CodeType code_type)
void CodeDisableOptEvent(DirectHandle< AbstractCode > code, DirectHandle< SharedFunctionInfo > shared) override
JitLogger(Isolate *isolate, JitCodeEventHandler code_event_handler)
base::Mutex logger_mutex_
void BytecodeMoveEvent(Tagged< BytecodeArray > from, Tagged< BytecodeArray > to) override
void * StartCodePosInfoEvent(JitCodeEvent::CodeType code_type)
void LogRecordedBuffer(Tagged< AbstractCode > code, MaybeDirectHandle< SharedFunctionInfo > maybe_shared, const char *name, size_t length) override
void EndCodePosInfoEvent(Address start_address, void *jit_handler_data, JitCodeEvent::CodeType code_type)
void AppendString(Tagged< String > str, std::optional< int > length_limit=std::nullopt)
bool is_listening_to_code_events()
bool AddListener(LogEventListener *listener)
bool RemoveListener(LogEventListener *listener)
static const char kLogExt[]
void LogWriteBytes(const char *bytes, size_t size)
LowLevelLogger(Isolate *isolate, const char *file_name)
static const char kCodeMovingGCTag
void CodeMovingGCEvent() override
void BytecodeMoveEvent(Tagged< BytecodeArray > from, Tagged< BytecodeArray > to) override
void SnapshotPositionEvent(Tagged< HeapObject > obj, int pos)
~LowLevelLogger() override
void LogRecordedBuffer(Tagged< AbstractCode > code, MaybeDirectHandle< SharedFunctionInfo > maybe_shared, const char *name, size_t length) override
void CodeMoveEvent(Tagged< InstructionStream > from, Tagged< InstructionStream > to) override
void LogWriteStruct(const T &s)
void CodeDisableOptEvent(DirectHandle< AbstractCode > code, DirectHandle< SharedFunctionInfo > shared) override
V8_WARN_UNUSED_RESULT V8_INLINE bool ToHandle(DirectHandle< S > *out) const
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< String > ToFunctionName(Isolate *isolate, DirectHandle< Name > name)
static double NumberValue(Tagged< Number > obj)
static const int kBufferSize
Profiler(Isolate *isolate)
base::Semaphore buffer_semaphore_
TickSample buffer_[kBufferSize]
void Insert(TickSample *sample)
bool Remove(TickSample *sample)
static const int kSamplingThreadStackSize
sampler::Sampler * sampler_
SamplingThread(sampler::Sampler *sampler, int interval_microseconds)
const int interval_microseconds_
static bool GetPositionInfo(DirectHandle< Script > script, int position, PositionInfo *info, OffsetFlag offset_flag=OffsetFlag::kWithOffset)
V8_EXPORT_PRIVATE Tagged< SharedFunctionInfo > Next()
static void EnsureSourcePositionsAvailable(Isolate *isolate, DirectHandle< SharedFunctionInfo > shared_info)
static Handle< String > DebugName(Isolate *isolate, DirectHandle< SharedFunctionInfo > shared)
static constexpr int ToInt(const Tagged< Object > object)
static constexpr Tagged< Smi > uninitialized_deserialization_value()
bool is_statement() const
SourcePosition source_position() const
V8_INLINE constexpr bool is_null() const
static ThreadId Current()
Isolate::PerIsolateThreadData * perThreadData_
std::unique_ptr< SamplingThread > sampling_thread_
void SampleStack(const v8::RegisterState &state) override
void SetProfiler(Profiler *profiler)
Ticker(Isolate *isolate, int interval_microseconds)
V8_EXPORT_PRIVATE std::string file_name() const
std::set< int > logged_source_code_
void SetterCallbackEvent(DirectHandle< Name > name, Address entry_point) override
void MapCreate(Tagged< Map > map)
void MapMoveEvent(Tagged< Map > from, Tagged< Map > to)
void IntPtrTEvent(const char *name, intptr_t value)
V8_EXPORT_PRIVATE bool is_logging()
std::unique_ptr< Ticker > ticker_
void LogCodeDisassemble(DirectHandle< AbstractCode > code)
void CodeDependencyChangeEvent(DirectHandle< Code > code, DirectHandle< SharedFunctionInfo > sfi, const char *reason) override
void CodeDisableOptEvent(DirectHandle< AbstractCode > code, DirectHandle< SharedFunctionInfo > shared) override
void FeedbackVectorEvent(Tagged< FeedbackVector > vector, Tagged< AbstractCode > code)
void DeleteEvent(const char *name, void *object)
std::unique_ptr< JitLogger > jit_logger_
V8_EXPORT_PRIVATE void StopProfilerThread()
void MapDetails(Tagged< Map > map)
std::unique_ptr< Profiler > profiler_
void BytecodeMoveEvent(Tagged< BytecodeArray > from, Tagged< BytecodeArray > to) override
void MoveEventInternal(Event event, Address from, Address to)
void CompilationCacheEvent(const char *action, const char *cache_type, Tagged< SharedFunctionInfo > sfi)
std::atomic< bool > is_logging_
V8_EXPORT_PRIVATE FILE * TearDownAndGetLogFile()
void RegExpCodeCreateEvent(DirectHandle< AbstractCode > code, DirectHandle< String > source, RegExpFlags flags) override
void ProfilerBeginEvent()
bool is_listening_to_code_events() override
void LogExistingFunction(DirectHandle< SharedFunctionInfo > shared, DirectHandle< AbstractCode > code)
void ScriptEvent(ScriptEventType type, int script_id)
V8_EXPORT_PRIVATE void LogAccessorCallbacks()
bool EnsureLogScriptSource(Tagged< Script > script)
void UncheckedStringEvent(const char *name, const char *value)
V8_EXPORT_PRIVATE void LogCompiledFunctions(bool ensure_source_positions_available=true)
void CodeMoveEvent(Tagged< InstructionStream > from, Tagged< InstructionStream > to) override
void CodeDeoptEvent(DirectHandle< Code > code, DeoptimizeKind kind, Address pc, int fp_to_sp_delta) override
void CallbackEvent(DirectHandle< Name > name, Address entry_point) override
void SharedFunctionInfoMoveEvent(Address from, Address to) override
void LateSetup(Isolate *isolate)
void CodeNameEvent(Address addr, int pos, const char *code_name)
V8_EXPORT_PRIVATE void LogBuiltins()
sampler::Sampler * sampler()
void ProcessDeoptEvent(DirectHandle< Code > code, SourcePosition position, const char *kind, const char *reason)
void UpdateIsLogging(bool value)
void SetCodeEventHandler(uint32_t options, JitCodeEventHandler event_handler)
void SharedLibraryEvent(const std::string &library_path, uintptr_t start, uintptr_t end, intptr_t aslr_slide)
V8_EXPORT_PRIVATE void TimerEvent(v8::LogEventStatus se, const char *name)
void MapEvent(const char *type, DirectHandle< Map > from, DirectHandle< Map > to, const char *reason=nullptr, DirectHandle< HeapObject > name_or_sfi=DirectHandle< HeapObject >())
bool SetUp(Isolate *isolate)
void TickEvent(TickSample *sample, bool overflow)
std::unique_ptr< LogFile > log_file_
void FunctionEvent(const char *reason, int script_id, double time_delta_ms, int start_position, int end_position, Tagged< String > function_name)
void CodeLinePosInfoRecordEvent(Address code_start, Tagged< TrustedByteArray > source_position_table, JitCodeEvent::CodeType code_type)
void ScriptDetails(Tagged< Script > script)
void CodeCreateEvent(CodeTag tag, DirectHandle< AbstractCode > code, const char *name) override
void ICEvent(const char *type, bool keyed, DirectHandle< Map > map, DirectHandle< Object > key, char old_state, char new_state, const char *modifier, const char *slow_stub_reason)
V8_EXPORT_PRIVATE void StringEvent(const char *name, const char *value)
void NewEvent(const char *name, void *object, size_t size)
V8_EXPORT_PRIVATE void LogCodeObjects()
static const LogSeparator kNext
void RuntimeCallTimerEvent()
void GetterCallbackEvent(DirectHandle< Name > name, Address entry_point) override
void LogSourceCodeInformation(DirectHandle< AbstractCode > code, DirectHandle< SharedFunctionInfo > shared)
V8FileLogger(Isolate *isolate)
std::unique_ptr< LowLevelLogger > ll_logger_
void CodeMovingGCEvent() override
void CallbackEventInternal(const char *prefix, DirectHandle< Name > name, Address entry_point)
base::ElapsedTimer timer_
ExistingCodeLogger existing_code_logger_
static V8_INLINE CodeTag ToNativeByScript(CodeTag tag, Tagged< Script > script)
static V8_EXPORT_PRIVATE v8::Platform * GetCurrentPlatform()
VMStateIfMainThread(Isolate *isolate)
std::optional< VMState< tag > > vm_state_
void EnableCodeLogging(Isolate *)
void LogForIsolate(Isolate *isolate)
size_t GetSourceLine(size_t wasm_offset) const
bool HasValidEntry(size_t start, size_t addr) const
bool HasSource(size_t start, size_t end) const
std::string GetFilename(size_t wasm_offset) const
uint32_t end_offset() const
Isolate * isolate() const
Sampler(Isolate *isolate)
#define CODE_TYPE_LIST(V)
#define PROFILE(the_isolate, Call)
#define LOG_EVENT_LIST(V)
Handle< SharedFunctionInfo > info
SharedFunctionInfoRef shared
ZoneVector< RpoNumber > & result
LiftoffAssembler::CacheState state
#define DECLARE_EVENT(ignore1, name)
#define CALL_CODE_EVENT_HANDLER(Call)
#define LOG(isolate, Call)
#define TIMER_EVENTS_LIST(V)
InstructionOperand source
#define LAZY_RECURSIVE_MUTEX_INITIALIZER
void Relaxed_Store(volatile Atomic8 *ptr, Atomic8 value)
LazyStaticInstance< RecursiveMutex, DefaultConstructTrait< RecursiveMutex >, ThreadSafeInitOnceTrait >::type LazyRecursiveMutex
V8_INLINE size_t hash_combine(size_t seed, size_t hash)
Atomic8 Relaxed_Load(volatile const Atomic8 *ptr)
int SNPrintF(Vector< char > str, const char *format,...)
Atomic8 Acquire_Load(volatile const Atomic8 *ptr)
void Release_Store(volatile Atomic8 *ptr, Atomic8 value)
constexpr uint32_t kEtwRundown
WasmImportWrapperCache * GetWasmImportWrapperCache()
WasmEngine * GetWasmEngine()
V8_INLINE IndirectHandle< T > handle(Tagged< T > object, Isolate *isolate)
PerThreadAssertScopeDebugOnly< false, SAFEPOINTS_ASSERT, HEAP_ALLOCATION_ASSERT > DisallowGarbageCollection
const char * CodeKindToMarker(CodeKind kind, bool context_specialized)
bool IsNumber(Tagged< Object > obj)
const char * CodeKindToString(CodeKind kind)
static void PrepareLogFileName(std::ostream &os, Isolate *isolate, const char *file_name)
Tagged(T object) -> Tagged< T >
char const * DeoptimizeReasonToString(DeoptimizeReason reason)
V8_INLINE constexpr bool IsSmi(TaggedImpl< kRefType, StorageType > obj)
kInterpreterTrampolineOffset Tagged< HeapObject >
V8_INLINE DirectHandle< T > direct_handle(Tagged< T > object, Isolate *isolate)
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 name
std::ostream & operator<<(std::ostream &os, AtomicMemoryOrder order)
static void AddIsolateIdIfNeeded(std::ostream &os, Isolate *isolate)
static const char * kLogEventsNames[]
V8_INLINE PtrComprCageBase GetPtrComprCageBase()
const char * GetBailoutReason(BailoutReason reason)
constexpr bool CodeKindIsBuiltinOrJSFunction(CodeKind kind)
refactor address components for immediate indexing make OptimizeMaglevOnNextCall optimize to turbofan instead of maglev filter for tracing turbofan compilation trace turbo cfg trace TurboFan s graph trimmer trace TurboFan s control equivalence trace TurboFan s register allocator trace stack load store counters for optimized code in run fuzzing &&concurrent_recompilation trace_turbo trace_turbo_scheduled trace_turbo_stack_accesses verify TurboFan machine graph of code stubs enable FixedArray bounds checks print TurboFan statistics of wasm compilations maximum cumulative size of bytecode considered for inlining scale factor of bytecode size used to calculate the inlining budget * KB
V8_EXPORT_PRIVATE FlagValues v8_flags
static std::vector< std::pair< Handle< SharedFunctionInfo >, Handle< AbstractCode > > > EnumerateCompiledFunctions(Heap *heap)
static const char * kCodeTagNames[]
constexpr bool kAllCodeObjectsLiveInTrustedSpace
static constexpr Address kNullAddress
@ kStreamingCompileForeground
@ kStreamingCompileBackground
void MemCopy(void *dest, const void *src, size_t size)
kInterpreterTrampolineOffset script
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
@ kJitCodeEventEnumExisting
void(*)(const JitCodeEvent *event) JitCodeEventHandler
v8::Local< T > ToApiHandle(v8::internal::DirectHandle< v8::internal::Object > obj)
static constexpr AcquireLoadTag kAcquireLoad
base::Vector< const char > contents
#define DCHECK_NOT_NULL(val)
#define CHECK_NOT_NULL(val)
#define CHECK_NE(lhs, rhs)
#define DCHECK_GE(v1, v2)
#define DCHECK(condition)
#define DCHECK_EQ(v1, v2)
@ CODE_END_LINE_INFO_RECORDING
@ CODE_START_LINE_INFO_RECORDING
static AsHex Address(Address a)
DirectHandle< String > script_name
uintptr_t code_start_address
DirectHandle< String > function_name
void Init(Isolate *isolate, const v8::RegisterState &state, RecordCEntryFrame record_c_entry_frame, bool update_stats, bool use_simulator_reg_state=true, base::TimeDelta sampling_interval=base::TimeDelta(), const std::optional< uint64_t > trace_id=std::nullopt)
static V8_EXPORT_PRIVATE std::atomic_uint runtime_stats
#define V8_UNLIKELY(condition)