Commit f6c8cd8d authored by Camillo Bruni's avatar Camillo Bruni Committed by V8 LUCI CQ

[log] Rename LogEventDispatcher to Logger

Next steps: Move general code from V8FileLogger to Logger

Bug: v8:12795, chromium:1316443
Change-Id: I66e0d7d3908a2a24cd1cf3858834bd57314754b9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3637795
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80537}
parent fc2b353c
...@@ -291,7 +291,7 @@ void Compiler::LogFunctionCompilation(Isolate* isolate, ...@@ -291,7 +291,7 @@ void Compiler::LogFunctionCompilation(Isolate* isolate,
// enabled as finding the line number is not free. // enabled as finding the line number is not free.
if (!isolate->v8_file_logger()->is_listening_to_code_events() && if (!isolate->v8_file_logger()->is_listening_to_code_events() &&
!isolate->is_profiling() && !FLAG_log_function_events && !isolate->is_profiling() && !FLAG_log_function_events &&
!isolate->log_event_dispatcher()->is_listening_to_code_events()) { !isolate->logger()->is_listening_to_code_events()) {
return; return;
} }
......
...@@ -3255,7 +3255,7 @@ Isolate::Isolate(std::unique_ptr<i::IsolateAllocator> isolate_allocator, ...@@ -3255,7 +3255,7 @@ Isolate::Isolate(std::unique_ptr<i::IsolateAllocator> isolate_allocator,
num_active_deserializers_(0), num_active_deserializers_(0),
#endif #endif
rail_mode_(PERFORMANCE_ANIMATION), rail_mode_(PERFORMANCE_ANIMATION),
log_event_dispatcher_(new LogEventDispatcher()), logger_(new Logger()),
detailed_source_positions_for_profiling_(FLAG_detailed_line_info), detailed_source_positions_for_profiling_(FLAG_detailed_line_info),
persistent_handles_list_(new PersistentHandlesList()), persistent_handles_list_(new PersistentHandlesList()),
jitless_(FLAG_jitless), jitless_(FLAG_jitless),
...@@ -3491,8 +3491,8 @@ void Isolate::Deinit() { ...@@ -3491,8 +3491,8 @@ void Isolate::Deinit() {
delete ast_string_constants_; delete ast_string_constants_;
ast_string_constants_ = nullptr; ast_string_constants_ = nullptr;
delete log_event_dispatcher_; delete logger_;
log_event_dispatcher_ = nullptr; logger_ = nullptr;
delete root_index_map_; delete root_index_map_;
root_index_map_ = nullptr; root_index_map_ = nullptr;
......
...@@ -100,7 +100,7 @@ class AstStringConstants; ...@@ -100,7 +100,7 @@ class AstStringConstants;
class Bootstrapper; class Bootstrapper;
class BuiltinsConstantsTableBuilder; class BuiltinsConstantsTableBuilder;
class CancelableTaskManager; class CancelableTaskManager;
class LogEventDispatcher; class Logger;
class CodeTracer; class CodeTracer;
class CommonFrame; class CommonFrame;
class CompilationCache; class CompilationCache;
...@@ -1345,9 +1345,7 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory { ...@@ -1345,9 +1345,7 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
is_profiling_.store(enabled, std::memory_order_relaxed); is_profiling_.store(enabled, std::memory_order_relaxed);
} }
LogEventDispatcher* log_event_dispatcher() const { Logger* logger() const { return logger_; }
return log_event_dispatcher_;
}
HeapProfiler* heap_profiler() const { return heap_profiler_; } HeapProfiler* heap_profiler() const { return heap_profiler_; }
#ifdef DEBUG #ifdef DEBUG
...@@ -2253,7 +2251,7 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory { ...@@ -2253,7 +2251,7 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
Debug* debug_ = nullptr; Debug* debug_ = nullptr;
HeapProfiler* heap_profiler_ = nullptr; HeapProfiler* heap_profiler_ = nullptr;
LogEventDispatcher* log_event_dispatcher_ = nullptr; Logger* logger_ = nullptr;
const AstStringConstants* ast_string_constants_ = nullptr; const AstStringConstants* ast_string_constants_ = nullptr;
......
...@@ -61,7 +61,7 @@ using WasmName = base::Vector<const char>; ...@@ -61,7 +61,7 @@ using WasmName = base::Vector<const char>;
LOG_EVENTS_LIST(V) \ LOG_EVENTS_LIST(V) \
TAGS_LIST(V) TAGS_LIST(V)
#define PROFILE(the_isolate, Call) (the_isolate)->log_event_dispatcher()->Call; #define PROFILE(the_isolate, Call) (the_isolate)->logger()->Call;
class LogEventListener { class LogEventListener {
public: public:
...@@ -117,13 +117,13 @@ class LogEventListener { ...@@ -117,13 +117,13 @@ class LogEventListener {
}; };
// Dispatches code events to a set of registered listeners. // Dispatches code events to a set of registered listeners.
class LogEventDispatcher { class Logger {
public: public:
using LogEventsAndTags = LogEventListener::LogEventsAndTags; using LogEventsAndTags = LogEventListener::LogEventsAndTags;
LogEventDispatcher() = default; Logger() = default;
LogEventDispatcher(const LogEventDispatcher&) = delete; Logger(const Logger&) = delete;
LogEventDispatcher& operator=(const LogEventDispatcher&) = delete; Logger& operator=(const Logger&) = delete;
bool AddListener(LogEventListener* listener) { bool AddListener(LogEventListener* listener) {
base::MutexGuard guard(&mutex_); base::MutexGuard guard(&mutex_);
......
...@@ -429,7 +429,7 @@ void ExternalLogEventListener::StartListening( ...@@ -429,7 +429,7 @@ void ExternalLogEventListener::StartListening(
return; return;
} }
code_event_handler_ = code_event_handler; code_event_handler_ = code_event_handler;
is_listening_ = isolate_->log_event_dispatcher()->AddListener(this); is_listening_ = isolate_->logger()->AddListener(this);
if (is_listening_) { if (is_listening_) {
LogExistingCode(); LogExistingCode();
} }
...@@ -440,7 +440,7 @@ void ExternalLogEventListener::StopListening() { ...@@ -440,7 +440,7 @@ void ExternalLogEventListener::StopListening() {
return; return;
} }
isolate_->log_event_dispatcher()->RemoveListener(this); isolate_->logger()->RemoveListener(this);
is_listening_ = false; is_listening_ = false;
} }
...@@ -1088,12 +1088,12 @@ int64_t V8FileLogger::Time() { ...@@ -1088,12 +1088,12 @@ int64_t V8FileLogger::Time() {
} }
void V8FileLogger::AddLogEventListener(LogEventListener* listener) { void V8FileLogger::AddLogEventListener(LogEventListener* listener) {
bool result = isolate_->log_event_dispatcher()->AddListener(listener); bool result = isolate_->logger()->AddListener(listener);
CHECK(result); CHECK(result);
} }
void V8FileLogger::RemoveLogEventListener(LogEventListener* listener) { void V8FileLogger::RemoveLogEventListener(LogEventListener* listener) {
isolate_->log_event_dispatcher()->RemoveListener(listener); isolate_->logger()->RemoveListener(listener);
} }
void V8FileLogger::ProfilerBeginEvent() { void V8FileLogger::ProfilerBeginEvent() {
...@@ -2068,7 +2068,7 @@ bool V8FileLogger::SetUp(Isolate* isolate) { ...@@ -2068,7 +2068,7 @@ bool V8FileLogger::SetUp(Isolate* isolate) {
gdb_jit_logger_ = gdb_jit_logger_ =
std::make_unique<JitLogger>(isolate, i::GDBJITInterface::EventHandler); std::make_unique<JitLogger>(isolate, i::GDBJITInterface::EventHandler);
AddLogEventListener(gdb_jit_logger_.get()); AddLogEventListener(gdb_jit_logger_.get());
CHECK(isolate->log_event_dispatcher()->is_listening_to_code_events()); CHECK(isolate->logger()->is_listening_to_code_events());
} }
#endif // ENABLE_GDB_JIT_INTERFACE #endif // ENABLE_GDB_JIT_INTERFACE
...@@ -2077,7 +2077,7 @@ bool V8FileLogger::SetUp(Isolate* isolate) { ...@@ -2077,7 +2077,7 @@ bool V8FileLogger::SetUp(Isolate* isolate) {
etw_jit_logger_ = etw_jit_logger_ =
std::make_unique<JitLogger>(isolate, i::ETWJITInterface::EventHandler); std::make_unique<JitLogger>(isolate, i::ETWJITInterface::EventHandler);
AddLogEventListener(etw_jit_logger_.get()); AddLogEventListener(etw_jit_logger_.get());
CHECK(isolate->log_event_dispatcher()->is_listening_to_code_events()); CHECK(isolate->logger()->is_listening_to_code_events());
} }
#endif // defined(V8_OS_WIN) #endif // defined(V8_OS_WIN)
...@@ -2100,7 +2100,7 @@ bool V8FileLogger::SetUp(Isolate* isolate) { ...@@ -2100,7 +2100,7 @@ bool V8FileLogger::SetUp(Isolate* isolate) {
} }
void V8FileLogger::LateSetup(Isolate* isolate) { void V8FileLogger::LateSetup(Isolate* isolate) {
if (!isolate->log_event_dispatcher()->is_listening_to_code_events()) return; if (!isolate->logger()->is_listening_to_code_events()) return;
Builtins::EmitCodeCreateEvents(isolate); Builtins::EmitCodeCreateEvents(isolate);
#if V8_ENABLE_WEBASSEMBLY #if V8_ENABLE_WEBASSEMBLY
wasm::GetWasmEngine()->EnableCodeLogging(isolate); wasm::GetWasmEngine()->EnableCodeLogging(isolate);
......
...@@ -1588,7 +1588,7 @@ RUNTIME_FUNCTION(Runtime_EnableCodeLoggingForTesting) { ...@@ -1588,7 +1588,7 @@ RUNTIME_FUNCTION(Runtime_EnableCodeLoggingForTesting) {
#if V8_ENABLE_WEBASSEMBLY #if V8_ENABLE_WEBASSEMBLY
wasm::GetWasmEngine()->EnableCodeLogging(isolate); wasm::GetWasmEngine()->EnableCodeLogging(isolate);
#endif // V8_ENABLE_WEBASSEMBLY #endif // V8_ENABLE_WEBASSEMBLY
isolate->log_event_dispatcher()->AddListener(noop_listener.get()); isolate->logger()->AddListener(noop_listener.get());
return ReadOnlyRoots(isolate).undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
......
...@@ -356,7 +356,7 @@ void FinalizeDeserialization(Isolate* isolate, ...@@ -356,7 +356,7 @@ void FinalizeDeserialization(Isolate* isolate,
const bool log_code_creation = const bool log_code_creation =
isolate->v8_file_logger()->is_listening_to_code_events() || isolate->v8_file_logger()->is_listening_to_code_events() ||
isolate->is_profiling() || isolate->is_profiling() ||
isolate->log_event_dispatcher()->is_listening_to_code_events(); isolate->logger()->is_listening_to_code_events();
#ifndef V8_TARGET_ARCH_ARM #ifndef V8_TARGET_ARCH_ARM
if (V8_UNLIKELY(FLAG_interpreted_frames_native_stack)) if (V8_UNLIKELY(FLAG_interpreted_frames_native_stack))
......
...@@ -214,7 +214,7 @@ bool WasmCode::ShouldBeLogged(Isolate* isolate) { ...@@ -214,7 +214,7 @@ bool WasmCode::ShouldBeLogged(Isolate* isolate) {
// to call {WasmEngine::EnableCodeLogging} if this return value would change // to call {WasmEngine::EnableCodeLogging} if this return value would change
// for any isolate. Otherwise we might lose code events. // for any isolate. Otherwise we might lose code events.
return isolate->v8_file_logger()->is_listening_to_code_events() || return isolate->v8_file_logger()->is_listening_to_code_events() ||
isolate->log_event_dispatcher()->is_listening_to_code_events() || isolate->logger()->is_listening_to_code_events() ||
isolate->is_profiling(); isolate->is_profiling();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment