[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/+/3610446 Reviewed-by: Victor Gomes <victorgomes@chromium.org> Commit-Queue: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/main@{#80222}
This commit is contained in:
parent
7ada6c8bbc
commit
5647e65451
@ -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",
|
||||
|
4
BUILD.gn
4
BUILD.gn
@ -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,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "src/logging/log-utils.h"
|
||||
#include "src/logging/log-file.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
@ -22,17 +22,17 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
const char* const Log::kLogToTemporaryFile = "+";
|
||||
const char* const Log::kLogToConsole = "-";
|
||||
const char* const LogFile::kLogToTemporaryFile = "+";
|
||||
const char* const LogFile::kLogToConsole = "-";
|
||||
|
||||
// static
|
||||
FILE* Log::CreateOutputHandle(std::string file_name) {
|
||||
FILE* LogFile::CreateOutputHandle(std::string file_name) {
|
||||
// If we're logging anything, we need to open the log file.
|
||||
if (!FLAG_log) {
|
||||
return nullptr;
|
||||
} else if (Log::IsLoggingToConsole(file_name)) {
|
||||
} else if (LogFile::IsLoggingToConsole(file_name)) {
|
||||
return stdout;
|
||||
} else if (Log::IsLoggingToTemporaryFile(file_name)) {
|
||||
} else if (LogFile::IsLoggingToTemporaryFile(file_name)) {
|
||||
return base::OS::OpenTemporaryFile();
|
||||
} else {
|
||||
return base::OS::FOpen(file_name.c_str(), base::OS::LogFileOpenMode);
|
||||
@ -40,26 +40,26 @@ FILE* Log::CreateOutputHandle(std::string file_name) {
|
||||
}
|
||||
|
||||
// static
|
||||
bool Log::IsLoggingToConsole(std::string file_name) {
|
||||
return file_name.compare(Log::kLogToConsole) == 0;
|
||||
bool LogFile::IsLoggingToConsole(std::string file_name) {
|
||||
return file_name.compare(LogFile::kLogToConsole) == 0;
|
||||
}
|
||||
|
||||
// static
|
||||
bool Log::IsLoggingToTemporaryFile(std::string file_name) {
|
||||
return file_name.compare(Log::kLogToTemporaryFile) == 0;
|
||||
bool LogFile::IsLoggingToTemporaryFile(std::string file_name) {
|
||||
return file_name.compare(LogFile::kLogToTemporaryFile) == 0;
|
||||
}
|
||||
|
||||
Log::Log(V8FileLogger* logger, std::string file_name)
|
||||
LogFile::LogFile(V8FileLogger* logger, std::string file_name)
|
||||
: logger_(logger),
|
||||
file_name_(file_name),
|
||||
output_handle_(Log::CreateOutputHandle(file_name)),
|
||||
output_handle_(LogFile::CreateOutputHandle(file_name)),
|
||||
os_(output_handle_ == nullptr ? stdout : output_handle_),
|
||||
format_buffer_(NewArray<char>(kMessageBufferSize)) {
|
||||
if (output_handle_) WriteLogHeader();
|
||||
}
|
||||
|
||||
void Log::WriteLogHeader() {
|
||||
Log::MessageBuilder msg(this);
|
||||
void LogFile::WriteLogHeader() {
|
||||
LogFile::MessageBuilder msg(this);
|
||||
LogSeparator kNext = LogSeparator::kSeparator;
|
||||
msg << "v8-version" << kNext << Version::GetMajor() << kNext
|
||||
<< Version::GetMinor() << kNext << Version::GetBuild() << kNext
|
||||
@ -73,12 +73,13 @@ void Log::WriteLogHeader() {
|
||||
msg.WriteToLogFile();
|
||||
}
|
||||
|
||||
std::unique_ptr<Log::MessageBuilder> Log::NewMessageBuilder() {
|
||||
std::unique_ptr<LogFile::MessageBuilder> LogFile::NewMessageBuilder() {
|
||||
// Fast check of is_logging() without taking the lock. Bail out immediately if
|
||||
// logging isn't enabled.
|
||||
if (!logger_->is_logging()) return {};
|
||||
|
||||
std::unique_ptr<Log::MessageBuilder> result(new Log::MessageBuilder(this));
|
||||
std::unique_ptr<LogFile::MessageBuilder> result(
|
||||
new LogFile::MessageBuilder(this));
|
||||
|
||||
// The first invocation of is_logging() might still read an old value. It is
|
||||
// fine if a background thread starts logging a bit later, but we want to
|
||||
@ -89,7 +90,7 @@ std::unique_ptr<Log::MessageBuilder> Log::NewMessageBuilder() {
|
||||
return result;
|
||||
}
|
||||
|
||||
FILE* Log::Close() {
|
||||
FILE* LogFile::Close() {
|
||||
FILE* result = nullptr;
|
||||
if (output_handle_ != nullptr) {
|
||||
fflush(output_handle_);
|
||||
@ -100,14 +101,13 @@ FILE* Log::Close() {
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string Log::file_name() const { return file_name_; }
|
||||
std::string LogFile::file_name() const { return file_name_; }
|
||||
|
||||
Log::MessageBuilder::MessageBuilder(Log* log)
|
||||
: log_(log), lock_guard_(&log_->mutex_) {
|
||||
}
|
||||
LogFile::MessageBuilder::MessageBuilder(LogFile* log)
|
||||
: log_(log), lock_guard_(&log_->mutex_) {}
|
||||
|
||||
void Log::MessageBuilder::AppendString(String str,
|
||||
base::Optional<int> length_limit) {
|
||||
void LogFile::MessageBuilder::AppendString(String str,
|
||||
base::Optional<int> length_limit) {
|
||||
if (str.is_null()) return;
|
||||
|
||||
DisallowGarbageCollection no_gc; // Ensure string stays valid.
|
||||
@ -126,17 +126,17 @@ void Log::MessageBuilder::AppendString(String str,
|
||||
}
|
||||
}
|
||||
|
||||
void Log::MessageBuilder::AppendString(base::Vector<const char> str) {
|
||||
void LogFile::MessageBuilder::AppendString(base::Vector<const char> str) {
|
||||
for (auto i = str.begin(); i < str.end(); i++) AppendCharacter(*i);
|
||||
}
|
||||
|
||||
void Log::MessageBuilder::AppendString(const char* str) {
|
||||
void LogFile::MessageBuilder::AppendString(const char* str) {
|
||||
if (str == nullptr) return;
|
||||
AppendString(str, strlen(str));
|
||||
}
|
||||
|
||||
void Log::MessageBuilder::AppendString(const char* str, size_t length,
|
||||
bool is_one_byte) {
|
||||
void LogFile::MessageBuilder::AppendString(const char* str, size_t length,
|
||||
bool is_one_byte) {
|
||||
if (str == nullptr) return;
|
||||
if (is_one_byte) {
|
||||
for (size_t i = 0; i < length; i++) {
|
||||
@ -151,7 +151,7 @@ void Log::MessageBuilder::AppendString(const char* str, size_t length,
|
||||
}
|
||||
}
|
||||
|
||||
void Log::MessageBuilder::AppendFormatString(const char* format, ...) {
|
||||
void LogFile::MessageBuilder::AppendFormatString(const char* format, ...) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
const int length = FormatStringIntoBuffer(format, args);
|
||||
@ -162,7 +162,7 @@ void Log::MessageBuilder::AppendFormatString(const char* format, ...) {
|
||||
}
|
||||
}
|
||||
|
||||
void Log::MessageBuilder::AppendTwoByteCharacter(char c1, char c2) {
|
||||
void LogFile::MessageBuilder::AppendTwoByteCharacter(char c1, char c2) {
|
||||
if (c2 == 0) {
|
||||
AppendCharacter(c1);
|
||||
} else {
|
||||
@ -170,7 +170,7 @@ void Log::MessageBuilder::AppendTwoByteCharacter(char c1, char c2) {
|
||||
AppendRawFormatString("\\u%02x%02x", c1 & 0xFF, c2 & 0xFF);
|
||||
}
|
||||
}
|
||||
void Log::MessageBuilder::AppendCharacter(char c) {
|
||||
void LogFile::MessageBuilder::AppendCharacter(char c) {
|
||||
if (c >= 32 && c <= 126) {
|
||||
if (c == ',') {
|
||||
// Escape commas to avoid adding column separators.
|
||||
@ -190,7 +190,7 @@ void Log::MessageBuilder::AppendCharacter(char c) {
|
||||
}
|
||||
}
|
||||
|
||||
void Log::MessageBuilder::AppendSymbolName(Symbol symbol) {
|
||||
void LogFile::MessageBuilder::AppendSymbolName(Symbol symbol) {
|
||||
DCHECK(!symbol.is_null());
|
||||
OFStream& os = log_->os_;
|
||||
os << "symbol(";
|
||||
@ -202,8 +202,8 @@ void Log::MessageBuilder::AppendSymbolName(Symbol symbol) {
|
||||
os << "hash " << std::hex << symbol.hash() << std::dec << ")";
|
||||
}
|
||||
|
||||
void Log::MessageBuilder::AppendSymbolNameDetails(String str,
|
||||
bool show_impl_info) {
|
||||
void LogFile::MessageBuilder::AppendSymbolNameDetails(String str,
|
||||
bool show_impl_info) {
|
||||
if (str.is_null()) return;
|
||||
|
||||
DisallowGarbageCollection no_gc; // Ensure string stays valid.
|
||||
@ -219,18 +219,19 @@ void Log::MessageBuilder::AppendSymbolNameDetails(String str,
|
||||
AppendString(str, limit);
|
||||
}
|
||||
|
||||
int Log::MessageBuilder::FormatStringIntoBuffer(const char* format,
|
||||
va_list args) {
|
||||
base::Vector<char> buf(log_->format_buffer_.get(), Log::kMessageBufferSize);
|
||||
int LogFile::MessageBuilder::FormatStringIntoBuffer(const char* format,
|
||||
va_list args) {
|
||||
base::Vector<char> buf(log_->format_buffer_.get(),
|
||||
LogFile::kMessageBufferSize);
|
||||
int length = base::VSNPrintF(buf, format, args);
|
||||
// |length| is -1 if output was truncated.
|
||||
if (length == -1) length = Log::kMessageBufferSize;
|
||||
DCHECK_LE(length, Log::kMessageBufferSize);
|
||||
if (length == -1) length = LogFile::kMessageBufferSize;
|
||||
DCHECK_LE(length, LogFile::kMessageBufferSize);
|
||||
DCHECK_GE(length, 0);
|
||||
return length;
|
||||
}
|
||||
|
||||
void Log::MessageBuilder::AppendRawFormatString(const char* format, ...) {
|
||||
void LogFile::MessageBuilder::AppendRawFormatString(const char* format, ...) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
const int length = FormatStringIntoBuffer(format, args);
|
||||
@ -241,21 +242,20 @@ void Log::MessageBuilder::AppendRawFormatString(const char* format, ...) {
|
||||
}
|
||||
}
|
||||
|
||||
void Log::MessageBuilder::AppendRawCharacter(char c) { log_->os_ << c; }
|
||||
void LogFile::MessageBuilder::AppendRawCharacter(char c) { log_->os_ << c; }
|
||||
|
||||
void Log::MessageBuilder::WriteToLogFile() {
|
||||
log_->os_ << std::endl;
|
||||
}
|
||||
void LogFile::MessageBuilder::WriteToLogFile() { log_->os_ << std::endl; }
|
||||
|
||||
template <>
|
||||
Log::MessageBuilder& Log::MessageBuilder::operator<<<const char*>(
|
||||
LogFile::MessageBuilder& LogFile::MessageBuilder::operator<<<const char*>(
|
||||
const char* string) {
|
||||
this->AppendString(string);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <>
|
||||
Log::MessageBuilder& Log::MessageBuilder::operator<<<void*>(void* pointer) {
|
||||
LogFile::MessageBuilder& LogFile::MessageBuilder::operator<<<void*>(
|
||||
void* pointer) {
|
||||
OFStream& os = log_->os_;
|
||||
// Manually format the pointer since on Windows we do not consistently
|
||||
// get a "0x" prefix.
|
||||
@ -264,25 +264,27 @@ Log::MessageBuilder& Log::MessageBuilder::operator<<<void*>(void* pointer) {
|
||||
}
|
||||
|
||||
template <>
|
||||
Log::MessageBuilder& Log::MessageBuilder::operator<<<char>(char c) {
|
||||
LogFile::MessageBuilder& LogFile::MessageBuilder::operator<<<char>(char c) {
|
||||
this->AppendCharacter(c);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <>
|
||||
Log::MessageBuilder& Log::MessageBuilder::operator<<<String>(String string) {
|
||||
LogFile::MessageBuilder& LogFile::MessageBuilder::operator<<<String>(
|
||||
String string) {
|
||||
this->AppendString(string);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <>
|
||||
Log::MessageBuilder& Log::MessageBuilder::operator<<<Symbol>(Symbol symbol) {
|
||||
LogFile::MessageBuilder& LogFile::MessageBuilder::operator<<<Symbol>(
|
||||
Symbol symbol) {
|
||||
this->AppendSymbolName(symbol);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <>
|
||||
Log::MessageBuilder& Log::MessageBuilder::operator<<<Name>(Name name) {
|
||||
LogFile::MessageBuilder& LogFile::MessageBuilder::operator<<<Name>(Name name) {
|
||||
if (name.IsString()) {
|
||||
this->AppendString(String::cast(name));
|
||||
} else {
|
||||
@ -292,7 +294,7 @@ Log::MessageBuilder& Log::MessageBuilder::operator<<<Name>(Name name) {
|
||||
}
|
||||
|
||||
template <>
|
||||
Log::MessageBuilder& Log::MessageBuilder::operator<<<LogSeparator>(
|
||||
LogFile::MessageBuilder& LogFile::MessageBuilder::operator<<<LogSeparator>(
|
||||
LogSeparator separator) {
|
||||
// Skip escaping to create a new column.
|
||||
this->AppendRawCharacter(',');
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user