summaryrefslogtreecommitdiff
path: root/deps/v8/src/logging
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/logging')
-rw-r--r--deps/v8/src/logging/counters-definitions.h8
-rw-r--r--deps/v8/src/logging/counters.h14
-rw-r--r--deps/v8/src/logging/log-file.cc2
-rw-r--r--deps/v8/src/logging/log.cc171
-rw-r--r--deps/v8/src/logging/log.h25
-rw-r--r--deps/v8/src/logging/runtime-call-stats.cc2
-rw-r--r--deps/v8/src/logging/runtime-call-stats.h1
-rw-r--r--deps/v8/src/logging/tracing-flags.h4
8 files changed, 140 insertions, 87 deletions
diff --git a/deps/v8/src/logging/counters-definitions.h b/deps/v8/src/logging/counters-definitions.h
index e1e27fb4ed..c487e9cf85 100644
--- a/deps/v8/src/logging/counters-definitions.h
+++ b/deps/v8/src/logging/counters-definitions.h
@@ -32,10 +32,6 @@ namespace internal {
HR(gc_scavenger_scavenge_main, V8.GCScavenger.ScavengeMain, 0, 10000, 101) \
HR(gc_scavenger_scavenge_roots, V8.GCScavenger.ScavengeRoots, 0, 10000, 101) \
HR(gc_marking_sum, V8.GCMarkingSum, 0, 10000, 101) \
- /* Range and bucket matches BlinkGC.MainThreadMarkingThroughput. */ \
- HR(gc_main_thread_marking_throughput, V8.GCMainThreadMarkingThroughput, 0, \
- 100000, 50) \
- HR(young_generation_handling, V8.GCYoungGenerationHandling, 0, 2, 3) \
/* Asm/Wasm. */ \
HR(wasm_functions_per_asm_module, V8.WasmFunctionsPerModule.asm, 1, 1000000, \
51) \
@@ -131,8 +127,8 @@ namespace internal {
HT(gc_incremental_marking, V8.GCIncrementalMarking, 10000, MILLISECOND) \
HT(gc_incremental_marking_start, V8.GCIncrementalMarkingStart, 10000, \
MILLISECOND) \
- HT(gc_incremental_marking_finalize, V8.GCIncrementalMarkingFinalize, 10000, \
- MILLISECOND) \
+ HT(gc_minor_incremental_marking_start, V8.GCMinorIncrementalMarkingStart, \
+ 10000, MILLISECOND) \
HT(gc_low_memory_notification, V8.GCLowMemoryNotification, 10000, \
MILLISECOND) \
/* Compilation times. */ \
diff --git a/deps/v8/src/logging/counters.h b/deps/v8/src/logging/counters.h
index 1e284bf331..354bc54845 100644
--- a/deps/v8/src/logging/counters.h
+++ b/deps/v8/src/logging/counters.h
@@ -367,7 +367,7 @@ class V8_NODISCARD AggregatedHistogramTimerScope {
// AggretatedMemoryHistogram collects (time, value) sample pairs and turns
// them into time-uniform samples for the backing historgram, such that the
// backing histogram receives one sample every T ms, where the T is controlled
-// by the FLAG_histogram_interval.
+// by the v8_flags.histogram_interval.
//
// More formally: let F be a real-valued function that maps time to sample
// values. We define F as a linear interpolation between adjacent samples. For
@@ -388,7 +388,7 @@ class AggregatedMemoryHistogram {
// 1) For we processed samples that came in before start_ms_ and sent the
// corresponding aggregated samples to backing histogram.
// 2) (last_ms_, last_value_) is the last received sample.
- // 3) last_ms_ < start_ms_ + FLAG_histogram_interval.
+ // 3) last_ms_ < start_ms_ + v8_flags.histogram_interval.
// 4) aggregate_value_ is the average of the function that is constructed by
// linearly interpolating samples received between start_ms_ and last_ms_.
void AddSample(double current_ms, double current_value);
@@ -429,7 +429,7 @@ void AggregatedMemoryHistogram<Histogram>::AddSample(double current_ms,
// Two samples have the same time, remember the last one.
last_value_ = current_value;
} else {
- double sample_interval_ms = FLAG_histogram_interval;
+ double sample_interval_ms = v8_flags.histogram_interval;
double end_ms = start_ms_ + sample_interval_ms;
if (end_ms <= current_ms + kEpsilon) {
// Linearly interpolate between the last_ms_ and the current_ms.
@@ -520,10 +520,10 @@ class Counters : public std::enable_shared_from_this<Counters> {
NESTED_TIMED_HISTOGRAM_LIST(HT)
#undef HT
-#define HT(name, caption, max, res) \
- NestedTimedHistogram* name() { \
- name##_.EnsureCreated(FLAG_slow_histograms); \
- return &name##_; \
+#define HT(name, caption, max, res) \
+ NestedTimedHistogram* name() { \
+ name##_.EnsureCreated(v8_flags.slow_histograms); \
+ return &name##_; \
}
NESTED_TIMED_HISTOGRAM_LIST_SLOW(HT)
#undef HT
diff --git a/deps/v8/src/logging/log-file.cc b/deps/v8/src/logging/log-file.cc
index 21f2d1c968..acdd24701c 100644
--- a/deps/v8/src/logging/log-file.cc
+++ b/deps/v8/src/logging/log-file.cc
@@ -28,7 +28,7 @@ const char* const LogFile::kLogToConsole = "-";
// static
FILE* LogFile::CreateOutputHandle(std::string file_name) {
// If we're logging anything, we need to open the log file.
- if (!FLAG_log) {
+ if (!v8_flags.log) {
return nullptr;
} else if (LogFile::IsLoggingToConsole(file_name)) {
return stdout;
diff --git a/deps/v8/src/logging/log.cc b/deps/v8/src/logging/log.cc
index b406ab4a17..e591ce8224 100644
--- a/deps/v8/src/logging/log.cc
+++ b/deps/v8/src/logging/log.cc
@@ -11,6 +11,7 @@
#include "include/v8-locker.h"
#include "src/api/api-inl.h"
+#include "src/base/functional.h"
#include "src/base/platform/mutex.h"
#include "src/base/platform/platform.h"
#include "src/base/platform/wrappers.h"
@@ -127,7 +128,7 @@ const char* ComputeMarker(SharedFunctionInfo shared, AbstractCode code) {
CodeKind kind = code.kind(cage_base);
// We record interpreter trampoline builtin copies as having the
// "interpreted" marker.
- if (FLAG_interpreted_frames_native_stack && kind == CodeKind::BUILTIN &&
+ if (v8_flags.interpreted_frames_native_stack && kind == CodeKind::BUILTIN &&
!code.is_off_heap_trampoline(cage_base)) {
DCHECK_EQ(code.builtin_id(cage_base), Builtin::kInterpreterEntryTrampoline);
kind = CodeKind::INTERPRETED_FUNCTION;
@@ -416,7 +417,7 @@ void LinuxPerfBasicLogger::LogRecordedBuffer(Handle<AbstractCode> code,
MaybeHandle<SharedFunctionInfo>,
const char* name, int length) {
PtrComprCageBase cage_base(isolate_);
- if (FLAG_perf_basic_prof_only_functions &&
+ if (v8_flags.perf_basic_prof_only_functions &&
CodeKindIsBuiltinOrJSFunction(code->kind(cage_base))) {
return;
}
@@ -946,6 +947,14 @@ class SamplingThread : public base::Thread {
const int interval_microseconds_;
};
+#if defined(V8_OS_WIN) && defined(V8_ENABLE_ETW_STACK_WALKING)
+class ETWJitLogger : public JitLogger {
+ public:
+ explicit ETWJitLogger(Isolate* isolate)
+ : JitLogger(isolate, i::ETWJITInterface::EventHandler) {}
+};
+#endif
+
// The Profiler samples pc and sp values for the main thread.
// Each sample is appended to a circular buffer.
// An independent thread removes data and writes it to the log.
@@ -1128,7 +1137,7 @@ V8FileLogger::~V8FileLogger() = default;
const LogSeparator V8FileLogger::kNext = LogSeparator::kSeparator;
int64_t V8FileLogger::Time() {
- if (FLAG_verify_predictable) {
+ if (v8_flags.verify_predictable) {
return isolate_->heap()->MonotonicallyIncreasingTimeInMs() * 1000;
}
return timer_.Elapsed().InMicroseconds();
@@ -1145,12 +1154,13 @@ void V8FileLogger::RemoveLogEventListener(LogEventListener* listener) {
void V8FileLogger::ProfilerBeginEvent() {
MSG_BUILDER();
- msg << "profiler" << kNext << "begin" << kNext << FLAG_prof_sampling_interval;
+ msg << "profiler" << kNext << "begin" << kNext
+ << v8_flags.prof_sampling_interval;
msg.WriteToLogFile();
}
void V8FileLogger::StringEvent(const char* name, const char* value) {
- if (FLAG_log) UncheckedStringEvent(name, value);
+ if (v8_flags.log) UncheckedStringEvent(name, value);
}
void V8FileLogger::UncheckedStringEvent(const char* name, const char* value) {
@@ -1160,7 +1170,7 @@ void V8FileLogger::UncheckedStringEvent(const char* name, const char* value) {
}
void V8FileLogger::IntPtrTEvent(const char* name, intptr_t value) {
- if (!FLAG_log) return;
+ if (!v8_flags.log) return;
MSG_BUILDER();
msg << name << kNext;
msg.AppendFormatString("%" V8PRIdPTR, value);
@@ -1170,7 +1180,7 @@ void V8FileLogger::IntPtrTEvent(const char* name, intptr_t value) {
void V8FileLogger::SharedLibraryEvent(const std::string& library_path,
uintptr_t start, uintptr_t end,
intptr_t aslr_slide) {
- if (!FLAG_prof_cpp) return;
+ if (!v8_flags.prof_cpp) return;
MSG_BUILDER();
msg << "shared-library" << kNext << library_path.c_str() << kNext
<< reinterpret_cast<void*>(start) << kNext << reinterpret_cast<void*>(end)
@@ -1179,14 +1189,14 @@ void V8FileLogger::SharedLibraryEvent(const std::string& library_path,
}
void V8FileLogger::SharedLibraryEnd() {
- if (!FLAG_prof_cpp) return;
+ if (!v8_flags.prof_cpp) return;
MSG_BUILDER();
msg << "shared-library-end";
msg.WriteToLogFile();
}
void V8FileLogger::CurrentTimeEvent() {
- DCHECK(FLAG_log_internal_timer_events);
+ DCHECK(v8_flags.log_internal_timer_events);
MSG_BUILDER();
msg << "current-time" << kNext << Time();
msg.WriteToLogFile();
@@ -1222,7 +1232,7 @@ TIMER_EVENTS_LIST(V)
#undef V
void V8FileLogger::NewEvent(const char* name, void* object, size_t size) {
- if (!FLAG_log) return;
+ if (!v8_flags.log) return;
MSG_BUILDER();
msg << "new" << kNext << name << kNext << object << kNext
<< static_cast<unsigned int>(size);
@@ -1230,7 +1240,7 @@ void V8FileLogger::NewEvent(const char* name, void* object, size_t size) {
}
void V8FileLogger::DeleteEvent(const char* name, void* object) {
- if (!FLAG_log) return;
+ if (!v8_flags.log) return;
MSG_BUILDER();
msg << "delete" << kNext << name << kNext << object;
msg.WriteToLogFile();
@@ -1288,7 +1298,7 @@ void V8FileLogger::LogSourceCodeInformation(Handle<AbstractCode> code,
Script script = Script::cast(script_object);
EnsureLogScriptSource(script);
- if (!FLAG_log_source_position) return;
+ if (!v8_flags.log_source_position) return;
MSG_BUILDER();
msg << "code-source-info" << V8FileLogger::kNext
<< reinterpret_cast<void*>(code->InstructionStart(cage_base))
@@ -1349,7 +1359,7 @@ void V8FileLogger::LogSourceCodeInformation(Handle<AbstractCode> code,
}
void V8FileLogger::LogCodeDisassemble(Handle<AbstractCode> code) {
- if (!FLAG_log_code_disassemble) return;
+ if (!v8_flags.log_code_disassemble) return;
PtrComprCageBase cage_base(isolate_);
MSG_BUILDER();
msg << "code-disassemble" << V8FileLogger::kNext
@@ -1380,7 +1390,7 @@ void V8FileLogger::LogCodeDisassemble(Handle<AbstractCode> code) {
void V8FileLogger::CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
const char* name) {
if (!is_listening_to_code_events()) return;
- if (!FLAG_log_code) return;
+ if (!v8_flags.log_code) return;
{
MSG_BUILDER();
AppendCodeCreateHeader(isolate_, msg, tag, *code, Time());
@@ -1393,7 +1403,7 @@ void V8FileLogger::CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
void V8FileLogger::CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<Name> name) {
if (!is_listening_to_code_events()) return;
- if (!FLAG_log_code) return;
+ if (!v8_flags.log_code) return;
{
MSG_BUILDER();
AppendCodeCreateHeader(isolate_, msg, tag, *code, Time());
@@ -1408,7 +1418,7 @@ void V8FileLogger::CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<SharedFunctionInfo> shared,
Handle<Name> script_name) {
if (!is_listening_to_code_events()) return;
- if (!FLAG_log_code) return;
+ if (!v8_flags.log_code) return;
if (*code ==
AbstractCode::cast(isolate_->builtins()->code(Builtin::kCompileLazy))) {
return;
@@ -1427,7 +1437,7 @@ void V8FileLogger::CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
void V8FileLogger::FeedbackVectorEvent(FeedbackVector vector,
AbstractCode code) {
DisallowGarbageCollection no_gc;
- if (!FLAG_log_feedback_vector) return;
+ if (!v8_flags.log_feedback_vector) return;
PtrComprCageBase cage_base(isolate_);
MSG_BUILDER();
msg << "feedback-vector" << kNext << Time();
@@ -1460,7 +1470,7 @@ void V8FileLogger::CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<Name> script_name, int line,
int column) {
if (!is_listening_to_code_events()) return;
- if (!FLAG_log_code) return;
+ if (!v8_flags.log_code) return;
{
MSG_BUILDER();
AppendCodeCreateHeader(isolate_, msg, tag, *code, Time());
@@ -1480,7 +1490,7 @@ void V8FileLogger::CodeCreateEvent(CodeTag tag, const wasm::WasmCode* code,
const char* /*source_url*/,
int /*code_offset*/, int /*script_id*/) {
if (!is_listening_to_code_events()) return;
- if (!FLAG_log_code) return;
+ if (!v8_flags.log_code) return;
MSG_BUILDER();
AppendCodeCreateHeader(msg, tag, CodeKind::WASM_FUNCTION,
code->instructions().begin(),
@@ -1502,7 +1512,7 @@ void V8FileLogger::CodeCreateEvent(CodeTag tag, const wasm::WasmCode* code,
void V8FileLogger::CallbackEventInternal(const char* prefix, Handle<Name> name,
Address entry_point) {
- if (!FLAG_log_code) return;
+ if (!v8_flags.log_code) return;
MSG_BUILDER();
msg << Event::kCodeCreation << kNext << CodeTag::kCallback << kNext << -2
<< kNext << Time() << kNext << reinterpret_cast<void*>(entry_point)
@@ -1525,7 +1535,7 @@ void V8FileLogger::SetterCallbackEvent(Handle<Name> name, Address entry_point) {
void V8FileLogger::RegExpCodeCreateEvent(Handle<AbstractCode> code,
Handle<String> source) {
if (!is_listening_to_code_events()) return;
- if (!FLAG_log_code) return;
+ if (!v8_flags.log_code) return;
MSG_BUILDER();
AppendCodeCreateHeader(isolate_, msg, LogEventListener::CodeTag::kRegExp,
*code, Time());
@@ -1547,14 +1557,14 @@ void V8FileLogger::SharedFunctionInfoMoveEvent(Address from, Address to) {
void V8FileLogger::CodeMovingGCEvent() {
if (!is_listening_to_code_events()) return;
- if (!FLAG_ll_prof) return;
+ if (!v8_flags.ll_prof) return;
base::OS::SignalCodeMovingGC();
}
void V8FileLogger::CodeDisableOptEvent(Handle<AbstractCode> code,
Handle<SharedFunctionInfo> shared) {
if (!is_listening_to_code_events()) return;
- if (!FLAG_log_code) return;
+ if (!v8_flags.log_code) return;
MSG_BUILDER();
msg << Event::kCodeDisableOpt << kNext << shared->DebugNameCStr().get()
<< kNext << GetBailoutReason(shared->disabled_optimization_reason());
@@ -1585,7 +1595,7 @@ void V8FileLogger::ProcessDeoptEvent(Handle<Code> code, SourcePosition position,
void V8FileLogger::CodeDeoptEvent(Handle<Code> code, DeoptimizeKind kind,
Address pc, int fp_to_sp_delta) {
- if (!is_logging() || !FLAG_log_deopt) return;
+ if (!is_logging() || !v8_flags.log_deopt) return;
Deoptimizer::DeoptInfo info = Deoptimizer::GetDeoptInfo(*code, pc);
ProcessDeoptEvent(code, info.position, Deoptimizer::MessageFor(kind),
DeoptimizeReasonToString(info.deopt_reason));
@@ -1594,7 +1604,7 @@ void V8FileLogger::CodeDeoptEvent(Handle<Code> code, DeoptimizeKind kind,
void V8FileLogger::CodeDependencyChangeEvent(Handle<Code> code,
Handle<SharedFunctionInfo> sfi,
const char* reason) {
- if (!is_logging() || !FLAG_log_deopt) return;
+ if (!is_logging() || !v8_flags.log_deopt) return;
SourcePosition position(sfi->StartPosition(), -1);
ProcessDeoptEvent(code, position, "dependency-change", reason);
}
@@ -1647,7 +1657,7 @@ void V8FileLogger::CodeNameEvent(Address addr, int pos, const char* code_name) {
}
void V8FileLogger::MoveEventInternal(Event event, Address from, Address to) {
- if (!FLAG_log_code) return;
+ if (!v8_flags.log_code) return;
MSG_BUILDER();
msg << event << kNext << reinterpret_cast<void*>(from) << kNext
<< reinterpret_cast<void*>(to);
@@ -1661,7 +1671,7 @@ void AppendFunctionMessage(LogFile::MessageBuilder& msg, const char* reason,
msg << "function" << V8FileLogger::kNext << reason << V8FileLogger::kNext
<< script_id << V8FileLogger::kNext << start_position
<< V8FileLogger::kNext << end_position << V8FileLogger::kNext;
- if (V8_UNLIKELY(FLAG_predictable)) {
+ if (V8_UNLIKELY(v8_flags.predictable)) {
msg << 0.1;
} else {
msg << time_delta;
@@ -1757,7 +1767,7 @@ void V8FileLogger::ScriptDetails(Script script) {
}
bool V8FileLogger::EnsureLogScriptSource(Script script) {
- if (!FLAG_log_source_code) return true;
+ if (!v8_flags.log_source_code) return true;
// Make sure the script is written to the log file.
int script_id = script.id();
if (logged_source_code_.find(script_id) != logged_source_code_.end()) {
@@ -1800,7 +1810,7 @@ void V8FileLogger::RuntimeCallTimerEvent() {
}
void V8FileLogger::TickEvent(TickSample* sample, bool overflow) {
- if (!FLAG_prof_cpp) return;
+ if (!v8_flags.prof_cpp) return;
if (V8_UNLIKELY(TracingFlags::runtime_stats.load(std::memory_order_relaxed) ==
v8::tracing::TracingCategoryObserver::ENABLED_BY_NATIVE)) {
RuntimeCallTimerEvent();
@@ -1825,7 +1835,7 @@ void V8FileLogger::TickEvent(TickSample* sample, bool overflow) {
void V8FileLogger::ICEvent(const char* type, bool keyed, Handle<Map> map,
Handle<Object> key, char old_state, char new_state,
const char* modifier, const char* slow_stub_reason) {
- if (!FLAG_log_ic) return;
+ if (!v8_flags.log_ic) return;
int line;
int column;
// GetAbstractPC must come before MSG_BUILDER(), as it can GC, which might
@@ -1854,7 +1864,7 @@ void V8FileLogger::ICEvent(const char* type, bool keyed, Handle<Map> map,
void V8FileLogger::MapEvent(const char* type, Handle<Map> from, Handle<Map> to,
const char* reason,
Handle<HeapObject> name_or_sfi) {
- if (!FLAG_log_maps) return;
+ if (!v8_flags.log_maps) return;
if (!to.is_null()) MapDetails(*to);
int line = -1;
int column = -1;
@@ -1885,7 +1895,7 @@ void V8FileLogger::MapEvent(const char* type, Handle<Map> from, Handle<Map> to,
}
void V8FileLogger::MapCreate(Map map) {
- if (!FLAG_log_maps) return;
+ if (!v8_flags.log_maps) return;
DisallowGarbageCollection no_gc;
MSG_BUILDER();
msg << "map-create" << kNext << Time() << kNext << AsHex::Address(map.ptr());
@@ -1893,12 +1903,12 @@ void V8FileLogger::MapCreate(Map map) {
}
void V8FileLogger::MapDetails(Map map) {
- if (!FLAG_log_maps) return;
+ if (!v8_flags.log_maps) return;
DisallowGarbageCollection no_gc;
MSG_BUILDER();
msg << "map-details" << kNext << Time() << kNext << AsHex::Address(map.ptr())
<< kNext;
- if (FLAG_log_maps_details) {
+ if (v8_flags.log_maps_details) {
std::ostringstream buffer;
map.PrintMapDetails(buffer);
msg << buffer.str().c_str();
@@ -1913,6 +1923,17 @@ EnumerateCompiledFunctions(Heap* heap) {
std::vector<std::pair<Handle<SharedFunctionInfo>, Handle<AbstractCode>>>
compiled_funcs;
Isolate* isolate = heap->isolate();
+ auto hash = [](const std::pair<SharedFunctionInfo, AbstractCode>& p) {
+ return base::hash_combine(p.first.address(), p.second.address());
+ };
+ std::unordered_set<std::pair<SharedFunctionInfo, AbstractCode>,
+ decltype(hash)>
+ seen(8, hash);
+
+ auto record = [&](SharedFunctionInfo sfi, AbstractCode c) {
+ if (auto [iter, inserted] = seen.emplace(sfi, c); inserted)
+ compiled_funcs.emplace_back(handle(sfi, isolate), handle(c, isolate));
+ };
// Iterate the heap to find JSFunctions and record their optimized code.
for (HeapObject obj = iterator.Next(); !obj.is_null();
@@ -1920,9 +1941,7 @@ EnumerateCompiledFunctions(Heap* heap) {
if (obj.IsSharedFunctionInfo()) {
SharedFunctionInfo sfi = SharedFunctionInfo::cast(obj);
if (sfi.is_compiled() && !sfi.HasBytecodeArray()) {
- compiled_funcs.emplace_back(
- handle(sfi, isolate),
- handle(AbstractCode::cast(sfi.abstract_code(isolate)), isolate));
+ record(sfi, AbstractCode::cast(sfi.abstract_code(isolate)));
}
} else if (obj.IsJSFunction()) {
// Given that we no longer iterate over all optimized JSFunctions, we need
@@ -1933,9 +1952,8 @@ EnumerateCompiledFunctions(Heap* heap) {
// only on a type feedback vector. We should make this mroe precise.
if (function.HasAttachedOptimizedCode() &&
Script::cast(function.shared().script()).HasValidSource()) {
- compiled_funcs.emplace_back(
- handle(function.shared(), isolate),
- handle(AbstractCode::cast(FromCodeT(function.code())), isolate));
+ record(function.shared(),
+ AbstractCode::cast(FromCodeT(function.code())));
}
}
}
@@ -1949,9 +1967,7 @@ EnumerateCompiledFunctions(Heap* heap) {
for (SharedFunctionInfo sfi = sfi_iterator.Next(); !sfi.is_null();
sfi = sfi_iterator.Next()) {
if (sfi.is_compiled()) {
- compiled_funcs.emplace_back(
- handle(sfi, isolate),
- handle(AbstractCode::cast(sfi.abstract_code(isolate)), isolate));
+ record(sfi, AbstractCode::cast(sfi.abstract_code(isolate)));
}
}
}
@@ -2013,7 +2029,7 @@ void V8FileLogger::LogAllMaps() {
}
static void AddIsolateIdIfNeeded(std::ostream& os, Isolate* isolate) {
- if (!FLAG_logfile_per_isolate) return;
+ if (!v8_flags.logfile_per_isolate) return;
os << "isolate-" << isolate << "-" << base::OS::GetCurrentProcessId() << "-";
}
@@ -2067,30 +2083,30 @@ bool V8FileLogger::SetUp(Isolate* isolate) {
is_initialized_ = true;
std::ostringstream log_file_name;
- PrepareLogFileName(log_file_name, isolate, FLAG_logfile);
+ PrepareLogFileName(log_file_name, isolate, v8_flags.logfile);
log_ = std::make_unique<LogFile>(this, log_file_name.str());
#if V8_OS_LINUX
- if (FLAG_perf_basic_prof) {
+ if (v8_flags.perf_basic_prof) {
perf_basic_logger_ = std::make_unique<LinuxPerfBasicLogger>(isolate);
AddLogEventListener(perf_basic_logger_.get());
}
- if (FLAG_perf_prof) {
+ if (v8_flags.perf_prof) {
perf_jit_logger_ = std::make_unique<LinuxPerfJitLogger>(isolate);
AddLogEventListener(perf_jit_logger_.get());
}
#else
static_assert(
- !FLAG_perf_prof.value(),
+ !v8_flags.perf_prof.value(),
"--perf-prof should be statically disabled on non-Linux platforms");
static_assert(
- !FLAG_perf_basic_prof.value(),
+ !v8_flags.perf_basic_prof.value(),
"--perf-basic-prof should be statically disabled on non-Linux platforms");
#endif
#ifdef ENABLE_GDB_JIT_INTERFACE
- if (i::FLAG_gdbjit) {
+ if (v8_flags.gdbjit) {
gdb_jit_logger_ =
std::make_unique<JitLogger>(isolate, i::GDBJITInterface::EventHandler);
AddLogEventListener(gdb_jit_logger_.get());
@@ -2098,25 +2114,16 @@ bool V8FileLogger::SetUp(Isolate* isolate) {
}
#endif // ENABLE_GDB_JIT_INTERFACE
-#if defined(V8_OS_WIN) && defined(V8_ENABLE_ETW_STACK_WALKING)
- if (i::FLAG_enable_etw_stack_walking) {
- etw_jit_logger_ =
- std::make_unique<JitLogger>(isolate, i::ETWJITInterface::EventHandler);
- AddLogEventListener(etw_jit_logger_.get());
- CHECK(isolate->logger()->is_listening_to_code_events());
- }
-#endif // defined(V8_OS_WIN)
-
- if (FLAG_ll_prof) {
+ if (v8_flags.ll_prof) {
ll_logger_ =
std::make_unique<LowLevelLogger>(isolate, log_file_name.str().c_str());
AddLogEventListener(ll_logger_.get());
}
- ticker_ = std::make_unique<Ticker>(isolate, FLAG_prof_sampling_interval);
- if (FLAG_log) UpdateIsLogging(true);
+ ticker_ = std::make_unique<Ticker>(isolate, v8_flags.prof_sampling_interval);
+ if (v8_flags.log) UpdateIsLogging(true);
timer_.Start();
- if (FLAG_prof_cpp) {
- CHECK(FLAG_log);
+ if (v8_flags.prof_cpp) {
+ CHECK(v8_flags.log);
CHECK(is_logging());
profiler_ = std::make_unique<Profiler>(isolate);
profiler_->Engage();
@@ -2133,6 +2140,42 @@ void V8FileLogger::LateSetup(Isolate* isolate) {
#endif
}
+#if defined(V8_OS_WIN) && defined(V8_ENABLE_ETW_STACK_WALKING)
+void V8FileLogger::SetEtwCodeEventHandler(uint32_t options) {
+ DCHECK(v8_flags.enable_etw_stack_walking);
+ isolate_->UpdateLogObjectRelocation();
+#if V8_ENABLE_WEBASSEMBLY
+ wasm::GetWasmEngine()->EnableCodeLogging(isolate_);
+#endif // V8_ENABLE_WEBASSEMBLY
+
+ if (!etw_jit_logger_) {
+ etw_jit_logger_ = std::make_unique<ETWJitLogger>(isolate_);
+ AddLogEventListener(etw_jit_logger_.get());
+ CHECK(isolate_->logger()->is_listening_to_code_events());
+ }
+
+ if (options & kJitCodeEventEnumExisting) {
+ // TODO(v8:11043) Here we log the existing code to all the listeners
+ // registered to this Isolate logger, while we should only log to the newly
+ // created ETWJitLogger. This should not generally be a problem because it
+ // is quite unlikely to have both file logger and ETW tracing both enabled
+ // by default.
+ HandleScope scope(isolate_);
+ LogBuiltins();
+ LogCodeObjects();
+ LogCompiledFunctions();
+ }
+}
+
+void V8FileLogger::ResetEtwCodeEventHandler() {
+ DCHECK(v8_flags.enable_etw_stack_walking);
+ if (etw_jit_logger_) {
+ RemoveLogEventListener(etw_jit_logger_.get());
+ etw_jit_logger_.reset();
+ }
+}
+#endif
+
void V8FileLogger::SetCodeEventHandler(uint32_t options,
JitCodeEventHandler event_handler) {
if (jit_logger_) {
diff --git a/deps/v8/src/logging/log.h b/deps/v8/src/logging/log.h
index 18560d78e2..339031c4ff 100644
--- a/deps/v8/src/logging/log.h
+++ b/deps/v8/src/logging/log.h
@@ -69,10 +69,14 @@ class Profiler;
class SourcePosition;
class Ticker;
+#if defined(V8_OS_WIN) && defined(V8_ENABLE_ETW_STACK_WALKING)
+class ETWJitLogger;
+#endif
+
#undef LOG
-#define LOG(isolate, Call) \
- do { \
- if (v8::internal::FLAG_log) (isolate)->v8_file_logger()->Call; \
+#define LOG(isolate, Call) \
+ do { \
+ if (v8::internal::v8_flags.log) (isolate)->v8_file_logger()->Call; \
} while (false)
#define LOG_CODE_EVENT(isolate, Call) \
@@ -134,6 +138,11 @@ class V8FileLogger : public LogEventListener {
// Sets the current code event handler.
void SetCodeEventHandler(uint32_t options, JitCodeEventHandler event_handler);
+#if defined(V8_OS_WIN) && defined(V8_ENABLE_ETW_STACK_WALKING)
+ void SetEtwCodeEventHandler(uint32_t options);
+ void ResetEtwCodeEventHandler();
+#endif
+
sampler::Sampler* sampler();
V8_EXPORT_PRIVATE std::string file_name() const;
@@ -261,7 +270,11 @@ class V8FileLogger : public LogEventListener {
V8_EXPORT_PRIVATE bool is_logging();
bool is_listening_to_code_events() override {
- return is_logging() || jit_logger_ != nullptr;
+ return
+#if defined(V8_OS_WIN) && defined(V8_ENABLE_ETW_STACK_WALKING)
+ etw_jit_logger_ != nullptr ||
+#endif
+ is_logging() || jit_logger_ != nullptr;
}
void LogExistingFunction(Handle<SharedFunctionInfo> shared,
@@ -299,7 +312,7 @@ class V8FileLogger : public LogEventListener {
void TickEvent(TickSample* sample, bool overflow);
void RuntimeCallTimerEvent();
- // Logs a StringEvent regardless of whether FLAG_log is true.
+ // Logs a StringEvent regardless of whether v8_flags.log is true.
void UncheckedStringEvent(const char* name, const char* value);
// Logs a scripts sources. Keeps track of all logged scripts to ensure that
@@ -345,7 +358,7 @@ class V8FileLogger : public LogEventListener {
std::unique_ptr<JitLogger> gdb_jit_logger_;
#endif
#if defined(V8_OS_WIN) && defined(V8_ENABLE_ETW_STACK_WALKING)
- std::unique_ptr<JitLogger> etw_jit_logger_;
+ std::unique_ptr<ETWJitLogger> etw_jit_logger_;
#endif
std::set<int> logged_source_code_;
uint32_t next_source_info_id_ = 0;
diff --git a/deps/v8/src/logging/runtime-call-stats.cc b/deps/v8/src/logging/runtime-call-stats.cc
index 82f3979bef..e9f5e1755f 100644
--- a/deps/v8/src/logging/runtime-call-stats.cc
+++ b/deps/v8/src/logging/runtime-call-stats.cc
@@ -157,7 +157,7 @@ RuntimeCallStats::RuntimeCallStats(ThreadType thread_type)
for (int i = 0; i < kNumberOfCounters; i++) {
this->counters_[i] = RuntimeCallCounter(kNames[i]);
}
- if (FLAG_rcs_cpu_time) {
+ if (v8_flags.rcs_cpu_time) {
CHECK(base::ThreadTicks::IsSupported());
base::ThreadTicks::WaitUntilInitialized();
RuntimeCallTimer::Now = &RuntimeCallTimer::NowCPUTime;
diff --git a/deps/v8/src/logging/runtime-call-stats.h b/deps/v8/src/logging/runtime-call-stats.h
index 4c02309b74..202c379f64 100644
--- a/deps/v8/src/logging/runtime-call-stats.h
+++ b/deps/v8/src/logging/runtime-call-stats.h
@@ -368,6 +368,7 @@ class RuntimeCallTimer final {
ADD_THREAD_SPECIFIC_COUNTER(V, Optimize, Scheduling) \
ADD_THREAD_SPECIFIC_COUNTER(V, Optimize, SelectInstructions) \
ADD_THREAD_SPECIFIC_COUNTER(V, Optimize, SimplifiedLowering) \
+ ADD_THREAD_SPECIFIC_COUNTER(V, Optimize, SimplifyLoops) \
ADD_THREAD_SPECIFIC_COUNTER(V, Optimize, StoreStoreElimination) \
ADD_THREAD_SPECIFIC_COUNTER(V, Optimize, TraceScheduleAndVerify) \
ADD_THREAD_SPECIFIC_COUNTER(V, Optimize, BuildTurboshaft) \
diff --git a/deps/v8/src/logging/tracing-flags.h b/deps/v8/src/logging/tracing-flags.h
index b3ccb896aa..7ebd8e3e19 100644
--- a/deps/v8/src/logging/tracing-flags.h
+++ b/deps/v8/src/logging/tracing-flags.h
@@ -13,8 +13,8 @@ namespace v8 {
namespace internal {
// This struct contains a set of flags that can be modified from multiple
-// threads at runtime unlike the normal FLAG_-like flags which are not modified
-// after V8 instance is initialized.
+// threads at runtime unlike the normal v8_flags.-like flags which are not
+// modified after V8 instance is initialized.
struct TracingFlags {
static V8_EXPORT_PRIVATE std::atomic_uint runtime_stats;