[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: Andreas Haas <ahaas@chromium.org> Reviewed-by: Toon Verwaest <verwaest@chromium.org> Cr-Commit-Position: refs/heads/main@{#80537}
This commit is contained in:
parent
fc2b353c65
commit
f6c8cd8dac
@ -291,7 +291,7 @@ void Compiler::LogFunctionCompilation(Isolate* isolate,
|
||||
// enabled as finding the line number is not free.
|
||||
if (!isolate->v8_file_logger()->is_listening_to_code_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;
|
||||
}
|
||||
|
||||
|
@ -3255,7 +3255,7 @@ Isolate::Isolate(std::unique_ptr<i::IsolateAllocator> isolate_allocator,
|
||||
num_active_deserializers_(0),
|
||||
#endif
|
||||
rail_mode_(PERFORMANCE_ANIMATION),
|
||||
log_event_dispatcher_(new LogEventDispatcher()),
|
||||
logger_(new Logger()),
|
||||
detailed_source_positions_for_profiling_(FLAG_detailed_line_info),
|
||||
persistent_handles_list_(new PersistentHandlesList()),
|
||||
jitless_(FLAG_jitless),
|
||||
@ -3491,8 +3491,8 @@ void Isolate::Deinit() {
|
||||
delete ast_string_constants_;
|
||||
ast_string_constants_ = nullptr;
|
||||
|
||||
delete log_event_dispatcher_;
|
||||
log_event_dispatcher_ = nullptr;
|
||||
delete logger_;
|
||||
logger_ = nullptr;
|
||||
|
||||
delete root_index_map_;
|
||||
root_index_map_ = nullptr;
|
||||
|
@ -100,7 +100,7 @@ class AstStringConstants;
|
||||
class Bootstrapper;
|
||||
class BuiltinsConstantsTableBuilder;
|
||||
class CancelableTaskManager;
|
||||
class LogEventDispatcher;
|
||||
class Logger;
|
||||
class CodeTracer;
|
||||
class CommonFrame;
|
||||
class CompilationCache;
|
||||
@ -1345,9 +1345,7 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
|
||||
is_profiling_.store(enabled, std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
LogEventDispatcher* log_event_dispatcher() const {
|
||||
return log_event_dispatcher_;
|
||||
}
|
||||
Logger* logger() const { return logger_; }
|
||||
HeapProfiler* heap_profiler() const { return heap_profiler_; }
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -2253,7 +2251,7 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
|
||||
|
||||
Debug* debug_ = nullptr;
|
||||
HeapProfiler* heap_profiler_ = nullptr;
|
||||
LogEventDispatcher* log_event_dispatcher_ = nullptr;
|
||||
Logger* logger_ = nullptr;
|
||||
|
||||
const AstStringConstants* ast_string_constants_ = nullptr;
|
||||
|
||||
|
@ -61,7 +61,7 @@ using WasmName = base::Vector<const char>;
|
||||
LOG_EVENTS_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 {
|
||||
public:
|
||||
@ -117,13 +117,13 @@ class LogEventListener {
|
||||
};
|
||||
|
||||
// Dispatches code events to a set of registered listeners.
|
||||
class LogEventDispatcher {
|
||||
class Logger {
|
||||
public:
|
||||
using LogEventsAndTags = LogEventListener::LogEventsAndTags;
|
||||
|
||||
LogEventDispatcher() = default;
|
||||
LogEventDispatcher(const LogEventDispatcher&) = delete;
|
||||
LogEventDispatcher& operator=(const LogEventDispatcher&) = delete;
|
||||
Logger() = default;
|
||||
Logger(const Logger&) = delete;
|
||||
Logger& operator=(const Logger&) = delete;
|
||||
|
||||
bool AddListener(LogEventListener* listener) {
|
||||
base::MutexGuard guard(&mutex_);
|
||||
|
@ -429,7 +429,7 @@ void ExternalLogEventListener::StartListening(
|
||||
return;
|
||||
}
|
||||
code_event_handler_ = code_event_handler;
|
||||
is_listening_ = isolate_->log_event_dispatcher()->AddListener(this);
|
||||
is_listening_ = isolate_->logger()->AddListener(this);
|
||||
if (is_listening_) {
|
||||
LogExistingCode();
|
||||
}
|
||||
@ -440,7 +440,7 @@ void ExternalLogEventListener::StopListening() {
|
||||
return;
|
||||
}
|
||||
|
||||
isolate_->log_event_dispatcher()->RemoveListener(this);
|
||||
isolate_->logger()->RemoveListener(this);
|
||||
is_listening_ = false;
|
||||
}
|
||||
|
||||
@ -1088,12 +1088,12 @@ int64_t V8FileLogger::Time() {
|
||||
}
|
||||
|
||||
void V8FileLogger::AddLogEventListener(LogEventListener* listener) {
|
||||
bool result = isolate_->log_event_dispatcher()->AddListener(listener);
|
||||
bool result = isolate_->logger()->AddListener(listener);
|
||||
CHECK(result);
|
||||
}
|
||||
|
||||
void V8FileLogger::RemoveLogEventListener(LogEventListener* listener) {
|
||||
isolate_->log_event_dispatcher()->RemoveListener(listener);
|
||||
isolate_->logger()->RemoveListener(listener);
|
||||
}
|
||||
|
||||
void V8FileLogger::ProfilerBeginEvent() {
|
||||
@ -2068,7 +2068,7 @@ bool V8FileLogger::SetUp(Isolate* isolate) {
|
||||
gdb_jit_logger_ =
|
||||
std::make_unique<JitLogger>(isolate, i::GDBJITInterface::EventHandler);
|
||||
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
|
||||
|
||||
@ -2077,7 +2077,7 @@ bool V8FileLogger::SetUp(Isolate* isolate) {
|
||||
etw_jit_logger_ =
|
||||
std::make_unique<JitLogger>(isolate, i::ETWJITInterface::EventHandler);
|
||||
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)
|
||||
|
||||
@ -2100,7 +2100,7 @@ bool V8FileLogger::SetUp(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);
|
||||
#if V8_ENABLE_WEBASSEMBLY
|
||||
wasm::GetWasmEngine()->EnableCodeLogging(isolate);
|
||||
|
@ -1588,7 +1588,7 @@ RUNTIME_FUNCTION(Runtime_EnableCodeLoggingForTesting) {
|
||||
#if V8_ENABLE_WEBASSEMBLY
|
||||
wasm::GetWasmEngine()->EnableCodeLogging(isolate);
|
||||
#endif // V8_ENABLE_WEBASSEMBLY
|
||||
isolate->log_event_dispatcher()->AddListener(noop_listener.get());
|
||||
isolate->logger()->AddListener(noop_listener.get());
|
||||
return ReadOnlyRoots(isolate).undefined_value();
|
||||
}
|
||||
|
||||
|
@ -356,7 +356,7 @@ void FinalizeDeserialization(Isolate* isolate,
|
||||
const bool log_code_creation =
|
||||
isolate->v8_file_logger()->is_listening_to_code_events() ||
|
||||
isolate->is_profiling() ||
|
||||
isolate->log_event_dispatcher()->is_listening_to_code_events();
|
||||
isolate->logger()->is_listening_to_code_events();
|
||||
|
||||
#ifndef V8_TARGET_ARCH_ARM
|
||||
if (V8_UNLIKELY(FLAG_interpreted_frames_native_stack))
|
||||
|
@ -214,7 +214,7 @@ bool WasmCode::ShouldBeLogged(Isolate* isolate) {
|
||||
// to call {WasmEngine::EnableCodeLogging} if this return value would change
|
||||
// for any isolate. Otherwise we might lose 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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user