Commit 56a54c0f authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[logging][flags] Use flag implications for --log-all and --prof

This avoids race conditions in certain situations detected by TSAN.

Bug: v8:10644
Change-Id: Ic3082da4e918890940fcc1cabf0933b0419f41de
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2396083
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69722}
parent 0fed3c75
......@@ -1627,6 +1627,9 @@ DEFINE_BOOL(trace_wasm_gdb_remote, false, "trace Webassembly GDB-remote server")
#define FLAG FLAG_FULL
// log.cc
DEFINE_STRING(logfile, "v8.log", "Specify the name of the log file.")
DEFINE_BOOL(logfile_per_isolate, true, "Separate log files for each isolate.")
DEFINE_BOOL(log, false,
"Minimal logging (no API, code, GC, suspect, or handles samples).")
DEFINE_BOOL(log_all, false, "Log all events to the log file.")
......@@ -1639,8 +1642,13 @@ DEFINE_BOOL(log_source_code, false, "Log source code.")
DEFINE_BOOL(log_function_events, false,
"Log function events "
"(parse, compile, execute) separately.")
DEFINE_BOOL(prof, false,
"Log statistical profiling information (implies --log-code).")
DEFINE_IMPLICATION(log_all, log_api)
DEFINE_IMPLICATION(log_all, log_code)
DEFINE_IMPLICATION(log_all, log_suspect)
DEFINE_IMPLICATION(log_all, log_handles)
DEFINE_IMPLICATION(log_all, log_internal_timer_events)
DEFINE_IMPLICATION(log_all, log_function_events)
DEFINE_BOOL(detailed_line_info, false,
"Always generate detailed line information for CPU profiling.")
......@@ -1657,11 +1665,14 @@ DEFINE_INT(prof_sampling_interval, DEFAULT_PROF_SAMPLING_INTERVAL,
#undef DEFAULT_PROF_SAMPLING_INTERVAL
DEFINE_BOOL(prof_cpp, false, "Like --prof, but ignore generated code.")
DEFINE_IMPLICATION(prof, prof_cpp)
DEFINE_BOOL(prof_browser_mode, true,
"Used with --prof, turns on browser-compatible mode for profiling.")
DEFINE_STRING(logfile, "v8.log", "Specify the name of the log file.")
DEFINE_BOOL(logfile_per_isolate, true, "Separate log files for each isolate.")
DEFINE_BOOL(prof, false,
"Log statistical profiling information (implies --log-code).")
DEFINE_IMPLICATION(prof, prof_cpp)
DEFINE_IMPLICATION(prof, log_code)
DEFINE_BOOL(ll_prof, false, "Enable low-level linux profiler.")
#if V8_OS_LINUX
......
......@@ -42,18 +42,6 @@ Log::Log(Logger* logger, const char* file_name)
is_enabled_(output_handle_ != nullptr),
format_buffer_(NewArray<char>(kMessageBufferSize)),
logger_(logger) {
// --log-all enables all the log flags.
if (FLAG_log_all) {
FLAG_log_api = true;
FLAG_log_code = true;
FLAG_log_suspect = true;
FLAG_log_handles = true;
FLAG_log_internal_timer_events = true;
FLAG_log_function_events = true;
}
// --prof implies --log-code.
if (FLAG_prof) FLAG_log_code = true;
if (output_handle_ == nullptr) return;
Log::MessageBuilder msg(this);
......
......@@ -48,12 +48,12 @@ using v8::internal::Logger;
namespace {
#define SETUP_FLAGS() \
bool saved_log = i::FLAG_log; \
bool saved_prof = i::FLAG_prof; \
i::FLAG_log = true; \
i::FLAG_prof = true; \
i::FLAG_log_code = true; \
i::FLAG_logfile = i::Log::kLogToTemporaryFile; \
i::FLAG_logfile_per_isolate = false
......@@ -513,7 +513,9 @@ UNINITIALIZED_TEST(Issue539892) {
UNINITIALIZED_TEST(LogAll) {
SETUP_FLAGS();
i::FLAG_log_all = true;
i::FLAG_log_api = true;
i::FLAG_turbo_inlining = false;
i::FLAG_log_internal_timer_events = true;
i::FLAG_allow_natives_syntax = true;
v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
......
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