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

[log] Rename logging classes

i::Logger          => i::V8Log
i::PerfJitLogger   => i::LinuxPerfJitLogger
i::PerfBasicLogger => i::LinuxPerfBasicLogger

Note: V8Log is currently still managing instances of other loggers,
this functionality will be moved to a separate class in the future.

Bug: v8:12795, chromium:1316443
Change-Id: Id1b44e65abb7819eb6d6c718a1baa9ed61ad51aa
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3593133Reviewed-by: 's avatarJakob Linke <jgruber@chromium.org>
Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80016}
parent 9e55269b
......@@ -14,7 +14,7 @@
#include "src/execution/isolate.h"
#include "src/interpreter/bytecodes.h"
#include "src/logging/code-events.h" // For CodeCreateEvent.
#include "src/logging/log.h" // For Logger.
#include "src/logging/log.h" // For V8FileLogger.
#include "src/objects/fixed-array.h"
#include "src/objects/objects-inl.h"
#include "src/objects/visitors.h"
......
......@@ -57,7 +57,7 @@ EnsureInitProfileData() {
if (!std::getline(line_stream, token, ',')) continue;
if (token == ProfileDataFromFileConstants::kBlockCounterMarker) {
// Any line starting with kBlockCounterMarker is a block usage count.
// As defined by Logger::BasicBlockCounterEvent, the format is:
// As defined by V8FileLogger::BasicBlockCounterEvent, the format is:
// literal kBlockCounterMarker , builtin_name , block_id , usage_count
std::string builtin_name;
CHECK(std::getline(line_stream, builtin_name, ','));
......@@ -76,7 +76,7 @@ EnsureInitProfileData() {
counters_and_hash.AddCountToBlock(id, count);
} else if (token == ProfileDataFromFileConstants::kBuiltinHashMarker) {
// Any line starting with kBuiltinHashMarker is a function hash record.
// As defined by Logger::BuiltinHashEvent, the format is:
// As defined by V8FileLogger::BuiltinHashEvent, the format is:
// literal kBuiltinHashMarker , builtin_name , hash
std::string builtin_name;
CHECK(std::getline(line_stream, builtin_name, ','));
......
......@@ -274,7 +274,7 @@ void LogFunctionCompilation(Isolate* isolate,
: ReadOnlyRoots(isolate).empty_string(),
isolate);
LogEventListener::LogEventsAndTags log_tag =
Logger::ToNativeByScript(tag, *script);
V8FileLogger::ToNativeByScript(tag, *script);
PROFILE(isolate, CodeCreateEvent(log_tag, abstract_code, shared, script_name,
line_num, column_num));
if (!vector.is_null()) {
......@@ -1363,7 +1363,7 @@ void FinalizeUnoptimizedCompilation(
log_tag = flags.is_lazy_compile() ? LogEventListener::LAZY_COMPILE_TAG
: LogEventListener::FUNCTION_TAG;
}
log_tag = Logger::ToNativeByScript(log_tag, *script);
log_tag = V8FileLogger::ToNativeByScript(log_tag, *script);
if (FLAG_interpreted_frames_native_stack) {
InstallInterpreterTrampolineCopy(isolate, shared_info, log_tag);
}
......@@ -1534,7 +1534,7 @@ BackgroundCompileTask::BackgroundCompileTask(ScriptStreamingData* streamed_data,
function_literal_id_(kFunctionLiteralIdTopLevel) {
VMState<PARSER> state(isolate);
LOG(isolate, ScriptEvent(Logger::ScriptEventType::kStreamingCompile,
LOG(isolate, ScriptEvent(V8FileLogger::ScriptEventType::kStreamingCompile,
flags_.script_id()));
}
......
......@@ -388,7 +388,7 @@ void CodeGenerator::AssembleCode() {
}
}
// The PerfJitLogger logs code up until here, excluding the safepoint
// The LinuxPerfJitLogger logs code up until here, excluding the safepoint
// table. Resolve the unwinding info now so it is aware of the same code
// size as reported by perf.
unwinding_info_writer_.Finish(tasm()->pc_offset());
......
......@@ -29,7 +29,7 @@
#include "src/common/assert-scope.h"
// Only compile the {PerfJitLogger} on Linux.
// Only compile the {LinuxPerfJitLogger} on Linux.
#if V8_OS_LINUX
#include <fcntl.h>
......@@ -111,23 +111,24 @@ struct PerfJitCodeUnwindingInfo : PerfJitBase {
// Followed by size_ - sizeof(PerfJitCodeUnwindingInfo) bytes of data.
};
const char PerfJitLogger::kFilenameFormatString[] = "./jit-%d.dump";
const char LinuxPerfJitLogger::kFilenameFormatString[] = "./jit-%d.dump";
// Extra padding for the PID in the filename
const int PerfJitLogger::kFilenameBufferPadding = 16;
const int LinuxPerfJitLogger::kFilenameBufferPadding = 16;
static const char kStringTerminator[] = {'\0'};
static const char kRepeatedNameMarker[] = {'\xff', '\0'};
base::LazyRecursiveMutex PerfJitLogger::file_mutex_;
// The following static variables are protected by PerfJitLogger::file_mutex_.
int PerfJitLogger::process_id_ = 0;
uint64_t PerfJitLogger::reference_count_ = 0;
void* PerfJitLogger::marker_address_ = nullptr;
uint64_t PerfJitLogger::code_index_ = 0;
FILE* PerfJitLogger::perf_output_handle_ = nullptr;
base::LazyRecursiveMutex LinuxPerfJitLogger::file_mutex_;
// The following static variables are protected by
// LinuxPerfJitLogger::file_mutex_.
int LinuxPerfJitLogger::process_id_ = 0;
uint64_t LinuxPerfJitLogger::reference_count_ = 0;
void* LinuxPerfJitLogger::marker_address_ = nullptr;
uint64_t LinuxPerfJitLogger::code_index_ = 0;
FILE* LinuxPerfJitLogger::perf_output_handle_ = nullptr;
void PerfJitLogger::OpenJitDumpFile() {
void LinuxPerfJitLogger::OpenJitDumpFile() {
// Open the perf JIT dump file.
perf_output_handle_ = nullptr;
......@@ -153,13 +154,13 @@ void PerfJitLogger::OpenJitDumpFile() {
setvbuf(perf_output_handle_, nullptr, _IOFBF, kLogBufferSize);
}
void PerfJitLogger::CloseJitDumpFile() {
void LinuxPerfJitLogger::CloseJitDumpFile() {
if (perf_output_handle_ == nullptr) return;
base::Fclose(perf_output_handle_);
perf_output_handle_ = nullptr;
}
void* PerfJitLogger::OpenMarkerFile(int fd) {
void* LinuxPerfJitLogger::OpenMarkerFile(int fd) {
long page_size = sysconf(_SC_PAGESIZE); // NOLINT(runtime/int)
if (page_size == -1) return nullptr;
......@@ -171,14 +172,15 @@ void* PerfJitLogger::OpenMarkerFile(int fd) {
return (marker_address == MAP_FAILED) ? nullptr : marker_address;
}
void PerfJitLogger::CloseMarkerFile(void* marker_address) {
void LinuxPerfJitLogger::CloseMarkerFile(void* marker_address) {
if (marker_address == nullptr) return;
long page_size = sysconf(_SC_PAGESIZE); // NOLINT(runtime/int)
if (page_size == -1) return;
munmap(marker_address, page_size);
}
PerfJitLogger::PerfJitLogger(Isolate* isolate) : CodeEventLogger(isolate) {
LinuxPerfJitLogger::LinuxPerfJitLogger(Isolate* isolate)
: CodeEventLogger(isolate) {
base::LockGuard<base::RecursiveMutex> guard_file(file_mutex_.Pointer());
process_id_ = base::OS::GetCurrentProcessId();
......@@ -191,7 +193,7 @@ PerfJitLogger::PerfJitLogger(Isolate* isolate) : CodeEventLogger(isolate) {
}
}
PerfJitLogger::~PerfJitLogger() {
LinuxPerfJitLogger::~LinuxPerfJitLogger() {
base::LockGuard<base::RecursiveMutex> guard_file(file_mutex_.Pointer());
reference_count_--;
......@@ -201,7 +203,7 @@ PerfJitLogger::~PerfJitLogger() {
}
}
uint64_t PerfJitLogger::GetTimestamp() {
uint64_t LinuxPerfJitLogger::GetTimestamp() {
struct timespec ts;
int result = clock_gettime(CLOCK_MONOTONIC, &ts);
DCHECK_EQ(0, result);
......@@ -210,7 +212,7 @@ uint64_t PerfJitLogger::GetTimestamp() {
return (ts.tv_sec * kNsecPerSec) + ts.tv_nsec;
}
void PerfJitLogger::LogRecordedBuffer(
void LinuxPerfJitLogger::LogRecordedBuffer(
Handle<AbstractCode> abstract_code,
MaybeHandle<SharedFunctionInfo> maybe_shared, const char* name,
int length) {
......@@ -252,8 +254,8 @@ void PerfJitLogger::LogRecordedBuffer(
}
#if V8_ENABLE_WEBASSEMBLY
void PerfJitLogger::LogRecordedBuffer(const wasm::WasmCode* code,
const char* name, int length) {
void LinuxPerfJitLogger::LogRecordedBuffer(const wasm::WasmCode* code,
const char* name, int length) {
base::LockGuard<base::RecursiveMutex> guard_file(file_mutex_.Pointer());
if (perf_output_handle_ == nullptr) return;
......@@ -265,9 +267,10 @@ void PerfJitLogger::LogRecordedBuffer(const wasm::WasmCode* code,
}
#endif // V8_ENABLE_WEBASSEMBLY
void PerfJitLogger::WriteJitCodeLoadEntry(const uint8_t* code_pointer,
uint32_t code_size, const char* name,
int name_length) {
void LinuxPerfJitLogger::WriteJitCodeLoadEntry(const uint8_t* code_pointer,
uint32_t code_size,
const char* name,
int name_length) {
PerfJitCodeLoad code_load;
code_load.event_ = PerfJitCodeLoad::kLoad;
code_load.size_ = sizeof(code_load) + name_length + 1 + code_size;
......@@ -328,8 +331,8 @@ SourcePositionInfo GetSourcePositionInfo(Handle<Code> code,
} // namespace
void PerfJitLogger::LogWriteDebugInfo(Handle<Code> code,
Handle<SharedFunctionInfo> shared) {
void LinuxPerfJitLogger::LogWriteDebugInfo(Handle<Code> code,
Handle<SharedFunctionInfo> shared) {
// Line ends of all scripts have been initialized prior to this.
DisallowGarbageCollection no_gc;
// The WasmToJS wrapper stubs have source position entries.
......@@ -410,7 +413,7 @@ void PerfJitLogger::LogWriteDebugInfo(Handle<Code> code,
}
#if V8_ENABLE_WEBASSEMBLY
void PerfJitLogger::LogWriteDebugInfo(const wasm::WasmCode* code) {
void LinuxPerfJitLogger::LogWriteDebugInfo(const wasm::WasmCode* code) {
wasm::WasmModuleSourceMap* source_map =
code->native_module()->GetWasmSourceMap();
wasm::WireBytesRef code_ref =
......@@ -478,7 +481,7 @@ void PerfJitLogger::LogWriteDebugInfo(const wasm::WasmCode* code) {
}
#endif // V8_ENABLE_WEBASSEMBLY
void PerfJitLogger::LogWriteUnwindingInfo(Code code) {
void LinuxPerfJitLogger::LogWriteUnwindingInfo(Code code) {
PerfJitCodeUnwindingInfo unwinding_info_header;
unwinding_info_header.event_ = PerfJitCodeLoad::kUnwindingInfo;
unwinding_info_header.time_stamp_ = GetTimestamp();
......@@ -513,19 +516,19 @@ void PerfJitLogger::LogWriteUnwindingInfo(Code code) {
LogWriteBytes(padding_bytes, static_cast<int>(padding_size));
}
void PerfJitLogger::CodeMoveEvent(AbstractCode from, AbstractCode to) {
void LinuxPerfJitLogger::CodeMoveEvent(AbstractCode from, AbstractCode to) {
// We may receive a CodeMove event if a BytecodeArray object moves. Otherwise
// code relocation is not supported.
CHECK(from.IsBytecodeArray());
}
void PerfJitLogger::LogWriteBytes(const char* bytes, int size) {
void LinuxPerfJitLogger::LogWriteBytes(const char* bytes, int size) {
size_t rv = fwrite(bytes, 1, size, perf_output_handle_);
DCHECK(static_cast<size_t>(size) == rv);
USE(rv);
}
void PerfJitLogger::LogWriteHeader() {
void LinuxPerfJitLogger::LogWriteHeader() {
DCHECK_NOT_NULL(perf_output_handle_);
PerfJitHeader header;
......
......@@ -30,7 +30,7 @@
#include "include/v8config.h"
// {PerfJitLogger} is only implemented on Linux.
// {LinuxPerfJitLogger} is only implemented on Linux.
#if V8_OS_LINUX
#include "src/logging/log.h"
......@@ -39,10 +39,10 @@ namespace v8 {
namespace internal {
// Linux perf tool logging support.
class PerfJitLogger : public CodeEventLogger {
class LinuxPerfJitLogger : public CodeEventLogger {
public:
explicit PerfJitLogger(Isolate* isolate);
~PerfJitLogger() override;
explicit LinuxPerfJitLogger(Isolate* isolate);
~LinuxPerfJitLogger() override;
void CodeMoveEvent(AbstractCode from, AbstractCode to) override;
void CodeDisableOptEvent(Handle<AbstractCode> code,
......
......@@ -3637,7 +3637,7 @@ bool Isolate::InitializeCounters() {
void Isolate::InitializeLoggingAndCounters() {
if (logger_ == nullptr) {
logger_ = new Logger(this);
logger_ = new V8FileLogger(this);
}
InitializeCounters();
}
......@@ -4077,7 +4077,7 @@ bool Isolate::Init(SnapshotData* startup_snapshot_data,
init_memcopy_functions();
if (FLAG_log_internal_timer_events) {
set_event_logger(Logger::DefaultEventLoggerSentinel);
set_event_logger(V8FileLogger::DefaultEventLoggerSentinel);
}
if (FLAG_trace_turbo || FLAG_trace_turbo_graph || FLAG_turbo_profiling) {
......
......@@ -115,7 +115,7 @@ class HeapProfiler;
class InnerPointerToCodeCache;
class LazyCompileDispatcher;
class LocalIsolate;
class Logger;
class V8FileLogger;
class MaterializedObjectStore;
class Microtask;
class MicrotaskQueue;
......@@ -1111,7 +1111,7 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
}
TieringManager* tiering_manager() { return tiering_manager_; }
CompilationCache* compilation_cache() { return compilation_cache_; }
Logger* logger() {
V8FileLogger* logger() {
// Call InitializeLoggingAndCounters() if logging is needed before
// the isolate is fully initialized.
DCHECK_NOT_NULL(logger_);
......@@ -2098,7 +2098,7 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
base::SharedMutex shared_function_info_access_;
base::SharedMutex map_updater_access_;
base::SharedMutex boilerplate_migration_access_;
Logger* logger_ = nullptr;
V8FileLogger* logger_ = nullptr;
StubCache* load_stub_cache_ = nullptr;
StubCache* store_stub_cache_ = nullptr;
Deoptimizer* current_deoptimizer_ = nullptr;
......
......@@ -73,7 +73,7 @@ class V8_EXPORT_PRIVATE LocalIsolate final : private HiddenLocalFactory {
LazyCompileDispatcher* lazy_compile_dispatcher() {
return isolate_->lazy_compile_dispatcher();
}
Logger* main_thread_logger() {
V8FileLogger* main_thread_logger() {
// TODO(leszeks): This is needed for logging in ParseInfo. Figure out a way
// to use the LocalLogger for this instead.
return isolate_->logger();
......
......@@ -301,7 +301,8 @@ Handle<Script> FactoryBase<Impl>::NewScriptWithId(
impl()->AddToScriptList(script);
}
LOG(isolate(), ScriptEvent(Logger::ScriptEventType::kCreate, script_id));
LOG(isolate(),
ScriptEvent(V8FileLogger::ScriptEventType::kCreate, script_id));
return script;
}
......
......@@ -1422,7 +1422,8 @@ Handle<Script> Factory::CloneScript(Handle<Script> script) {
scripts = WeakArrayList::AddToEnd(isolate(), scripts,
MaybeObjectHandle::Weak(new_script_handle));
heap->set_script_list(*scripts);
LOG(isolate(), ScriptEvent(Logger::ScriptEventType::kCreate, script_id));
LOG(isolate(),
ScriptEvent(V8FileLogger::ScriptEventType::kCreate, script_id));
return new_script_handle;
}
......
......@@ -37,13 +37,13 @@ class BaseTimedHistogramScope {
}
V8_INLINE void LogStart(Isolate* isolate) {
Logger::CallEventLogger(isolate, histogram_->name(),
v8::LogEventStatus::kStart, true);
V8FileLogger::CallEventLogger(isolate, histogram_->name(),
v8::LogEventStatus::kStart, true);
}
V8_INLINE void LogEnd(Isolate* isolate) {
Logger::CallEventLogger(isolate, histogram_->name(),
v8::LogEventStatus::kEnd, true);
V8FileLogger::CallEventLogger(isolate, histogram_->name(),
v8::LogEventStatus::kEnd, true);
}
base::ElapsedTimer timer_;
......
......@@ -82,7 +82,8 @@ void TimedHistogram::RecordAbandon(base::ElapsedTimer* timer,
AddSample(static_cast<int>(sample));
}
if (isolate != nullptr) {
Logger::CallEventLogger(isolate, name(), v8::LogEventStatus::kEnd, true);
V8FileLogger::CallEventLogger(isolate, name(), v8::LogEventStatus::kEnd,
true);
}
}
......
......@@ -20,7 +20,8 @@ LocalLogger::LocalLogger(Isolate* isolate)
void LocalLogger::ScriptDetails(Script script) {
logger_->ScriptDetails(script);
}
void LocalLogger::ScriptEvent(Logger::ScriptEventType type, int script_id) {
void LocalLogger::ScriptEvent(V8FileLogger::ScriptEventType type,
int script_id) {
logger_->ScriptEvent(type, script_id);
}
void LocalLogger::CodeLinePosInfoRecordEvent(Address code_start,
......
......@@ -21,7 +21,7 @@ class LocalLogger {
return is_listening_to_code_events_;
}
void ScriptDetails(Script script);
void ScriptEvent(Logger::ScriptEventType type, int script_id);
void ScriptEvent(V8FileLogger::ScriptEventType type, int script_id);
void CodeLinePosInfoRecordEvent(Address code_start,
ByteArray source_position_table,
JitCodeEvent::CodeType code_type);
......@@ -30,7 +30,7 @@ class LocalLogger {
void MapDetails(Map map);
private:
Logger* logger_;
V8FileLogger* logger_;
bool is_logging_;
bool is_listening_to_code_events_;
};
......
......@@ -13,7 +13,7 @@
namespace v8 {
namespace internal {
LogEventListener::LogEventsAndTags Logger::ToNativeByScript(
LogEventListener::LogEventsAndTags V8FileLogger::ToNativeByScript(
LogEventListener::LogEventsAndTags tag, Script script) {
if (script.type() != Script::TYPE_NATIVE) return tag;
switch (tag) {
......@@ -30,8 +30,8 @@ LogEventListener::LogEventsAndTags Logger::ToNativeByScript(
template <class TimerEvent>
void TimerEventScope<TimerEvent>::LogTimerEvent(v8::LogEventStatus se) {
Logger::CallEventLogger(isolate_, TimerEvent::name(), se,
TimerEvent::expose_to_api());
V8FileLogger::CallEventLogger(isolate_, TimerEvent::name(), se,
TimerEvent::expose_to_api());
}
} // namespace internal
......
......@@ -49,7 +49,7 @@ bool Log::IsLoggingToTemporaryFile(std::string file_name) {
return file_name.compare(Log::kLogToTemporaryFile) == 0;
}
Log::Log(Logger* logger, std::string file_name)
Log::Log(V8FileLogger* logger, std::string file_name)
: logger_(logger),
file_name_(file_name),
output_handle_(Log::CreateOutputHandle(file_name)),
......
......@@ -28,14 +28,14 @@ class Vector;
namespace internal {
class Logger;
class V8FileLogger;
enum class LogSeparator { kSeparator };
// Functions and data for performing output of log messages.
class Log {
public:
explicit Log(Logger* logger, std::string log_file_name);
explicit Log(V8FileLogger* logger, std::string log_file_name);
V8_EXPORT_PRIVATE static bool IsLoggingToConsole(std::string file_name);
V8_EXPORT_PRIVATE static bool IsLoggingToTemporaryFile(std::string file_name);
......@@ -113,7 +113,7 @@ class Log {
void WriteLogHeader();
Logger* logger_;
V8FileLogger* logger_;
std::string file_name_;
......@@ -131,7 +131,7 @@ class Log {
// mutex_ should be acquired before using it.
std::unique_ptr<char[]> format_buffer_;
friend class Logger;
friend class V8FileLogger;
};
template <>
......
This diff is collapsed.
......@@ -27,7 +27,7 @@ namespace internal {
struct TickSample;
// Logger is used for collecting logging information from V8 during
// V8FileLogger is used for collecting logging information from V8 during
// execution. The result is dumped to a file.
//
// Available command line flags:
......@@ -63,8 +63,8 @@ class Isolate;
class JitLogger;
class Log;
class LowLevelLogger;
class PerfBasicLogger;
class PerfJitLogger;
class LinuxPerfBasicLogger;
class LinuxPerfJitLogger;
class Profiler;
class SourcePosition;
class Ticker;
......@@ -103,7 +103,7 @@ class ExistingCodeLogger {
enum class LogSeparator;
class Logger : public LogEventListener {
class V8FileLogger : public LogEventListener {
public:
enum class ScriptEventType {
kReserveId,
......@@ -113,8 +113,8 @@ class Logger : public LogEventListener {
kStreamingCompile
};
explicit Logger(Isolate* isolate);
~Logger() override;
explicit V8FileLogger(Isolate* isolate);
~V8FileLogger() override;
// The separator is used to write an unescaped "," into the log.
static const LogSeparator kNext;
......@@ -341,8 +341,8 @@ class Logger : public LogEventListener {
std::atomic<bool> is_logging_;
std::unique_ptr<Log> log_;
#if V8_OS_LINUX
std::unique_ptr<PerfBasicLogger> perf_basic_logger_;
std::unique_ptr<PerfJitLogger> perf_jit_logger_;
std::unique_ptr<LinuxPerfBasicLogger> perf_basic_logger_;
std::unique_ptr<LinuxPerfJitLogger> perf_jit_logger_;
#endif
std::unique_ptr<LowLevelLogger> ll_logger_;
std::unique_ptr<JitLogger> jit_logger_;
......
......@@ -102,8 +102,8 @@ UnoptimizedCompileFlags UnoptimizedCompileFlags::ForToplevelCompile(
is_user_javascript, language_mode, repl_mode,
type, lazy);
LOG(isolate,
ScriptEvent(Logger::ScriptEventType::kReserveId, flags.script_id()));
LOG(isolate, ScriptEvent(V8FileLogger::ScriptEventType::kReserveId,
flags.script_id()));
return flags;
}
......
......@@ -32,7 +32,7 @@ class LazyCompileDispatcher;
class DeclarationScope;
class FunctionLiteral;
class RuntimeCallStats;
class Logger;
class V8FileLogger;
class SourceRangeMap;
class Utf16CharacterStream;
class Zone;
......@@ -205,13 +205,13 @@ class V8_EXPORT_PRIVATE ReusableUnoptimizedCompileState {
const AstStringConstants* ast_string_constants() const {
return ast_string_constants_;
}
Logger* logger() const { return logger_; }
V8FileLogger* logger() const { return logger_; }
LazyCompileDispatcher* dispatcher() const { return dispatcher_; }
private:
uint64_t hash_seed_;
AccountingAllocator* allocator_;
Logger* logger_;
V8FileLogger* logger_;
LazyCompileDispatcher* dispatcher_;
const AstStringConstants* ast_string_constants_;
Zone ast_raw_string_zone_;
......@@ -251,7 +251,7 @@ class V8_EXPORT_PRIVATE ParseInfo {
const AstStringConstants* ast_string_constants() const {
return reusable_state_->ast_string_constants();
}
Logger* logger() const { return reusable_state_->logger(); }
V8FileLogger* logger() const { return reusable_state_->logger(); }
LazyCompileDispatcher* dispatcher() const {
return reusable_state_->dispatcher();
}
......
......@@ -246,7 +246,7 @@ class ParserBase {
ParserBase(Zone* zone, Scanner* scanner, uintptr_t stack_limit,
AstValueFactory* ast_value_factory,
PendingCompilationErrorHandler* pending_error_handler,
RuntimeCallStats* runtime_call_stats, Logger* logger,
RuntimeCallStats* runtime_call_stats, V8FileLogger* logger,
UnoptimizedCompileFlags flags, bool parsing_on_main_thread)
: scope_(nullptr),
original_scope_(nullptr),
......@@ -1562,7 +1562,7 @@ class ParserBase {
AstValueFactory* ast_value_factory_; // Not owned.
typename Types::Factory ast_node_factory_;
RuntimeCallStats* runtime_call_stats_;
internal::Logger* logger_;
internal::V8FileLogger* logger_;
bool parsing_on_main_thread_;
uintptr_t stack_limit_;
PendingCompilationErrorHandler* pending_error_handler_;
......
......@@ -933,7 +933,7 @@ class PreParser : public ParserBase<PreParser> {
PreParser(Zone* zone, Scanner* scanner, uintptr_t stack_limit,
AstValueFactory* ast_value_factory,
PendingCompilationErrorHandler* pending_error_handler,
RuntimeCallStats* runtime_call_stats, Logger* logger,
RuntimeCallStats* runtime_call_stats, V8FileLogger* logger,
UnoptimizedCompileFlags flags, bool parsing_on_main_thread = true)
: ParserBase<PreParser>(zone, scanner, stack_limit, ast_value_factory,
pending_error_handler, runtime_call_stats, logger,
......
......@@ -81,7 +81,7 @@ ProfilingScope::ProfilingScope(Isolate* isolate, ProfilerListener* listener)
wasm::GetWasmEngine()->EnableCodeLogging(isolate_);
#endif // V8_ENABLE_WEBASSEMBLY
Logger* logger = isolate_->logger();
V8FileLogger* logger = isolate_->logger();
logger->AddLogEventListener(listener_);
// Populate the ProfilerCodeObserver with the initial functions and
// callbacks on the heap.
......
......@@ -334,7 +334,7 @@ template <typename IsolateT>
void Deserializer<IsolateT>::LogScriptEvents(Script script) {
DisallowGarbageCollection no_gc;
LOG(isolate(),
ScriptEvent(Logger::ScriptEventType::kDeserialize, script.id()));
ScriptEvent(V8FileLogger::ScriptEventType::kDeserialize, script.id()));
LOG(isolate(), ScriptDetails(script));
}
......
......@@ -143,7 +143,7 @@ static JITCodeLineInfo* UntagLineInfo(void* ptr) {
// The parameter str is a mixed pattern which contains the
// function name and some other info. It comes from all the
// Logger::CodeCreateEvent(...) function. This function get the
// V8FileLogger::CodeCreateEvent(...) function. This function get the
// pure function name from the input parameter.
static std::string GetFunctionNameFromMixedName(const char* str, int length) {
int index = 0;
......
......@@ -192,11 +192,11 @@ TEST(CodeEvents) {
// Enqueue code creation events.
const char* aaa_str = "aaa";
i::Handle<i::String> aaa_name = factory->NewStringFromAsciiChecked(aaa_str);
profiler_listener.CodeCreateEvent(i::Logger::FUNCTION_TAG, aaa_code,
profiler_listener.CodeCreateEvent(i::V8FileLogger::FUNCTION_TAG, aaa_code,
aaa_name);
profiler_listener.CodeCreateEvent(i::Logger::BUILTIN_TAG, comment_code,
profiler_listener.CodeCreateEvent(i::V8FileLogger::BUILTIN_TAG, comment_code,
"comment");
profiler_listener.CodeCreateEvent(i::Logger::BUILTIN_TAG, comment2_code,
profiler_listener.CodeCreateEvent(i::V8FileLogger::BUILTIN_TAG, comment2_code,
"comment2");
profiler_listener.CodeMoveEvent(*comment2_code, *moved_code);
......@@ -257,9 +257,12 @@ TEST(TickEvents) {
*code_observer->weak_code_registry());
isolate->logger()->AddLogEventListener(&profiler_listener);
profiler_listener.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame1_code, "bbb");
profiler_listener.CodeCreateEvent(i::Logger::STUB_TAG, frame2_code, "ccc");
profiler_listener.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame3_code, "ddd");
profiler_listener.CodeCreateEvent(i::V8FileLogger::BUILTIN_TAG, frame1_code,
"bbb");
profiler_listener.CodeCreateEvent(i::V8FileLogger::STUB_TAG, frame2_code,
"ccc");
profiler_listener.CodeCreateEvent(i::V8FileLogger::BUILTIN_TAG, frame3_code,
"ddd");
EnqueueTickSampleEvent(processor, frame1_code->raw_instruction_start());
EnqueueTickSampleEvent(processor,
......@@ -415,7 +418,7 @@ TEST(Issue1398) {
*code_observer->code_entries(),
*code_observer->weak_code_registry());
profiler_listener.CodeCreateEvent(i::Logger::BUILTIN_TAG, code, "bbb");
profiler_listener.CodeCreateEvent(i::V8FileLogger::BUILTIN_TAG, code, "bbb");
v8::internal::TickSample sample;
sample.pc = reinterpret_cast<void*>(code->InstructionStart());
......@@ -1303,7 +1306,7 @@ static void TickLines(bool optimize) {
i::Handle<i::String> str = factory->NewStringFromAsciiChecked(func_name);
int line = 1;
int column = 1;
profiler_listener.CodeCreateEvent(i::Logger::FUNCTION_TAG, code,
profiler_listener.CodeCreateEvent(i::V8FileLogger::FUNCTION_TAG, code,
handle(func->shared(), isolate), str, line,
column);
......
......@@ -47,7 +47,7 @@
using v8::base::EmbeddedVector;
using v8::internal::Address;
using v8::internal::Logger;
using v8::internal::V8FileLogger;
namespace {
......@@ -95,7 +95,7 @@ class V8_NODISCARD ScopedLoggerInitializer {
i::Isolate* i_isolate() { return reinterpret_cast<i::Isolate*>(isolate()); }
Logger* logger() { return logger_; }
V8FileLogger* logger() { return logger_; }
v8::Local<v8::String> GetLogString() {
int length = static_cast<int>(raw_log_.size());
......@@ -214,7 +214,7 @@ class V8_NODISCARD ScopedLoggerInitializer {
v8::Isolate::Scope isolate_scope_;
v8::HandleScope scope_;
v8::Local<v8::Context> env_;
Logger* logger_;
V8FileLogger* logger_;
std::string raw_log_;
std::vector<std::string> log_;
......
......@@ -396,9 +396,9 @@ TEST(SymbolizeTickSample) {
CodeEntryStorage storage;
CodeMap code_map(storage);
Symbolizer symbolizer(&code_map);
CodeEntry* entry1 = storage.Create(i::Logger::FUNCTION_TAG, "aaa");
CodeEntry* entry2 = storage.Create(i::Logger::FUNCTION_TAG, "bbb");
CodeEntry* entry3 = storage.Create(i::Logger::FUNCTION_TAG, "ccc");
CodeEntry* entry1 = storage.Create(i::V8FileLogger::FUNCTION_TAG, "aaa");
CodeEntry* entry2 = storage.Create(i::V8FileLogger::FUNCTION_TAG, "bbb");
CodeEntry* entry3 = storage.Create(i::V8FileLogger::FUNCTION_TAG, "ccc");
symbolizer.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200);
symbolizer.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100);
symbolizer.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50);
......@@ -466,9 +466,9 @@ TEST(SampleIds) {
CodeEntryStorage storage;
CodeMap code_map(storage);
Symbolizer symbolizer(&code_map);
CodeEntry* entry1 = storage.Create(i::Logger::FUNCTION_TAG, "aaa");
CodeEntry* entry2 = storage.Create(i::Logger::FUNCTION_TAG, "bbb");
CodeEntry* entry3 = storage.Create(i::Logger::FUNCTION_TAG, "ccc");
CodeEntry* entry1 = storage.Create(i::V8FileLogger::FUNCTION_TAG, "aaa");
CodeEntry* entry2 = storage.Create(i::V8FileLogger::FUNCTION_TAG, "bbb");
CodeEntry* entry3 = storage.Create(i::V8FileLogger::FUNCTION_TAG, "ccc");
symbolizer.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200);
symbolizer.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100);
symbolizer.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50);
......@@ -677,7 +677,7 @@ TEST(NoSamples) {
CodeEntryStorage storage;
CodeMap code_map(storage);
Symbolizer symbolizer(&code_map);
CodeEntry* entry1 = storage.Create(i::Logger::FUNCTION_TAG, "aaa");
CodeEntry* entry1 = storage.Create(i::V8FileLogger::FUNCTION_TAG, "aaa");
symbolizer.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200);
// We are building the following calls tree:
......
......@@ -46,7 +46,7 @@ _COMMON_DISASM_OPTIONS = ["-M", "intel-mnemonic", "-C", "-z"]
_DISASM_HEADER_RE = re.compile(r"[a-f0-9]+\s+<.*:$")
_DISASM_LINE_RE = re.compile(r"\s*([a-f0-9]+):\s*(\S.*)")
# Keys must match constants in Logger::LogCodeInfo.
# Keys must match constants in V8FileLogger::LogCodeInfo.
_ARCH_MAP = {
"ia32": "-m i386",
"x64": "-m i386 -M x86-64",
......
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