Commit e9d4f79f authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

[logging] Use v8_flags for accessing flag values

Avoid the deprecated FLAG_* syntax, access flag values via the
{v8_flags} struct instead.

R=mliedtke@chromium.org

Bug: v8:12887
Change-Id: I36c66465e3b6c1b27c1825e50f17f4bc8557c426
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3898936Reviewed-by: 's avatarMatthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83217}
parent 5f2ed43a
...@@ -367,7 +367,7 @@ class V8_NODISCARD AggregatedHistogramTimerScope { ...@@ -367,7 +367,7 @@ class V8_NODISCARD AggregatedHistogramTimerScope {
// AggretatedMemoryHistogram collects (time, value) sample pairs and turns // AggretatedMemoryHistogram collects (time, value) sample pairs and turns
// them into time-uniform samples for the backing historgram, such that the // them into time-uniform samples for the backing historgram, such that the
// backing histogram receives one sample every T ms, where the T is controlled // backing histogram receives one sample every T ms, where the T is controlled
// by the FLAG_histogram_interval. // by the v8_flags.histogram_interval.
// //
// More formally: let F be a real-valued function that maps time to sample // More formally: let F be a real-valued function that maps time to sample
// values. We define F as a linear interpolation between adjacent samples. For // values. We define F as a linear interpolation between adjacent samples. For
...@@ -388,7 +388,7 @@ class AggregatedMemoryHistogram { ...@@ -388,7 +388,7 @@ class AggregatedMemoryHistogram {
// 1) For we processed samples that came in before start_ms_ and sent the // 1) For we processed samples that came in before start_ms_ and sent the
// corresponding aggregated samples to backing histogram. // corresponding aggregated samples to backing histogram.
// 2) (last_ms_, last_value_) is the last received sample. // 2) (last_ms_, last_value_) is the last received sample.
// 3) last_ms_ < start_ms_ + FLAG_histogram_interval. // 3) last_ms_ < start_ms_ + v8_flags.histogram_interval.
// 4) aggregate_value_ is the average of the function that is constructed by // 4) aggregate_value_ is the average of the function that is constructed by
// linearly interpolating samples received between start_ms_ and last_ms_. // linearly interpolating samples received between start_ms_ and last_ms_.
void AddSample(double current_ms, double current_value); void AddSample(double current_ms, double current_value);
...@@ -429,7 +429,7 @@ void AggregatedMemoryHistogram<Histogram>::AddSample(double current_ms, ...@@ -429,7 +429,7 @@ void AggregatedMemoryHistogram<Histogram>::AddSample(double current_ms,
// Two samples have the same time, remember the last one. // Two samples have the same time, remember the last one.
last_value_ = current_value; last_value_ = current_value;
} else { } else {
double sample_interval_ms = FLAG_histogram_interval; double sample_interval_ms = v8_flags.histogram_interval;
double end_ms = start_ms_ + sample_interval_ms; double end_ms = start_ms_ + sample_interval_ms;
if (end_ms <= current_ms + kEpsilon) { if (end_ms <= current_ms + kEpsilon) {
// Linearly interpolate between the last_ms_ and the current_ms. // Linearly interpolate between the last_ms_ and the current_ms.
...@@ -520,10 +520,10 @@ class Counters : public std::enable_shared_from_this<Counters> { ...@@ -520,10 +520,10 @@ class Counters : public std::enable_shared_from_this<Counters> {
NESTED_TIMED_HISTOGRAM_LIST(HT) NESTED_TIMED_HISTOGRAM_LIST(HT)
#undef HT #undef HT
#define HT(name, caption, max, res) \ #define HT(name, caption, max, res) \
NestedTimedHistogram* name() { \ NestedTimedHistogram* name() { \
name##_.EnsureCreated(FLAG_slow_histograms); \ name##_.EnsureCreated(v8_flags.slow_histograms); \
return &name##_; \ return &name##_; \
} }
NESTED_TIMED_HISTOGRAM_LIST_SLOW(HT) NESTED_TIMED_HISTOGRAM_LIST_SLOW(HT)
#undef HT #undef HT
......
...@@ -28,7 +28,7 @@ const char* const LogFile::kLogToConsole = "-"; ...@@ -28,7 +28,7 @@ const char* const LogFile::kLogToConsole = "-";
// static // static
FILE* LogFile::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 we're logging anything, we need to open the log file.
if (!FLAG_log) { if (!v8_flags.log) {
return nullptr; return nullptr;
} else if (LogFile::IsLoggingToConsole(file_name)) { } else if (LogFile::IsLoggingToConsole(file_name)) {
return stdout; return stdout;
......
...@@ -127,7 +127,7 @@ const char* ComputeMarker(SharedFunctionInfo shared, AbstractCode code) { ...@@ -127,7 +127,7 @@ const char* ComputeMarker(SharedFunctionInfo shared, AbstractCode code) {
CodeKind kind = code.kind(cage_base); CodeKind kind = code.kind(cage_base);
// We record interpreter trampoline builtin copies as having the // We record interpreter trampoline builtin copies as having the
// "interpreted" marker. // "interpreted" marker.
if (FLAG_interpreted_frames_native_stack && kind == CodeKind::BUILTIN && if (v8_flags.interpreted_frames_native_stack && kind == CodeKind::BUILTIN &&
!code.is_off_heap_trampoline(cage_base)) { !code.is_off_heap_trampoline(cage_base)) {
DCHECK_EQ(code.builtin_id(cage_base), Builtin::kInterpreterEntryTrampoline); DCHECK_EQ(code.builtin_id(cage_base), Builtin::kInterpreterEntryTrampoline);
kind = CodeKind::INTERPRETED_FUNCTION; kind = CodeKind::INTERPRETED_FUNCTION;
...@@ -416,7 +416,7 @@ void LinuxPerfBasicLogger::LogRecordedBuffer(Handle<AbstractCode> code, ...@@ -416,7 +416,7 @@ void LinuxPerfBasicLogger::LogRecordedBuffer(Handle<AbstractCode> code,
MaybeHandle<SharedFunctionInfo>, MaybeHandle<SharedFunctionInfo>,
const char* name, int length) { const char* name, int length) {
PtrComprCageBase cage_base(isolate_); PtrComprCageBase cage_base(isolate_);
if (FLAG_perf_basic_prof_only_functions && if (v8_flags.perf_basic_prof_only_functions &&
CodeKindIsBuiltinOrJSFunction(code->kind(cage_base))) { CodeKindIsBuiltinOrJSFunction(code->kind(cage_base))) {
return; return;
} }
...@@ -1128,7 +1128,7 @@ V8FileLogger::~V8FileLogger() = default; ...@@ -1128,7 +1128,7 @@ V8FileLogger::~V8FileLogger() = default;
const LogSeparator V8FileLogger::kNext = LogSeparator::kSeparator; const LogSeparator V8FileLogger::kNext = LogSeparator::kSeparator;
int64_t V8FileLogger::Time() { int64_t V8FileLogger::Time() {
if (FLAG_verify_predictable) { if (v8_flags.verify_predictable) {
return isolate_->heap()->MonotonicallyIncreasingTimeInMs() * 1000; return isolate_->heap()->MonotonicallyIncreasingTimeInMs() * 1000;
} }
return timer_.Elapsed().InMicroseconds(); return timer_.Elapsed().InMicroseconds();
...@@ -1145,12 +1145,13 @@ void V8FileLogger::RemoveLogEventListener(LogEventListener* listener) { ...@@ -1145,12 +1145,13 @@ void V8FileLogger::RemoveLogEventListener(LogEventListener* listener) {
void V8FileLogger::ProfilerBeginEvent() { void V8FileLogger::ProfilerBeginEvent() {
MSG_BUILDER(); MSG_BUILDER();
msg << "profiler" << kNext << "begin" << kNext << FLAG_prof_sampling_interval; msg << "profiler" << kNext << "begin" << kNext
<< v8_flags.prof_sampling_interval;
msg.WriteToLogFile(); msg.WriteToLogFile();
} }
void V8FileLogger::StringEvent(const char* name, const char* value) { void V8FileLogger::StringEvent(const char* name, const char* value) {
if (FLAG_log) UncheckedStringEvent(name, value); if (v8_flags.log) UncheckedStringEvent(name, value);
} }
void V8FileLogger::UncheckedStringEvent(const char* name, const char* value) { void V8FileLogger::UncheckedStringEvent(const char* name, const char* value) {
...@@ -1160,7 +1161,7 @@ void V8FileLogger::UncheckedStringEvent(const char* name, const char* value) { ...@@ -1160,7 +1161,7 @@ void V8FileLogger::UncheckedStringEvent(const char* name, const char* value) {
} }
void V8FileLogger::IntPtrTEvent(const char* name, intptr_t value) { void V8FileLogger::IntPtrTEvent(const char* name, intptr_t value) {
if (!FLAG_log) return; if (!v8_flags.log) return;
MSG_BUILDER(); MSG_BUILDER();
msg << name << kNext; msg << name << kNext;
msg.AppendFormatString("%" V8PRIdPTR, value); msg.AppendFormatString("%" V8PRIdPTR, value);
...@@ -1170,7 +1171,7 @@ void V8FileLogger::IntPtrTEvent(const char* name, intptr_t value) { ...@@ -1170,7 +1171,7 @@ void V8FileLogger::IntPtrTEvent(const char* name, intptr_t value) {
void V8FileLogger::SharedLibraryEvent(const std::string& library_path, void V8FileLogger::SharedLibraryEvent(const std::string& library_path,
uintptr_t start, uintptr_t end, uintptr_t start, uintptr_t end,
intptr_t aslr_slide) { intptr_t aslr_slide) {
if (!FLAG_prof_cpp) return; if (!v8_flags.prof_cpp) return;
MSG_BUILDER(); MSG_BUILDER();
msg << "shared-library" << kNext << library_path.c_str() << kNext msg << "shared-library" << kNext << library_path.c_str() << kNext
<< reinterpret_cast<void*>(start) << kNext << reinterpret_cast<void*>(end) << reinterpret_cast<void*>(start) << kNext << reinterpret_cast<void*>(end)
...@@ -1179,14 +1180,14 @@ void V8FileLogger::SharedLibraryEvent(const std::string& library_path, ...@@ -1179,14 +1180,14 @@ void V8FileLogger::SharedLibraryEvent(const std::string& library_path,
} }
void V8FileLogger::SharedLibraryEnd() { void V8FileLogger::SharedLibraryEnd() {
if (!FLAG_prof_cpp) return; if (!v8_flags.prof_cpp) return;
MSG_BUILDER(); MSG_BUILDER();
msg << "shared-library-end"; msg << "shared-library-end";
msg.WriteToLogFile(); msg.WriteToLogFile();
} }
void V8FileLogger::CurrentTimeEvent() { void V8FileLogger::CurrentTimeEvent() {
DCHECK(FLAG_log_internal_timer_events); DCHECK(v8_flags.log_internal_timer_events);
MSG_BUILDER(); MSG_BUILDER();
msg << "current-time" << kNext << Time(); msg << "current-time" << kNext << Time();
msg.WriteToLogFile(); msg.WriteToLogFile();
...@@ -1222,7 +1223,7 @@ TIMER_EVENTS_LIST(V) ...@@ -1222,7 +1223,7 @@ TIMER_EVENTS_LIST(V)
#undef V #undef V
void V8FileLogger::NewEvent(const char* name, void* object, size_t size) { void V8FileLogger::NewEvent(const char* name, void* object, size_t size) {
if (!FLAG_log) return; if (!v8_flags.log) return;
MSG_BUILDER(); MSG_BUILDER();
msg << "new" << kNext << name << kNext << object << kNext msg << "new" << kNext << name << kNext << object << kNext
<< static_cast<unsigned int>(size); << static_cast<unsigned int>(size);
...@@ -1230,7 +1231,7 @@ void V8FileLogger::NewEvent(const char* name, void* object, size_t size) { ...@@ -1230,7 +1231,7 @@ void V8FileLogger::NewEvent(const char* name, void* object, size_t size) {
} }
void V8FileLogger::DeleteEvent(const char* name, void* object) { void V8FileLogger::DeleteEvent(const char* name, void* object) {
if (!FLAG_log) return; if (!v8_flags.log) return;
MSG_BUILDER(); MSG_BUILDER();
msg << "delete" << kNext << name << kNext << object; msg << "delete" << kNext << name << kNext << object;
msg.WriteToLogFile(); msg.WriteToLogFile();
...@@ -1288,7 +1289,7 @@ void V8FileLogger::LogSourceCodeInformation(Handle<AbstractCode> code, ...@@ -1288,7 +1289,7 @@ void V8FileLogger::LogSourceCodeInformation(Handle<AbstractCode> code,
Script script = Script::cast(script_object); Script script = Script::cast(script_object);
EnsureLogScriptSource(script); EnsureLogScriptSource(script);
if (!FLAG_log_source_position) return; if (!v8_flags.log_source_position) return;
MSG_BUILDER(); MSG_BUILDER();
msg << "code-source-info" << V8FileLogger::kNext msg << "code-source-info" << V8FileLogger::kNext
<< reinterpret_cast<void*>(code->InstructionStart(cage_base)) << reinterpret_cast<void*>(code->InstructionStart(cage_base))
...@@ -1349,7 +1350,7 @@ void V8FileLogger::LogSourceCodeInformation(Handle<AbstractCode> code, ...@@ -1349,7 +1350,7 @@ void V8FileLogger::LogSourceCodeInformation(Handle<AbstractCode> code,
} }
void V8FileLogger::LogCodeDisassemble(Handle<AbstractCode> code) { void V8FileLogger::LogCodeDisassemble(Handle<AbstractCode> code) {
if (!FLAG_log_code_disassemble) return; if (!v8_flags.log_code_disassemble) return;
PtrComprCageBase cage_base(isolate_); PtrComprCageBase cage_base(isolate_);
MSG_BUILDER(); MSG_BUILDER();
msg << "code-disassemble" << V8FileLogger::kNext msg << "code-disassemble" << V8FileLogger::kNext
...@@ -1380,7 +1381,7 @@ void V8FileLogger::LogCodeDisassemble(Handle<AbstractCode> code) { ...@@ -1380,7 +1381,7 @@ void V8FileLogger::LogCodeDisassemble(Handle<AbstractCode> code) {
void V8FileLogger::CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code, void V8FileLogger::CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
const char* name) { const char* name) {
if (!is_listening_to_code_events()) return; if (!is_listening_to_code_events()) return;
if (!FLAG_log_code) return; if (!v8_flags.log_code) return;
{ {
MSG_BUILDER(); MSG_BUILDER();
AppendCodeCreateHeader(isolate_, msg, tag, *code, Time()); AppendCodeCreateHeader(isolate_, msg, tag, *code, Time());
...@@ -1393,7 +1394,7 @@ void V8FileLogger::CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code, ...@@ -1393,7 +1394,7 @@ void V8FileLogger::CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
void V8FileLogger::CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code, void V8FileLogger::CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<Name> name) { Handle<Name> name) {
if (!is_listening_to_code_events()) return; if (!is_listening_to_code_events()) return;
if (!FLAG_log_code) return; if (!v8_flags.log_code) return;
{ {
MSG_BUILDER(); MSG_BUILDER();
AppendCodeCreateHeader(isolate_, msg, tag, *code, Time()); AppendCodeCreateHeader(isolate_, msg, tag, *code, Time());
...@@ -1408,7 +1409,7 @@ void V8FileLogger::CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code, ...@@ -1408,7 +1409,7 @@ void V8FileLogger::CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<SharedFunctionInfo> shared, Handle<SharedFunctionInfo> shared,
Handle<Name> script_name) { Handle<Name> script_name) {
if (!is_listening_to_code_events()) return; if (!is_listening_to_code_events()) return;
if (!FLAG_log_code) return; if (!v8_flags.log_code) return;
if (*code == if (*code ==
AbstractCode::cast(isolate_->builtins()->code(Builtin::kCompileLazy))) { AbstractCode::cast(isolate_->builtins()->code(Builtin::kCompileLazy))) {
return; return;
...@@ -1427,7 +1428,7 @@ void V8FileLogger::CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code, ...@@ -1427,7 +1428,7 @@ void V8FileLogger::CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
void V8FileLogger::FeedbackVectorEvent(FeedbackVector vector, void V8FileLogger::FeedbackVectorEvent(FeedbackVector vector,
AbstractCode code) { AbstractCode code) {
DisallowGarbageCollection no_gc; DisallowGarbageCollection no_gc;
if (!FLAG_log_feedback_vector) return; if (!v8_flags.log_feedback_vector) return;
PtrComprCageBase cage_base(isolate_); PtrComprCageBase cage_base(isolate_);
MSG_BUILDER(); MSG_BUILDER();
msg << "feedback-vector" << kNext << Time(); msg << "feedback-vector" << kNext << Time();
...@@ -1460,7 +1461,7 @@ void V8FileLogger::CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code, ...@@ -1460,7 +1461,7 @@ void V8FileLogger::CodeCreateEvent(CodeTag tag, Handle<AbstractCode> code,
Handle<Name> script_name, int line, Handle<Name> script_name, int line,
int column) { int column) {
if (!is_listening_to_code_events()) return; if (!is_listening_to_code_events()) return;
if (!FLAG_log_code) return; if (!v8_flags.log_code) return;
{ {
MSG_BUILDER(); MSG_BUILDER();
AppendCodeCreateHeader(isolate_, msg, tag, *code, Time()); AppendCodeCreateHeader(isolate_, msg, tag, *code, Time());
...@@ -1480,7 +1481,7 @@ void V8FileLogger::CodeCreateEvent(CodeTag tag, const wasm::WasmCode* code, ...@@ -1480,7 +1481,7 @@ void V8FileLogger::CodeCreateEvent(CodeTag tag, const wasm::WasmCode* code,
const char* /*source_url*/, const char* /*source_url*/,
int /*code_offset*/, int /*script_id*/) { int /*code_offset*/, int /*script_id*/) {
if (!is_listening_to_code_events()) return; if (!is_listening_to_code_events()) return;
if (!FLAG_log_code) return; if (!v8_flags.log_code) return;
MSG_BUILDER(); MSG_BUILDER();
AppendCodeCreateHeader(msg, tag, CodeKind::WASM_FUNCTION, AppendCodeCreateHeader(msg, tag, CodeKind::WASM_FUNCTION,
code->instructions().begin(), code->instructions().begin(),
...@@ -1502,7 +1503,7 @@ void V8FileLogger::CodeCreateEvent(CodeTag tag, const wasm::WasmCode* code, ...@@ -1502,7 +1503,7 @@ void V8FileLogger::CodeCreateEvent(CodeTag tag, const wasm::WasmCode* code,
void V8FileLogger::CallbackEventInternal(const char* prefix, Handle<Name> name, void V8FileLogger::CallbackEventInternal(const char* prefix, Handle<Name> name,
Address entry_point) { Address entry_point) {
if (!FLAG_log_code) return; if (!v8_flags.log_code) return;
MSG_BUILDER(); MSG_BUILDER();
msg << Event::kCodeCreation << kNext << CodeTag::kCallback << kNext << -2 msg << Event::kCodeCreation << kNext << CodeTag::kCallback << kNext << -2
<< kNext << Time() << kNext << reinterpret_cast<void*>(entry_point) << kNext << Time() << kNext << reinterpret_cast<void*>(entry_point)
...@@ -1525,7 +1526,7 @@ void V8FileLogger::SetterCallbackEvent(Handle<Name> name, Address entry_point) { ...@@ -1525,7 +1526,7 @@ void V8FileLogger::SetterCallbackEvent(Handle<Name> name, Address entry_point) {
void V8FileLogger::RegExpCodeCreateEvent(Handle<AbstractCode> code, void V8FileLogger::RegExpCodeCreateEvent(Handle<AbstractCode> code,
Handle<String> source) { Handle<String> source) {
if (!is_listening_to_code_events()) return; if (!is_listening_to_code_events()) return;
if (!FLAG_log_code) return; if (!v8_flags.log_code) return;
MSG_BUILDER(); MSG_BUILDER();
AppendCodeCreateHeader(isolate_, msg, LogEventListener::CodeTag::kRegExp, AppendCodeCreateHeader(isolate_, msg, LogEventListener::CodeTag::kRegExp,
*code, Time()); *code, Time());
...@@ -1547,14 +1548,14 @@ void V8FileLogger::SharedFunctionInfoMoveEvent(Address from, Address to) { ...@@ -1547,14 +1548,14 @@ void V8FileLogger::SharedFunctionInfoMoveEvent(Address from, Address to) {
void V8FileLogger::CodeMovingGCEvent() { void V8FileLogger::CodeMovingGCEvent() {
if (!is_listening_to_code_events()) return; if (!is_listening_to_code_events()) return;
if (!FLAG_ll_prof) return; if (!v8_flags.ll_prof) return;
base::OS::SignalCodeMovingGC(); base::OS::SignalCodeMovingGC();
} }
void V8FileLogger::CodeDisableOptEvent(Handle<AbstractCode> code, void V8FileLogger::CodeDisableOptEvent(Handle<AbstractCode> code,
Handle<SharedFunctionInfo> shared) { Handle<SharedFunctionInfo> shared) {
if (!is_listening_to_code_events()) return; if (!is_listening_to_code_events()) return;
if (!FLAG_log_code) return; if (!v8_flags.log_code) return;
MSG_BUILDER(); MSG_BUILDER();
msg << Event::kCodeDisableOpt << kNext << shared->DebugNameCStr().get() msg << Event::kCodeDisableOpt << kNext << shared->DebugNameCStr().get()
<< kNext << GetBailoutReason(shared->disabled_optimization_reason()); << kNext << GetBailoutReason(shared->disabled_optimization_reason());
...@@ -1585,7 +1586,7 @@ void V8FileLogger::ProcessDeoptEvent(Handle<Code> code, SourcePosition position, ...@@ -1585,7 +1586,7 @@ void V8FileLogger::ProcessDeoptEvent(Handle<Code> code, SourcePosition position,
void V8FileLogger::CodeDeoptEvent(Handle<Code> code, DeoptimizeKind kind, void V8FileLogger::CodeDeoptEvent(Handle<Code> code, DeoptimizeKind kind,
Address pc, int fp_to_sp_delta) { Address pc, int fp_to_sp_delta) {
if (!is_logging() || !FLAG_log_deopt) return; if (!is_logging() || !v8_flags.log_deopt) return;
Deoptimizer::DeoptInfo info = Deoptimizer::GetDeoptInfo(*code, pc); Deoptimizer::DeoptInfo info = Deoptimizer::GetDeoptInfo(*code, pc);
ProcessDeoptEvent(code, info.position, Deoptimizer::MessageFor(kind), ProcessDeoptEvent(code, info.position, Deoptimizer::MessageFor(kind),
DeoptimizeReasonToString(info.deopt_reason)); DeoptimizeReasonToString(info.deopt_reason));
...@@ -1594,7 +1595,7 @@ void V8FileLogger::CodeDeoptEvent(Handle<Code> code, DeoptimizeKind kind, ...@@ -1594,7 +1595,7 @@ void V8FileLogger::CodeDeoptEvent(Handle<Code> code, DeoptimizeKind kind,
void V8FileLogger::CodeDependencyChangeEvent(Handle<Code> code, void V8FileLogger::CodeDependencyChangeEvent(Handle<Code> code,
Handle<SharedFunctionInfo> sfi, Handle<SharedFunctionInfo> sfi,
const char* reason) { const char* reason) {
if (!is_logging() || !FLAG_log_deopt) return; if (!is_logging() || !v8_flags.log_deopt) return;
SourcePosition position(sfi->StartPosition(), -1); SourcePosition position(sfi->StartPosition(), -1);
ProcessDeoptEvent(code, position, "dependency-change", reason); ProcessDeoptEvent(code, position, "dependency-change", reason);
} }
...@@ -1647,7 +1648,7 @@ void V8FileLogger::CodeNameEvent(Address addr, int pos, const char* code_name) { ...@@ -1647,7 +1648,7 @@ void V8FileLogger::CodeNameEvent(Address addr, int pos, const char* code_name) {
} }
void V8FileLogger::MoveEventInternal(Event event, Address from, Address to) { void V8FileLogger::MoveEventInternal(Event event, Address from, Address to) {
if (!FLAG_log_code) return; if (!v8_flags.log_code) return;
MSG_BUILDER(); MSG_BUILDER();
msg << event << kNext << reinterpret_cast<void*>(from) << kNext msg << event << kNext << reinterpret_cast<void*>(from) << kNext
<< reinterpret_cast<void*>(to); << reinterpret_cast<void*>(to);
...@@ -1661,7 +1662,7 @@ void AppendFunctionMessage(LogFile::MessageBuilder& msg, const char* reason, ...@@ -1661,7 +1662,7 @@ void AppendFunctionMessage(LogFile::MessageBuilder& msg, const char* reason,
msg << "function" << V8FileLogger::kNext << reason << V8FileLogger::kNext msg << "function" << V8FileLogger::kNext << reason << V8FileLogger::kNext
<< script_id << V8FileLogger::kNext << start_position << script_id << V8FileLogger::kNext << start_position
<< V8FileLogger::kNext << end_position << V8FileLogger::kNext; << V8FileLogger::kNext << end_position << V8FileLogger::kNext;
if (V8_UNLIKELY(FLAG_predictable)) { if (V8_UNLIKELY(v8_flags.predictable)) {
msg << 0.1; msg << 0.1;
} else { } else {
msg << time_delta; msg << time_delta;
...@@ -1757,7 +1758,7 @@ void V8FileLogger::ScriptDetails(Script script) { ...@@ -1757,7 +1758,7 @@ void V8FileLogger::ScriptDetails(Script script) {
} }
bool V8FileLogger::EnsureLogScriptSource(Script script) { bool V8FileLogger::EnsureLogScriptSource(Script script) {
if (!FLAG_log_source_code) return true; if (!v8_flags.log_source_code) return true;
// Make sure the script is written to the log file. // Make sure the script is written to the log file.
int script_id = script.id(); int script_id = script.id();
if (logged_source_code_.find(script_id) != logged_source_code_.end()) { if (logged_source_code_.find(script_id) != logged_source_code_.end()) {
...@@ -1800,7 +1801,7 @@ void V8FileLogger::RuntimeCallTimerEvent() { ...@@ -1800,7 +1801,7 @@ void V8FileLogger::RuntimeCallTimerEvent() {
} }
void V8FileLogger::TickEvent(TickSample* sample, bool overflow) { void V8FileLogger::TickEvent(TickSample* sample, bool overflow) {
if (!FLAG_prof_cpp) return; if (!v8_flags.prof_cpp) return;
if (V8_UNLIKELY(TracingFlags::runtime_stats.load(std::memory_order_relaxed) == if (V8_UNLIKELY(TracingFlags::runtime_stats.load(std::memory_order_relaxed) ==
v8::tracing::TracingCategoryObserver::ENABLED_BY_NATIVE)) { v8::tracing::TracingCategoryObserver::ENABLED_BY_NATIVE)) {
RuntimeCallTimerEvent(); RuntimeCallTimerEvent();
...@@ -1825,7 +1826,7 @@ void V8FileLogger::TickEvent(TickSample* sample, bool overflow) { ...@@ -1825,7 +1826,7 @@ void V8FileLogger::TickEvent(TickSample* sample, bool overflow) {
void V8FileLogger::ICEvent(const char* type, bool keyed, Handle<Map> map, void V8FileLogger::ICEvent(const char* type, bool keyed, Handle<Map> map,
Handle<Object> key, char old_state, char new_state, Handle<Object> key, char old_state, char new_state,
const char* modifier, const char* slow_stub_reason) { const char* modifier, const char* slow_stub_reason) {
if (!FLAG_log_ic) return; if (!v8_flags.log_ic) return;
int line; int line;
int column; int column;
// GetAbstractPC must come before MSG_BUILDER(), as it can GC, which might // GetAbstractPC must come before MSG_BUILDER(), as it can GC, which might
...@@ -1854,7 +1855,7 @@ void V8FileLogger::ICEvent(const char* type, bool keyed, Handle<Map> map, ...@@ -1854,7 +1855,7 @@ void V8FileLogger::ICEvent(const char* type, bool keyed, Handle<Map> map,
void V8FileLogger::MapEvent(const char* type, Handle<Map> from, Handle<Map> to, void V8FileLogger::MapEvent(const char* type, Handle<Map> from, Handle<Map> to,
const char* reason, const char* reason,
Handle<HeapObject> name_or_sfi) { Handle<HeapObject> name_or_sfi) {
if (!FLAG_log_maps) return; if (!v8_flags.log_maps) return;
if (!to.is_null()) MapDetails(*to); if (!to.is_null()) MapDetails(*to);
int line = -1; int line = -1;
int column = -1; int column = -1;
...@@ -1885,7 +1886,7 @@ void V8FileLogger::MapEvent(const char* type, Handle<Map> from, Handle<Map> to, ...@@ -1885,7 +1886,7 @@ void V8FileLogger::MapEvent(const char* type, Handle<Map> from, Handle<Map> to,
} }
void V8FileLogger::MapCreate(Map map) { void V8FileLogger::MapCreate(Map map) {
if (!FLAG_log_maps) return; if (!v8_flags.log_maps) return;
DisallowGarbageCollection no_gc; DisallowGarbageCollection no_gc;
MSG_BUILDER(); MSG_BUILDER();
msg << "map-create" << kNext << Time() << kNext << AsHex::Address(map.ptr()); msg << "map-create" << kNext << Time() << kNext << AsHex::Address(map.ptr());
...@@ -1893,12 +1894,12 @@ void V8FileLogger::MapCreate(Map map) { ...@@ -1893,12 +1894,12 @@ void V8FileLogger::MapCreate(Map map) {
} }
void V8FileLogger::MapDetails(Map map) { void V8FileLogger::MapDetails(Map map) {
if (!FLAG_log_maps) return; if (!v8_flags.log_maps) return;
DisallowGarbageCollection no_gc; DisallowGarbageCollection no_gc;
MSG_BUILDER(); MSG_BUILDER();
msg << "map-details" << kNext << Time() << kNext << AsHex::Address(map.ptr()) msg << "map-details" << kNext << Time() << kNext << AsHex::Address(map.ptr())
<< kNext; << kNext;
if (FLAG_log_maps_details) { if (v8_flags.log_maps_details) {
std::ostringstream buffer; std::ostringstream buffer;
map.PrintMapDetails(buffer); map.PrintMapDetails(buffer);
msg << buffer.str().c_str(); msg << buffer.str().c_str();
...@@ -2013,7 +2014,7 @@ void V8FileLogger::LogAllMaps() { ...@@ -2013,7 +2014,7 @@ void V8FileLogger::LogAllMaps() {
} }
static void AddIsolateIdIfNeeded(std::ostream& os, Isolate* isolate) { static void AddIsolateIdIfNeeded(std::ostream& os, Isolate* isolate) {
if (!FLAG_logfile_per_isolate) return; if (!v8_flags.logfile_per_isolate) return;
os << "isolate-" << isolate << "-" << base::OS::GetCurrentProcessId() << "-"; os << "isolate-" << isolate << "-" << base::OS::GetCurrentProcessId() << "-";
} }
...@@ -2067,30 +2068,30 @@ bool V8FileLogger::SetUp(Isolate* isolate) { ...@@ -2067,30 +2068,30 @@ bool V8FileLogger::SetUp(Isolate* isolate) {
is_initialized_ = true; is_initialized_ = true;
std::ostringstream log_file_name; std::ostringstream log_file_name;
PrepareLogFileName(log_file_name, isolate, FLAG_logfile); PrepareLogFileName(log_file_name, isolate, v8_flags.logfile);
log_ = std::make_unique<LogFile>(this, log_file_name.str()); log_ = std::make_unique<LogFile>(this, log_file_name.str());
#if V8_OS_LINUX #if V8_OS_LINUX
if (FLAG_perf_basic_prof) { if (v8_flags.perf_basic_prof) {
perf_basic_logger_ = std::make_unique<LinuxPerfBasicLogger>(isolate); perf_basic_logger_ = std::make_unique<LinuxPerfBasicLogger>(isolate);
AddLogEventListener(perf_basic_logger_.get()); AddLogEventListener(perf_basic_logger_.get());
} }
if (FLAG_perf_prof) { if (v8_flags.perf_prof) {
perf_jit_logger_ = std::make_unique<LinuxPerfJitLogger>(isolate); perf_jit_logger_ = std::make_unique<LinuxPerfJitLogger>(isolate);
AddLogEventListener(perf_jit_logger_.get()); AddLogEventListener(perf_jit_logger_.get());
} }
#else #else
static_assert( static_assert(
!FLAG_perf_prof.value(), !v8_flags.perf_prof.value(),
"--perf-prof should be statically disabled on non-Linux platforms"); "--perf-prof should be statically disabled on non-Linux platforms");
static_assert( static_assert(
!FLAG_perf_basic_prof.value(), !v8_flags.perf_basic_prof.value(),
"--perf-basic-prof should be statically disabled on non-Linux platforms"); "--perf-basic-prof should be statically disabled on non-Linux platforms");
#endif #endif
#ifdef ENABLE_GDB_JIT_INTERFACE #ifdef ENABLE_GDB_JIT_INTERFACE
if (i::FLAG_gdbjit) { if (v8_flags.gdbjit) {
gdb_jit_logger_ = gdb_jit_logger_ =
std::make_unique<JitLogger>(isolate, i::GDBJITInterface::EventHandler); std::make_unique<JitLogger>(isolate, i::GDBJITInterface::EventHandler);
AddLogEventListener(gdb_jit_logger_.get()); AddLogEventListener(gdb_jit_logger_.get());
...@@ -2099,7 +2100,7 @@ bool V8FileLogger::SetUp(Isolate* isolate) { ...@@ -2099,7 +2100,7 @@ bool V8FileLogger::SetUp(Isolate* isolate) {
#endif // ENABLE_GDB_JIT_INTERFACE #endif // ENABLE_GDB_JIT_INTERFACE
#if defined(V8_OS_WIN) && defined(V8_ENABLE_ETW_STACK_WALKING) #if defined(V8_OS_WIN) && defined(V8_ENABLE_ETW_STACK_WALKING)
if (i::FLAG_enable_etw_stack_walking) { if (v8_flags.enable_etw_stack_walking) {
etw_jit_logger_ = etw_jit_logger_ =
std::make_unique<JitLogger>(isolate, i::ETWJITInterface::EventHandler); std::make_unique<JitLogger>(isolate, i::ETWJITInterface::EventHandler);
AddLogEventListener(etw_jit_logger_.get()); AddLogEventListener(etw_jit_logger_.get());
...@@ -2107,16 +2108,16 @@ bool V8FileLogger::SetUp(Isolate* isolate) { ...@@ -2107,16 +2108,16 @@ bool V8FileLogger::SetUp(Isolate* isolate) {
} }
#endif // defined(V8_OS_WIN) #endif // defined(V8_OS_WIN)
if (FLAG_ll_prof) { if (v8_flags.ll_prof) {
ll_logger_ = ll_logger_ =
std::make_unique<LowLevelLogger>(isolate, log_file_name.str().c_str()); std::make_unique<LowLevelLogger>(isolate, log_file_name.str().c_str());
AddLogEventListener(ll_logger_.get()); AddLogEventListener(ll_logger_.get());
} }
ticker_ = std::make_unique<Ticker>(isolate, FLAG_prof_sampling_interval); ticker_ = std::make_unique<Ticker>(isolate, v8_flags.prof_sampling_interval);
if (FLAG_log) UpdateIsLogging(true); if (v8_flags.log) UpdateIsLogging(true);
timer_.Start(); timer_.Start();
if (FLAG_prof_cpp) { if (v8_flags.prof_cpp) {
CHECK(FLAG_log); CHECK(v8_flags.log);
CHECK(is_logging()); CHECK(is_logging());
profiler_ = std::make_unique<Profiler>(isolate); profiler_ = std::make_unique<Profiler>(isolate);
profiler_->Engage(); profiler_->Engage();
......
...@@ -70,9 +70,9 @@ class SourcePosition; ...@@ -70,9 +70,9 @@ class SourcePosition;
class Ticker; class Ticker;
#undef LOG #undef LOG
#define LOG(isolate, Call) \ #define LOG(isolate, Call) \
do { \ do { \
if (v8::internal::FLAG_log) (isolate)->v8_file_logger()->Call; \ if (v8::internal::v8_flags.log) (isolate)->v8_file_logger()->Call; \
} while (false) } while (false)
#define LOG_CODE_EVENT(isolate, Call) \ #define LOG_CODE_EVENT(isolate, Call) \
...@@ -299,7 +299,7 @@ class V8FileLogger : public LogEventListener { ...@@ -299,7 +299,7 @@ class V8FileLogger : public LogEventListener {
void TickEvent(TickSample* sample, bool overflow); void TickEvent(TickSample* sample, bool overflow);
void RuntimeCallTimerEvent(); void RuntimeCallTimerEvent();
// Logs a StringEvent regardless of whether FLAG_log is true. // Logs a StringEvent regardless of whether v8_flags.log is true.
void UncheckedStringEvent(const char* name, const char* value); void UncheckedStringEvent(const char* name, const char* value);
// Logs a scripts sources. Keeps track of all logged scripts to ensure that // Logs a scripts sources. Keeps track of all logged scripts to ensure that
......
...@@ -157,7 +157,7 @@ RuntimeCallStats::RuntimeCallStats(ThreadType thread_type) ...@@ -157,7 +157,7 @@ RuntimeCallStats::RuntimeCallStats(ThreadType thread_type)
for (int i = 0; i < kNumberOfCounters; i++) { for (int i = 0; i < kNumberOfCounters; i++) {
this->counters_[i] = RuntimeCallCounter(kNames[i]); this->counters_[i] = RuntimeCallCounter(kNames[i]);
} }
if (FLAG_rcs_cpu_time) { if (v8_flags.rcs_cpu_time) {
CHECK(base::ThreadTicks::IsSupported()); CHECK(base::ThreadTicks::IsSupported());
base::ThreadTicks::WaitUntilInitialized(); base::ThreadTicks::WaitUntilInitialized();
RuntimeCallTimer::Now = &RuntimeCallTimer::NowCPUTime; RuntimeCallTimer::Now = &RuntimeCallTimer::NowCPUTime;
......
...@@ -13,8 +13,8 @@ namespace v8 { ...@@ -13,8 +13,8 @@ namespace v8 {
namespace internal { namespace internal {
// This struct contains a set of flags that can be modified from multiple // This struct contains a set of flags that can be modified from multiple
// threads at runtime unlike the normal FLAG_-like flags which are not modified // threads at runtime unlike the normal v8_flags.-like flags which are not
// after V8 instance is initialized. // modified after V8 instance is initialized.
struct TracingFlags { struct TracingFlags {
static V8_EXPORT_PRIVATE std::atomic_uint runtime_stats; static V8_EXPORT_PRIVATE std::atomic_uint runtime_stats;
......
...@@ -75,7 +75,7 @@ class SnapshotNativeCounterTest : public TestWithNativeContextAndCounters { ...@@ -75,7 +75,7 @@ class SnapshotNativeCounterTest : public TestWithNativeContextAndCounters {
} // namespace } // namespace
TEST_F(AggregatedMemoryHistogramTest, OneSample1) { TEST_F(AggregatedMemoryHistogramTest, OneSample1) {
FLAG_histogram_interval = 10; v8_flags.histogram_interval = 10;
AddSample(10, 1000); AddSample(10, 1000);
AddSample(20, 1000); AddSample(20, 1000);
EXPECT_EQ(1U, samples()->size()); EXPECT_EQ(1U, samples()->size());
...@@ -83,7 +83,7 @@ TEST_F(AggregatedMemoryHistogramTest, OneSample1) { ...@@ -83,7 +83,7 @@ TEST_F(AggregatedMemoryHistogramTest, OneSample1) {
} }
TEST_F(AggregatedMemoryHistogramTest, OneSample2) { TEST_F(AggregatedMemoryHistogramTest, OneSample2) {
FLAG_histogram_interval = 10; v8_flags.histogram_interval = 10;
AddSample(10, 500); AddSample(10, 500);
AddSample(20, 1000); AddSample(20, 1000);
EXPECT_EQ(1U, samples()->size()); EXPECT_EQ(1U, samples()->size());
...@@ -91,7 +91,7 @@ TEST_F(AggregatedMemoryHistogramTest, OneSample2) { ...@@ -91,7 +91,7 @@ TEST_F(AggregatedMemoryHistogramTest, OneSample2) {
} }
TEST_F(AggregatedMemoryHistogramTest, OneSample3) { TEST_F(AggregatedMemoryHistogramTest, OneSample3) {
FLAG_histogram_interval = 10; v8_flags.histogram_interval = 10;
AddSample(10, 500); AddSample(10, 500);
AddSample(15, 500); AddSample(15, 500);
AddSample(15, 1000); AddSample(15, 1000);
...@@ -101,7 +101,7 @@ TEST_F(AggregatedMemoryHistogramTest, OneSample3) { ...@@ -101,7 +101,7 @@ TEST_F(AggregatedMemoryHistogramTest, OneSample3) {
} }
TEST_F(AggregatedMemoryHistogramTest, OneSample4) { TEST_F(AggregatedMemoryHistogramTest, OneSample4) {
FLAG_histogram_interval = 10; v8_flags.histogram_interval = 10;
AddSample(10, 500); AddSample(10, 500);
AddSample(15, 750); AddSample(15, 750);
AddSample(20, 1000); AddSample(20, 1000);
...@@ -110,7 +110,7 @@ TEST_F(AggregatedMemoryHistogramTest, OneSample4) { ...@@ -110,7 +110,7 @@ TEST_F(AggregatedMemoryHistogramTest, OneSample4) {
} }
TEST_F(AggregatedMemoryHistogramTest, TwoSamples1) { TEST_F(AggregatedMemoryHistogramTest, TwoSamples1) {
FLAG_histogram_interval = 10; v8_flags.histogram_interval = 10;
AddSample(10, 1000); AddSample(10, 1000);
AddSample(30, 1000); AddSample(30, 1000);
EXPECT_EQ(2U, samples()->size()); EXPECT_EQ(2U, samples()->size());
...@@ -119,7 +119,7 @@ TEST_F(AggregatedMemoryHistogramTest, TwoSamples1) { ...@@ -119,7 +119,7 @@ TEST_F(AggregatedMemoryHistogramTest, TwoSamples1) {
} }
TEST_F(AggregatedMemoryHistogramTest, TwoSamples2) { TEST_F(AggregatedMemoryHistogramTest, TwoSamples2) {
FLAG_histogram_interval = 10; v8_flags.histogram_interval = 10;
AddSample(10, 1000); AddSample(10, 1000);
AddSample(20, 1000); AddSample(20, 1000);
AddSample(30, 1000); AddSample(30, 1000);
...@@ -129,7 +129,7 @@ TEST_F(AggregatedMemoryHistogramTest, TwoSamples2) { ...@@ -129,7 +129,7 @@ TEST_F(AggregatedMemoryHistogramTest, TwoSamples2) {
} }
TEST_F(AggregatedMemoryHistogramTest, TwoSamples3) { TEST_F(AggregatedMemoryHistogramTest, TwoSamples3) {
FLAG_histogram_interval = 10; v8_flags.histogram_interval = 10;
AddSample(10, 1000); AddSample(10, 1000);
AddSample(20, 1000); AddSample(20, 1000);
AddSample(20, 500); AddSample(20, 500);
...@@ -140,7 +140,7 @@ TEST_F(AggregatedMemoryHistogramTest, TwoSamples3) { ...@@ -140,7 +140,7 @@ TEST_F(AggregatedMemoryHistogramTest, TwoSamples3) {
} }
TEST_F(AggregatedMemoryHistogramTest, TwoSamples4) { TEST_F(AggregatedMemoryHistogramTest, TwoSamples4) {
FLAG_histogram_interval = 10; v8_flags.histogram_interval = 10;
AddSample(10, 1000); AddSample(10, 1000);
AddSample(30, 0); AddSample(30, 0);
EXPECT_EQ(2U, samples()->size()); EXPECT_EQ(2U, samples()->size());
...@@ -149,7 +149,7 @@ TEST_F(AggregatedMemoryHistogramTest, TwoSamples4) { ...@@ -149,7 +149,7 @@ TEST_F(AggregatedMemoryHistogramTest, TwoSamples4) {
} }
TEST_F(AggregatedMemoryHistogramTest, TwoSamples5) { TEST_F(AggregatedMemoryHistogramTest, TwoSamples5) {
FLAG_histogram_interval = 10; v8_flags.histogram_interval = 10;
AddSample(10, 0); AddSample(10, 0);
AddSample(30, 1000); AddSample(30, 1000);
EXPECT_EQ(2U, samples()->size()); EXPECT_EQ(2U, samples()->size());
...@@ -158,7 +158,7 @@ TEST_F(AggregatedMemoryHistogramTest, TwoSamples5) { ...@@ -158,7 +158,7 @@ TEST_F(AggregatedMemoryHistogramTest, TwoSamples5) {
} }
TEST_F(AggregatedMemoryHistogramTest, TwoSamples6) { TEST_F(AggregatedMemoryHistogramTest, TwoSamples6) {
FLAG_histogram_interval = 10; v8_flags.histogram_interval = 10;
AddSample(10, 0); AddSample(10, 0);
AddSample(15, 1000); AddSample(15, 1000);
AddSample(30, 1000); AddSample(30, 1000);
...@@ -168,7 +168,7 @@ TEST_F(AggregatedMemoryHistogramTest, TwoSamples6) { ...@@ -168,7 +168,7 @@ TEST_F(AggregatedMemoryHistogramTest, TwoSamples6) {
} }
TEST_F(AggregatedMemoryHistogramTest, TwoSamples7) { TEST_F(AggregatedMemoryHistogramTest, TwoSamples7) {
FLAG_histogram_interval = 10; v8_flags.histogram_interval = 10;
AddSample(10, 0); AddSample(10, 0);
AddSample(15, 1000); AddSample(15, 1000);
AddSample(25, 0); AddSample(25, 0);
...@@ -179,7 +179,7 @@ TEST_F(AggregatedMemoryHistogramTest, TwoSamples7) { ...@@ -179,7 +179,7 @@ TEST_F(AggregatedMemoryHistogramTest, TwoSamples7) {
} }
TEST_F(AggregatedMemoryHistogramTest, TwoSamples8) { TEST_F(AggregatedMemoryHistogramTest, TwoSamples8) {
FLAG_histogram_interval = 10; v8_flags.histogram_interval = 10;
AddSample(10, 1000); AddSample(10, 1000);
AddSample(15, 0); AddSample(15, 0);
AddSample(25, 1000); AddSample(25, 1000);
...@@ -190,7 +190,7 @@ TEST_F(AggregatedMemoryHistogramTest, TwoSamples8) { ...@@ -190,7 +190,7 @@ TEST_F(AggregatedMemoryHistogramTest, TwoSamples8) {
} }
TEST_F(AggregatedMemoryHistogramTest, ManySamples1) { TEST_F(AggregatedMemoryHistogramTest, ManySamples1) {
FLAG_histogram_interval = 10; v8_flags.histogram_interval = 10;
const int kMaxSamples = 1000; const int kMaxSamples = 1000;
AddSample(0, 0); AddSample(0, 0);
AddSample(10 * kMaxSamples, 10 * kMaxSamples); AddSample(10 * kMaxSamples, 10 * kMaxSamples);
...@@ -201,7 +201,7 @@ TEST_F(AggregatedMemoryHistogramTest, ManySamples1) { ...@@ -201,7 +201,7 @@ TEST_F(AggregatedMemoryHistogramTest, ManySamples1) {
} }
TEST_F(AggregatedMemoryHistogramTest, ManySamples2) { TEST_F(AggregatedMemoryHistogramTest, ManySamples2) {
FLAG_histogram_interval = 10; v8_flags.histogram_interval = 10;
const int kMaxSamples = 1000; const int kMaxSamples = 1000;
AddSample(0, 0); AddSample(0, 0);
AddSample(10 * (2 * kMaxSamples), 10 * (2 * kMaxSamples)); AddSample(10 * (2 * kMaxSamples), 10 * (2 * kMaxSamples));
...@@ -214,7 +214,7 @@ TEST_F(AggregatedMemoryHistogramTest, ManySamples2) { ...@@ -214,7 +214,7 @@ TEST_F(AggregatedMemoryHistogramTest, ManySamples2) {
TEST_F(SnapshotNativeCounterTest, WriteBarrier) { TEST_F(SnapshotNativeCounterTest, WriteBarrier) {
RunJS("let o = {a: 42};"); RunJS("let o = {a: 42};");
if (!FLAG_single_generation && SupportsNativeCounters()) { if (!v8_flags.single_generation && SupportsNativeCounters()) {
EXPECT_NE(0, write_barriers()); EXPECT_NE(0, write_barriers());
} else { } else {
EXPECT_EQ(0, write_barriers()); EXPECT_EQ(0, write_barriers());
......
...@@ -57,11 +57,11 @@ namespace { ...@@ -57,11 +57,11 @@ namespace {
class LogTest : public TestWithIsolate { class LogTest : public TestWithIsolate {
public: public:
static void SetUpTestSuite() { static void SetUpTestSuite() {
i::FLAG_log = true; i::v8_flags.log = true;
i::FLAG_prof = true; i::v8_flags.prof = true;
i::FLAG_log_code = true; i::v8_flags.log_code = true;
i::FLAG_logfile = i::LogFile::kLogToTemporaryFile; i::v8_flags.logfile = i::LogFile::kLogToTemporaryFile;
i::FLAG_logfile_per_isolate = false; i::v8_flags.logfile_per_isolate = false;
TestWithIsolate::SetUpTestSuite(); TestWithIsolate::SetUpTestSuite();
} }
}; };
...@@ -498,11 +498,11 @@ TEST_F(LogTest, Issue539892) { ...@@ -498,11 +498,11 @@ TEST_F(LogTest, Issue539892) {
class LogAllTest : public LogTest { class LogAllTest : public LogTest {
public: public:
static void SetUpTestSuite() { static void SetUpTestSuite() {
i::FLAG_log_all = true; i::v8_flags.log_all = true;
i::FLAG_log_deopt = true; i::v8_flags.log_deopt = true;
i::FLAG_turbo_inlining = false; i::v8_flags.turbo_inlining = false;
i::FLAG_log_internal_timer_events = true; i::v8_flags.log_internal_timer_events = true;
i::FLAG_allow_natives_syntax = true; i::v8_flags.allow_natives_syntax = true;
LogTest::SetUpTestSuite(); LogTest::SetUpTestSuite();
} }
}; };
...@@ -543,7 +543,7 @@ TEST_F(LogAllTest, LogAll) { ...@@ -543,7 +543,7 @@ TEST_F(LogAllTest, LogAll) {
CHECK(logger.ContainsLine({"code-creation,Script", ":1:1"})); CHECK(logger.ContainsLine({"code-creation,Script", ":1:1"}));
CHECK(logger.ContainsLine({"code-creation,JS,", "testAddFn"})); CHECK(logger.ContainsLine({"code-creation,JS,", "testAddFn"}));
if (i::FLAG_turbofan && !i::FLAG_always_turbofan) { if (i::v8_flags.turbofan && !i::v8_flags.always_turbofan) {
CHECK(logger.ContainsLine({"code-deopt,", "not a Smi"})); CHECK(logger.ContainsLine({"code-deopt,", "not a Smi"}));
CHECK(logger.ContainsLine({"timer-event-start", "V8.DeoptimizeCode"})); CHECK(logger.ContainsLine({"timer-event-start", "V8.DeoptimizeCode"}));
CHECK(logger.ContainsLine({"timer-event-end", "V8.DeoptimizeCode"})); CHECK(logger.ContainsLine({"timer-event-end", "V8.DeoptimizeCode"}));
...@@ -554,7 +554,7 @@ TEST_F(LogAllTest, LogAll) { ...@@ -554,7 +554,7 @@ TEST_F(LogAllTest, LogAll) {
class LogInterpretedFramesNativeStackTest : public LogTest { class LogInterpretedFramesNativeStackTest : public LogTest {
public: public:
static void SetUpTestSuite() { static void SetUpTestSuite() {
i::FLAG_interpreted_frames_native_stack = true; i::v8_flags.interpreted_frames_native_stack = true;
LogTest::SetUpTestSuite(); LogTest::SetUpTestSuite();
} }
}; };
...@@ -583,13 +583,13 @@ class LogInterpretedFramesNativeStackWithSerializationTest ...@@ -583,13 +583,13 @@ class LogInterpretedFramesNativeStackWithSerializationTest
: array_buffer_allocator_( : array_buffer_allocator_(
v8::ArrayBuffer::Allocator::NewDefaultAllocator()) {} v8::ArrayBuffer::Allocator::NewDefaultAllocator()) {}
static void SetUpTestSuite() { static void SetUpTestSuite() {
i::FLAG_log = true; i::v8_flags.log = true;
i::FLAG_prof = true; i::v8_flags.prof = true;
i::FLAG_log_code = true; i::v8_flags.log_code = true;
i::FLAG_logfile = i::LogFile::kLogToTemporaryFile; i::v8_flags.logfile = i::LogFile::kLogToTemporaryFile;
i::FLAG_logfile_per_isolate = false; i::v8_flags.logfile_per_isolate = false;
i::FLAG_interpreted_frames_native_stack = true; i::v8_flags.interpreted_frames_native_stack = true;
i::FLAG_always_turbofan = false; i::v8_flags.always_turbofan = false;
TestWithPlatform::SetUpTestSuite(); TestWithPlatform::SetUpTestSuite();
} }
...@@ -673,8 +673,8 @@ TEST_F(LogInterpretedFramesNativeStackWithSerializationTest, ...@@ -673,8 +673,8 @@ TEST_F(LogInterpretedFramesNativeStackWithSerializationTest,
class LogExternalLogEventListenerTest : public TestWithIsolate { class LogExternalLogEventListenerTest : public TestWithIsolate {
public: public:
static void SetUpTestSuite() { static void SetUpTestSuite() {
i::FLAG_log = false; i::v8_flags.log = false;
i::FLAG_prof = false; i::v8_flags.prof = false;
TestWithIsolate::SetUpTestSuite(); TestWithIsolate::SetUpTestSuite();
} }
}; };
...@@ -728,8 +728,8 @@ class LogExternalLogEventListenerInnerFunctionTest : public TestWithPlatform { ...@@ -728,8 +728,8 @@ class LogExternalLogEventListenerInnerFunctionTest : public TestWithPlatform {
: array_buffer_allocator_( : array_buffer_allocator_(
v8::ArrayBuffer::Allocator::NewDefaultAllocator()) {} v8::ArrayBuffer::Allocator::NewDefaultAllocator()) {}
static void SetUpTestSuite() { static void SetUpTestSuite() {
i::FLAG_log = false; i::v8_flags.log = false;
i::FLAG_prof = false; i::v8_flags.prof = false;
TestWithPlatform::SetUpTestSuite(); TestWithPlatform::SetUpTestSuite();
} }
...@@ -771,11 +771,11 @@ TEST_F(LogExternalLogEventListenerInnerFunctionTest, ...@@ -771,11 +771,11 @@ TEST_F(LogExternalLogEventListenerInnerFunctionTest,
v8::ScriptCompiler::CompileUnboundScript(isolate1, &source) v8::ScriptCompiler::CompileUnboundScript(isolate1, &source)
.ToLocalChecked(); .ToLocalChecked();
CHECK_EQ(code_event_handler.CountLines("Function", "f1"), CHECK_EQ(code_event_handler.CountLines("Function", "f1"),
1 + (i::FLAG_stress_background_compile ? 1 : 0) + 1 + (i::v8_flags.stress_background_compile ? 1 : 0) +
(i::FLAG_always_sparkplug ? 1 : 0)); (i::v8_flags.always_sparkplug ? 1 : 0));
CHECK_EQ(code_event_handler.CountLines("Function", "f2"), CHECK_EQ(code_event_handler.CountLines("Function", "f2"),
1 + (i::FLAG_stress_background_compile ? 1 : 0) + 1 + (i::v8_flags.stress_background_compile ? 1 : 0) +
(i::FLAG_always_sparkplug ? 1 : 0)); (i::v8_flags.always_sparkplug ? 1 : 0));
cache = v8::ScriptCompiler::CreateCodeCache(script); cache = v8::ScriptCompiler::CreateCodeCache(script);
} }
isolate1->Dispose(); isolate1->Dispose();
...@@ -811,9 +811,9 @@ TEST_F(LogExternalLogEventListenerInnerFunctionTest, ...@@ -811,9 +811,9 @@ TEST_F(LogExternalLogEventListenerInnerFunctionTest,
class LogExternalInterpretedFramesNativeStackTest : public TestWithIsolate { class LogExternalInterpretedFramesNativeStackTest : public TestWithIsolate {
public: public:
static void SetUpTestSuite() { static void SetUpTestSuite() {
i::FLAG_log = false; i::v8_flags.log = false;
i::FLAG_prof = false; i::v8_flags.prof = false;
i::FLAG_interpreted_frames_native_stack = true; i::v8_flags.interpreted_frames_native_stack = true;
TestWithIsolate::SetUpTestSuite(); TestWithIsolate::SetUpTestSuite();
} }
}; };
...@@ -863,7 +863,7 @@ TEST_F(LogExternalInterpretedFramesNativeStackTest, ...@@ -863,7 +863,7 @@ TEST_F(LogExternalInterpretedFramesNativeStackTest,
class LogMapsTest : public LogTest { class LogMapsTest : public LogTest {
public: public:
static void SetUpTestSuite() { static void SetUpTestSuite() {
i::FLAG_log_maps = true; i::v8_flags.log_maps = true;
LogTest::SetUpTestSuite(); LogTest::SetUpTestSuite();
} }
}; };
...@@ -949,8 +949,9 @@ void ValidateMapDetailsLogging(v8::Isolate* isolate, ...@@ -949,8 +949,9 @@ void ValidateMapDetailsLogging(v8::Isolate* isolate,
TEST_F(LogMapsTest, LogMapsDetailsStartup) { TEST_F(LogMapsTest, LogMapsDetailsStartup) {
// Reusing map addresses might cause these tests to fail. // Reusing map addresses might cause these tests to fail.
if (i::FLAG_gc_global || i::FLAG_stress_compaction || if (i::v8_flags.gc_global || i::v8_flags.stress_compaction ||
i::FLAG_stress_incremental_marking || i::FLAG_enable_third_party_heap) { i::v8_flags.stress_incremental_marking ||
i::v8_flags.enable_third_party_heap) {
return; return;
} }
// Test that all Map details from Maps in the snapshot are logged properly. // Test that all Map details from Maps in the snapshot are logged properly.
...@@ -964,16 +965,17 @@ TEST_F(LogMapsTest, LogMapsDetailsStartup) { ...@@ -964,16 +965,17 @@ TEST_F(LogMapsTest, LogMapsDetailsStartup) {
class LogMapsCodeTest : public LogTest { class LogMapsCodeTest : public LogTest {
public: public:
static void SetUpTestSuite() { static void SetUpTestSuite() {
i::FLAG_retain_maps_for_n_gc = 0xFFFFFFF; i::v8_flags.retain_maps_for_n_gc = 0xFFFFFFF;
i::FLAG_log_maps = true; i::v8_flags.log_maps = true;
LogTest::SetUpTestSuite(); LogTest::SetUpTestSuite();
} }
}; };
TEST_F(LogMapsCodeTest, LogMapsDetailsCode) { TEST_F(LogMapsCodeTest, LogMapsDetailsCode) {
// Reusing map addresses might cause these tests to fail. // Reusing map addresses might cause these tests to fail.
if (i::FLAG_gc_global || i::FLAG_stress_compaction || if (i::v8_flags.gc_global || i::v8_flags.stress_compaction ||
i::FLAG_stress_incremental_marking || i::FLAG_enable_third_party_heap) { i::v8_flags.stress_incremental_marking ||
i::v8_flags.enable_third_party_heap) {
return; return;
} }
...@@ -1061,8 +1063,9 @@ TEST_F(LogMapsCodeTest, LogMapsDetailsCode) { ...@@ -1061,8 +1063,9 @@ TEST_F(LogMapsCodeTest, LogMapsDetailsCode) {
TEST_F(LogMapsTest, LogMapsDetailsContexts) { TEST_F(LogMapsTest, LogMapsDetailsContexts) {
// Reusing map addresses might cause these tests to fail. // Reusing map addresses might cause these tests to fail.
if (i::FLAG_gc_global || i::FLAG_stress_compaction || if (i::v8_flags.gc_global || i::v8_flags.stress_compaction ||
i::FLAG_stress_incremental_marking || i::FLAG_enable_third_party_heap) { i::v8_flags.stress_incremental_marking ||
i::v8_flags.enable_third_party_heap) {
return; return;
} }
// Test that all Map details from Maps in the snapshot are logged properly. // Test that all Map details from Maps in the snapshot are logged properly.
...@@ -1132,7 +1135,7 @@ class LogFunctionEventsTest : public LogTest { ...@@ -1132,7 +1135,7 @@ class LogFunctionEventsTest : public LogTest {
TEST_F(LogFunctionEventsTest, LogFunctionEvents) { TEST_F(LogFunctionEventsTest, LogFunctionEvents) {
// --always-turbofan will break the fine-grained log order. // --always-turbofan will break the fine-grained log order.
if (i::FLAG_always_turbofan) return; if (i::v8_flags.always_turbofan) return;
{ {
ScopedLoggerInitializer logger(isolate()); ScopedLoggerInitializer logger(isolate());
......
...@@ -460,8 +460,8 @@ static void CustomCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { ...@@ -460,8 +460,8 @@ static void CustomCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
} // namespace } // namespace
TEST_F(RuntimeCallStatsTest, CallbackFunction) { TEST_F(RuntimeCallStatsTest, CallbackFunction) {
FLAG_allow_natives_syntax = true; v8_flags.allow_natives_syntax = true;
FLAG_incremental_marking = false; v8_flags.incremental_marking = false;
RuntimeCallCounter* callback_counter = RuntimeCallCounter* callback_counter =
stats()->GetCounter(RuntimeCallCounterId::kFunctionCallback); stats()->GetCounter(RuntimeCallCounterId::kFunctionCallback);
...@@ -539,8 +539,8 @@ TEST_F(RuntimeCallStatsTest, CallbackFunction) { ...@@ -539,8 +539,8 @@ TEST_F(RuntimeCallStatsTest, CallbackFunction) {
} }
TEST_F(RuntimeCallStatsTest, ApiGetter) { TEST_F(RuntimeCallStatsTest, ApiGetter) {
FLAG_allow_natives_syntax = true; v8_flags.allow_natives_syntax = true;
FLAG_incremental_marking = false; v8_flags.incremental_marking = false;
RuntimeCallCounter* callback_counter = RuntimeCallCounter* callback_counter =
stats()->GetCounter(RuntimeCallCounterId::kFunctionCallback); stats()->GetCounter(RuntimeCallCounterId::kFunctionCallback);
...@@ -627,12 +627,12 @@ TEST_F(RuntimeCallStatsTest, ApiGetter) { ...@@ -627,12 +627,12 @@ TEST_F(RuntimeCallStatsTest, ApiGetter) {
} }
TEST_F(RuntimeCallStatsTest, GarbageCollection) { TEST_F(RuntimeCallStatsTest, GarbageCollection) {
if (FLAG_stress_incremental_marking) return; if (v8_flags.stress_incremental_marking) return;
FLAG_expose_gc = true; v8_flags.expose_gc = true;
// Disable concurrent GC threads because otherwise they may continue // Disable concurrent GC threads because otherwise they may continue
// running after this test completes and race with is_runtime_stats_enabled() // running after this test completes and race with is_runtime_stats_enabled()
// updates. // updates.
FLAG_single_threaded_gc = true; v8_flags.single_threaded_gc = true;
FlagList::EnforceFlagImplications(); FlagList::EnforceFlagImplications();
v8::Isolate* isolate = v8_isolate(); v8::Isolate* isolate = v8_isolate();
......
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