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

[log] Rename v8::Log to v8::LogFile

Bug: v8:12795, chromium:1316443
Change-Id: I0ecaf8ebbf1a83d0d5b305fd014bc5a765c0d2f5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3610446Reviewed-by: 's avatarVictor Gomes <victorgomes@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80222}
parent 7ada6c8b
......@@ -1608,8 +1608,8 @@ filegroup(
"src/logging/local-logger.cc",
"src/logging/local-logger.h",
"src/logging/log-inl.h",
"src/logging/log-utils.cc",
"src/logging/log-utils.h",
"src/logging/log-file.cc",
"src/logging/log-file.h",
"src/logging/log.cc",
"src/logging/log.h",
"src/logging/metrics.cc",
......
......@@ -3116,8 +3116,8 @@ v8_header_set("v8_internal_headers") {
"src/logging/counters-scopes.h",
"src/logging/counters.h",
"src/logging/local-logger.h",
"src/logging/log-file.h",
"src/logging/log-inl.h",
"src/logging/log-utils.h",
"src/logging/log.h",
"src/logging/metrics.h",
"src/logging/runtime-call-stats-scope.h",
......@@ -4353,7 +4353,7 @@ v8_source_set("v8_base_without_compiler") {
"src/libsampler/sampler.cc",
"src/logging/counters.cc",
"src/logging/local-logger.cc",
"src/logging/log-utils.cc",
"src/logging/log-file.cc",
"src/logging/log.cc",
"src/logging/metrics.cc",
"src/logging/runtime-call-stats.cc",
......
......@@ -54,7 +54,7 @@
#include "src/init/v8.h"
#include "src/interpreter/interpreter.h"
#include "src/logging/counters.h"
#include "src/logging/log-utils.h"
#include "src/logging/log-file.h"
#include "src/objects/managed-inl.h"
#include "src/objects/objects-inl.h"
#include "src/objects/objects.h"
......@@ -2087,7 +2087,7 @@ void Shell::LogGetAndStop(const v8::FunctionCallbackInfo<v8::Value>& args) {
HandleScope handle_scope(isolate);
std::string file_name = i_isolate->logger()->file_name();
if (!i::Log::IsLoggingToTemporaryFile(file_name)) {
if (!i::LogFile::IsLoggingToTemporaryFile(file_name)) {
isolate->ThrowError("Only capturing from temporary files is supported.");
return;
}
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_LOGGING_LOG_UTILS_H_
#define V8_LOGGING_LOG_UTILS_H_
#ifndef V8_LOGGING_LOG_FILE_H_
#define V8_LOGGING_LOG_FILE_H_
#include <stdio.h>
......@@ -33,9 +33,9 @@ class V8FileLogger;
enum class LogSeparator { kSeparator };
// Functions and data for performing output of log messages.
class Log {
class LogFile {
public:
explicit Log(V8FileLogger* logger, std::string log_file_name);
explicit LogFile(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);
......@@ -85,7 +85,7 @@ class Log {
private:
// Create a message builder starting from position 0.
// This acquires the mutex in the log as well.
explicit MessageBuilder(Log* log);
explicit MessageBuilder(LogFile* log);
// Prints the format string into |log_->format_buffer_|. Returns the length
// of the result, or kMessageBufferSize if it was truncated.
......@@ -97,15 +97,15 @@ class Log {
void PRINTF_FORMAT(2, 3) AppendRawFormatString(const char* format, ...);
void AppendRawCharacter(const char character);
Log* log_;
LogFile* log_;
NoGarbageCollectionMutexGuard lock_guard_;
friend class Log;
friend class LogFile;
};
// Use this method to create an instance of Log::MessageBuilder. This method
// will return null if logging is disabled.
std::unique_ptr<Log::MessageBuilder> NewMessageBuilder();
// Use this method to create an instance of LogFile::MessageBuilder. This
// method will return null if logging is disabled.
std::unique_ptr<LogFile::MessageBuilder> NewMessageBuilder();
private:
static FILE* CreateOutputHandle(std::string file_name);
......@@ -135,23 +135,26 @@ class Log {
};
template <>
Log::MessageBuilder& Log::MessageBuilder::operator<<<LogSeparator>(
LogFile::MessageBuilder& LogFile::MessageBuilder::operator<<<LogSeparator>(
LogSeparator separator);
template <>
Log::MessageBuilder& Log::MessageBuilder::operator<<<void*>(void* pointer);
LogFile::MessageBuilder& LogFile::MessageBuilder::operator<<<void*>(
void* pointer);
template <>
Log::MessageBuilder& Log::MessageBuilder::operator<<<const char*>(
LogFile::MessageBuilder& LogFile::MessageBuilder::operator<<<const char*>(
const char* string);
template <>
Log::MessageBuilder& Log::MessageBuilder::operator<<<char>(char c);
LogFile::MessageBuilder& LogFile::MessageBuilder::operator<<<char>(char c);
template <>
Log::MessageBuilder& Log::MessageBuilder::operator<<<String>(String string);
LogFile::MessageBuilder& LogFile::MessageBuilder::operator<<<String>(
String string);
template <>
Log::MessageBuilder& Log::MessageBuilder::operator<<<Symbol>(Symbol symbol);
LogFile::MessageBuilder& LogFile::MessageBuilder::operator<<<Symbol>(
Symbol symbol);
template <>
Log::MessageBuilder& Log::MessageBuilder::operator<<<Name>(Name name);
LogFile::MessageBuilder& LogFile::MessageBuilder::operator<<<Name>(Name name);
} // namespace internal
} // namespace v8
#endif // V8_LOGGING_LOG_UTILS_H_
#endif // V8_LOGGING_LOG_FILE_H_
......@@ -31,8 +31,8 @@
#include "src/interpreter/interpreter.h"
#include "src/libsampler/sampler.h"
#include "src/logging/counters.h"
#include "src/logging/log-file.h"
#include "src/logging/log-inl.h"
#include "src/logging/log-utils.h"
#include "src/objects/api-callbacks.h"
#include "src/objects/code-kind.h"
#include "src/objects/code.h"
......@@ -1062,10 +1062,11 @@ void Profiler::Run() {
//
// V8FileLogger class implementation.
//
#define MSG_BUILDER() \
std::unique_ptr<Log::MessageBuilder> msg_ptr = log_->NewMessageBuilder(); \
if (!msg_ptr) return; \
Log::MessageBuilder& msg = *msg_ptr.get();
#define MSG_BUILDER() \
std::unique_ptr<LogFile::MessageBuilder> msg_ptr = \
log_->NewMessageBuilder(); \
if (!msg_ptr) return; \
LogFile::MessageBuilder& msg = *msg_ptr.get();
V8FileLogger::V8FileLogger(Isolate* isolate)
: isolate_(isolate),
......@@ -1205,7 +1206,7 @@ void V8FileLogger::DeleteEvent(const char* name, void* object) {
namespace {
void AppendCodeCreateHeader(Log::MessageBuilder& msg,
void AppendCodeCreateHeader(LogFile::MessageBuilder& msg,
LogEventListener::LogEventsAndTags tag,
CodeKind kind, uint8_t* address, int size,
uint64_t time) {
......@@ -1216,7 +1217,7 @@ void AppendCodeCreateHeader(Log::MessageBuilder& msg,
<< V8FileLogger::kNext << size << V8FileLogger::kNext;
}
void AppendCodeCreateHeader(Log::MessageBuilder& msg,
void AppendCodeCreateHeader(LogFile::MessageBuilder& msg,
LogEventListener::LogEventsAndTags tag,
AbstractCode code, uint64_t time) {
AppendCodeCreateHeader(msg, tag, code.kind(),
......@@ -1618,7 +1619,7 @@ void V8FileLogger::MoveEventInternal(LogEventsAndTags event, Address from,
}
namespace {
void AppendFunctionMessage(Log::MessageBuilder& msg, const char* reason,
void AppendFunctionMessage(LogFile::MessageBuilder& msg, const char* reason,
int script_id, double time_delta, int start_position,
int end_position, uint64_t time) {
msg << "function" << V8FileLogger::kNext << reason << V8FileLogger::kNext
......@@ -1730,9 +1731,9 @@ bool V8FileLogger::EnsureLogScriptSource(Script script) {
Object source_object = script.source();
if (!source_object.IsString()) return false;
std::unique_ptr<Log::MessageBuilder> msg_ptr = log_->NewMessageBuilder();
std::unique_ptr<LogFile::MessageBuilder> msg_ptr = log_->NewMessageBuilder();
if (!msg_ptr) return false;
Log::MessageBuilder& msg = *msg_ptr.get();
LogFile::MessageBuilder& msg = *msg_ptr.get();
String source_code = String::cast(source_object);
msg << "script-source" << kNext << script_id << kNext;
......@@ -2030,7 +2031,7 @@ bool V8FileLogger::SetUp(Isolate* isolate) {
std::ostringstream log_file_name;
PrepareLogFileName(log_file_name, isolate, FLAG_logfile);
log_ = std::make_unique<Log>(this, log_file_name.str());
log_ = std::make_unique<LogFile>(this, log_file_name.str());
#if V8_OS_LINUX
if (FLAG_perf_basic_prof) {
......
......@@ -61,7 +61,7 @@ struct TickSample;
class LogEventListener;
class Isolate;
class JitLogger;
class Log;
class LogFile;
class LowLevelLogger;
class LinuxPerfBasicLogger;
class LinuxPerfJitLogger;
......@@ -339,7 +339,7 @@ class V8FileLogger : public LogEventListener {
friend class Profiler;
std::atomic<bool> is_logging_;
std::unique_ptr<Log> log_;
std::unique_ptr<LogFile> log_;
#if V8_OS_LINUX
std::unique_ptr<LinuxPerfBasicLogger> perf_basic_logger_;
std::unique_ptr<LinuxPerfJitLogger> perf_jit_logger_;
......
......@@ -37,7 +37,7 @@
#include "src/codegen/compilation-cache.h"
#include "src/execution/vm-state-inl.h"
#include "src/init/v8.h"
#include "src/logging/log-utils.h"
#include "src/logging/log-file.h"
#include "src/logging/log.h"
#include "src/objects/objects-inl.h"
#include "src/profiler/cpu-profiler.h"
......@@ -51,11 +51,11 @@ using v8::internal::V8FileLogger;
namespace {
#define SETUP_FLAGS() \
i::FLAG_log = true; \
i::FLAG_prof = true; \
i::FLAG_log_code = true; \
i::FLAG_logfile = i::Log::kLogToTemporaryFile; \
#define SETUP_FLAGS() \
i::FLAG_log = true; \
i::FLAG_prof = true; \
i::FLAG_log_code = true; \
i::FLAG_logfile = i::LogFile::kLogToTemporaryFile; \
i::FLAG_logfile_per_isolate = false
static std::vector<std::string> Split(const std::string& s, char delimiter) {
......
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