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

[debug] Use v8_flags for accessing flag values

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

R=szuend@chromium.org

Bug: v8:12887
Change-Id: I8123d18ae852807557bf26b1308e0061dc1ac123
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3898937Reviewed-by: 's avatarSimon Zünd <szuend@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83216}
parent bc0200cf
......@@ -478,7 +478,7 @@ void CollectBlockCoverage(CoverageFunction* function, SharedFunctionInfo info,
void PrintBlockCoverage(const CoverageFunction* function,
SharedFunctionInfo info, bool has_nonempty_source_range,
bool function_is_relevant) {
DCHECK(FLAG_trace_block_coverage);
DCHECK(v8_flags.trace_block_coverage);
std::unique_ptr<char[]> function_name =
function->name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
i::PrintF(
......@@ -543,10 +543,10 @@ void CollectAndMaybeResetCounts(Isolate* isolate,
count =
static_cast<uint32_t>(func.feedback_vector().invocation_count());
} else if (func.raw_feedback_cell().interrupt_budget() <
FLAG_interrupt_budget_for_feedback_allocation) {
v8_flags.interrupt_budget_for_feedback_allocation) {
// TODO(jgruber): The condition above is no longer precise since we
// may use either the fixed interrupt_budget or
// FLAG_interrupt_budget_factor_for_feedback_allocation. If the
// v8_flags.interrupt_budget_factor_for_feedback_allocation. If the
// latter, we may incorrectly set a count of 1.
//
// We haven't allocated feedback vector, but executed the function
......@@ -735,7 +735,7 @@ std::unique_ptr<Coverage> Coverage::Collect(
functions->emplace_back(function);
}
if (FLAG_trace_block_coverage) {
if (v8_flags.trace_block_coverage) {
PrintBlockCoverage(&function, *info, has_nonempty_source_range,
function_is_relevant);
}
......
......@@ -407,7 +407,7 @@ bool DebugEvaluate::IsSideEffectFreeIntrinsic(Runtime::FunctionId id) {
INLINE_INTRINSIC_ALLOWLIST(INLINE_CASE)
return true;
default:
if (FLAG_trace_side_effect_free_debug_evaluate) {
if (v8_flags.trace_side_effect_free_debug_evaluate) {
PrintF("[debug-evaluate] intrinsic %s may cause side effect.\n",
Runtime::FunctionForId(id)->name);
}
......@@ -975,7 +975,7 @@ DebugInfo::SideEffectState BuiltinGetSideEffectState(Builtin id) {
return DebugInfo::kRequiresRuntimeChecks;
default:
if (FLAG_trace_side_effect_free_debug_evaluate) {
if (v8_flags.trace_side_effect_free_debug_evaluate) {
PrintF("[debug-evaluate] built-in %s may cause side effect.\n",
Builtins::name(id));
}
......@@ -1003,7 +1003,7 @@ bool BytecodeRequiresRuntimeCheck(interpreter::Bytecode bytecode) {
// static
DebugInfo::SideEffectState DebugEvaluate::FunctionGetSideEffectState(
Isolate* isolate, Handle<SharedFunctionInfo> info) {
if (FLAG_trace_side_effect_free_debug_evaluate) {
if (v8_flags.trace_side_effect_free_debug_evaluate) {
PrintF("[debug-evaluate] Checking function %s for side effect.\n",
info->DebugNameCStr().get());
}
......@@ -1014,7 +1014,7 @@ DebugInfo::SideEffectState DebugEvaluate::FunctionGetSideEffectState(
// Check bytecodes against allowlist.
Handle<BytecodeArray> bytecode_array(info->GetBytecodeArray(isolate),
isolate);
if (FLAG_trace_side_effect_free_debug_evaluate) {
if (v8_flags.trace_side_effect_free_debug_evaluate) {
bytecode_array->Print();
}
bool requires_runtime_checks = false;
......@@ -1027,7 +1027,7 @@ DebugInfo::SideEffectState DebugEvaluate::FunctionGetSideEffectState(
continue;
}
if (FLAG_trace_side_effect_free_debug_evaluate) {
if (v8_flags.trace_side_effect_free_debug_evaluate) {
PrintF("[debug-evaluate] bytecode %s may cause side effect.\n",
interpreter::Bytecodes::ToString(bytecode));
}
......
......@@ -948,8 +948,8 @@ MaybeLocal<UnboundScript> CompileInspectorScript(Isolate* v8_isolate,
isolate, str, i::ScriptDetails(), cached_data,
ScriptCompiler::kNoCompileOptions,
ScriptCompiler::kNoCacheBecauseInspector,
i::FLAG_expose_inspector_scripts ? i::NOT_NATIVES_CODE
: i::INSPECTOR_CODE);
i::v8_flags.expose_inspector_scripts ? i::NOT_NATIVES_CODE
: i::INSPECTOR_CODE);
has_pending_exception = !maybe_function_info.ToHandle(&result);
RETURN_ON_FAILED_EXECUTION(UnboundScript);
}
......@@ -1431,7 +1431,7 @@ MaybeLocal<Message> GetMessageFromPromise(Local<Promise> p) {
}
bool isExperimentalAsyncStackTaggingApiEnabled() {
return v8::internal::FLAG_experimental_async_stack_tagging_api;
return i::v8_flags.experimental_async_stack_tagging_api;
}
void RecordAsyncStackTaggingCreateTaskCall(v8::Isolate* v8_isolate) {
......
......@@ -561,7 +561,7 @@ Handle<JSObject> ScopeIterator::ScopeObject(Mode mode) {
auto visitor = [=](Handle<String> name, Handle<Object> value,
ScopeType scope_type) {
if (value->IsOptimizedOut(isolate_)) {
if (FLAG_experimental_value_unavailable) {
if (v8_flags.experimental_value_unavailable) {
JSObject::SetAccessor(scope, name,
isolate_->factory()->value_unavailable_accessor(),
NONE)
......@@ -577,7 +577,7 @@ Handle<JSObject> ScopeIterator::ScopeObject(Mode mode) {
// REPL mode in a script context. Catch this case.
return false;
}
if (FLAG_experimental_value_unavailable) {
if (v8_flags.experimental_value_unavailable) {
JSObject::SetAccessor(scope, name,
isolate_->factory()->value_unavailable_accessor(),
NONE)
......
......@@ -2573,7 +2573,7 @@ void Debug::HandleDebugBreak(IgnoreBreakMode ignore_break_mode,
#ifdef DEBUG
void Debug::PrintBreakLocation() {
if (!FLAG_print_break_location) return;
if (!v8_flags.print_break_location) return;
RCS_SCOPE(isolate_, RuntimeCallCounterId::kDebugger);
HandleScope scope(isolate_);
StackTraceFrameIterator iterator(isolate_);
......@@ -2783,7 +2783,7 @@ bool Debug::PerformSideEffectCheck(Handle<JSFunction> function,
debug_info->GetSideEffectState(isolate_);
switch (side_effect_state) {
case DebugInfo::kHasSideEffects:
if (FLAG_trace_side_effect_free_debug_evaluate) {
if (v8_flags.trace_side_effect_free_debug_evaluate) {
PrintF("[debug-evaluate] Function %s failed side effect check.\n",
function->shared().DebugNameCStr().get());
}
......@@ -2846,7 +2846,7 @@ bool Debug::PerformSideEffectCheckForCallback(
case SideEffectType::kHasSideEffect:
break;
}
if (FLAG_trace_side_effect_free_debug_evaluate) {
if (v8_flags.trace_side_effect_free_debug_evaluate) {
PrintF("[debug-evaluate] API Callback '");
info.name().ShortPrint();
PrintF("' may cause side effect.\n");
......@@ -2854,13 +2854,13 @@ bool Debug::PerformSideEffectCheckForCallback(
} else if (callback_info->IsInterceptorInfo()) {
InterceptorInfo info = InterceptorInfo::cast(*callback_info);
if (info.has_no_side_effect()) return true;
if (FLAG_trace_side_effect_free_debug_evaluate) {
if (v8_flags.trace_side_effect_free_debug_evaluate) {
PrintF("[debug-evaluate] API Interceptor may cause side effect.\n");
}
} else if (callback_info->IsCallHandlerInfo()) {
CallHandlerInfo info = CallHandlerInfo::cast(*callback_info);
if (info.IsSideEffectFreeCallHandlerInfo()) return true;
if (FLAG_trace_side_effect_free_debug_evaluate) {
if (v8_flags.trace_side_effect_free_debug_evaluate) {
PrintF("[debug-evaluate] API CallHandlerInfo may cause side effect.\n");
}
}
......@@ -2922,7 +2922,7 @@ bool Debug::PerformSideEffectCheckForObject(Handle<Object> object) {
return true;
}
if (FLAG_trace_side_effect_free_debug_evaluate) {
if (v8_flags.trace_side_effect_free_debug_evaluate) {
PrintF("[debug-evaluate] failed runtime side effect check.\n");
}
side_effect_check_failed_ = true;
......
......@@ -814,7 +814,7 @@ void LiveEdit::PatchScript(Isolate* isolate, Handle<Script> script,
function_data_map.Fill(isolate);
const bool allow_top_frame_live_editing =
allow_top_frame_live_editing_param && FLAG_live_edit_top_frame;
allow_top_frame_live_editing_param && v8_flags.live_edit_top_frame;
if (!CanPatchScript(changed, script, new_script, function_data_map,
allow_top_frame_live_editing, result)) {
return;
......
......@@ -15,9 +15,9 @@ namespace internal {
namespace wasm {
namespace gdb_server {
#define TRACE_GDB_REMOTE(...) \
do { \
if (FLAG_trace_wasm_gdb_remote) PrintF("[gdb-remote] " __VA_ARGS__); \
#define TRACE_GDB_REMOTE(...) \
do { \
if (v8_flags.trace_wasm_gdb_remote) PrintF("[gdb-remote] " __VA_ARGS__); \
} while (false)
// Convert from 0-255 to a pair of ASCII chars (0-9,a-f).
......
......@@ -62,7 +62,8 @@ void GdbServerThread::Run() {
#endif
// If the default port is not available, try any port.
SocketBinding socket_binding = SocketBinding::Bind(FLAG_wasm_gdb_remote_port);
SocketBinding socket_binding =
SocketBinding::Bind(v8_flags.wasm_gdb_remote_port);
if (!socket_binding.IsValid()) {
socket_binding = SocketBinding::Bind(0);
}
......
......@@ -119,7 +119,7 @@ auto GdbServer::RunSyncTask(Functor&& callback) const {
// static
std::unique_ptr<GdbServer> GdbServer::Create() {
DCHECK(FLAG_wasm_gdb_remote);
DCHECK(v8_flags.wasm_gdb_remote);
std::unique_ptr<GdbServer> gdb_server(new GdbServer());
......@@ -377,7 +377,7 @@ void GdbServer::AddWasmModule(uint32_t module_id,
std::make_pair(module_id, WasmModuleDebug(isolate, wasm_script)));
has_module_list_changed_ = true;
if (FLAG_wasm_pause_waiting_for_debugger && scripts_.size() == 1) {
if (v8_flags.wasm_pause_waiting_for_debugger && scripts_.size() == 1) {
TRACE_GDB_REMOTE("Paused, waiting for a debugger to attach...\n");
Suspend();
}
......
......@@ -803,7 +803,7 @@ TEST(BreakPointConstructorBuiltin) {
}
TEST(BreakPointInlinedBuiltin) {
i::FLAG_allow_natives_syntax = true;
i::v8_flags.allow_natives_syntax = true;
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
......@@ -847,7 +847,7 @@ TEST(BreakPointInlinedBuiltin) {
}
TEST(BreakPointInlineBoundBuiltin) {
i::FLAG_allow_natives_syntax = true;
i::v8_flags.allow_natives_syntax = true;
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
......@@ -895,7 +895,7 @@ TEST(BreakPointInlineBoundBuiltin) {
}
TEST(BreakPointInlinedConstructorBuiltin) {
i::FLAG_allow_natives_syntax = true;
i::v8_flags.allow_natives_syntax = true;
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
......@@ -939,7 +939,7 @@ TEST(BreakPointInlinedConstructorBuiltin) {
}
TEST(BreakPointBuiltinConcurrentOpt) {
i::FLAG_allow_natives_syntax = true;
i::v8_flags.allow_natives_syntax = true;
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
......@@ -980,7 +980,7 @@ TEST(BreakPointBuiltinConcurrentOpt) {
}
TEST(BreakPointBuiltinTFOperator) {
i::FLAG_allow_natives_syntax = true;
i::v8_flags.allow_natives_syntax = true;
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
......@@ -1401,7 +1401,7 @@ TEST(Regress1163547) {
}
TEST(BreakPointInlineApiFunction) {
i::FLAG_allow_natives_syntax = true;
i::v8_flags.allow_natives_syntax = true;
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
......@@ -1447,7 +1447,7 @@ TEST(BreakPointInlineApiFunction) {
// Test that a break point can be set at a return store location.
TEST(BreakPointConditionBuiltin) {
i::FLAG_allow_natives_syntax = true;
i::v8_flags.allow_natives_syntax = true;
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
......@@ -1576,7 +1576,7 @@ TEST(BreakPointConditionBuiltin) {
}
TEST(BreakPointInlining) {
i::FLAG_allow_natives_syntax = true;
i::v8_flags.allow_natives_syntax = true;
break_point_hit_count = 0;
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
......@@ -2922,9 +2922,9 @@ TEST(PauseInScript) {
int message_callback_count = 0;
TEST(DebugBreak) {
i::FLAG_stress_compaction = false;
i::v8_flags.stress_compaction = false;
#ifdef VERIFY_HEAP
i::FLAG_verify_heap = true;
i::v8_flags.verify_heap = true;
#endif
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
......@@ -3012,9 +3012,9 @@ class DebugScopingListener : public v8::debug::DebugDelegate {
};
TEST(DebugBreakInWrappedScript) {
i::FLAG_stress_compaction = false;
i::v8_flags.stress_compaction = false;
#ifdef VERIFY_HEAP
i::FLAG_verify_heap = true;
i::v8_flags.verify_heap = true;
#endif
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
......@@ -3067,9 +3067,9 @@ TEST(DebugScopeIteratorWithFunctionTemplate) {
}
TEST(DebugBreakWithoutJS) {
i::FLAG_stress_compaction = false;
i::v8_flags.stress_compaction = false;
#ifdef VERIFY_HEAP
i::FLAG_verify_heap = true;
i::v8_flags.verify_heap = true;
#endif
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
......@@ -3543,8 +3543,8 @@ class ExceptionEventCounter : public v8::debug::DebugDelegate {
};
UNINITIALIZED_TEST(NoBreakOnStackOverflow) {
// We must set FLAG_stack_size before initializing the isolate.
i::FLAG_stack_size = 100;
// We must set v8_flags.stack_size before initializing the isolate.
i::v8_flags.stack_size = 100;
v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
v8::Isolate* isolate = v8::Isolate::New(create_params);
......@@ -3840,7 +3840,7 @@ class DebugBreakInlineListener : public v8::debug::DebugDelegate {
};
TEST(DebugBreakInline) {
i::FLAG_allow_natives_syntax = true;
i::v8_flags.allow_natives_syntax = true;
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::Local<v8::Context> context = env.local();
......@@ -4289,7 +4289,7 @@ class DebugStepOverFunctionWithCaughtExceptionListener
};
TEST(DebugStepOverFunctionWithCaughtException) {
i::FLAG_allow_natives_syntax = true;
i::v8_flags.allow_natives_syntax = true;
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
......@@ -4317,7 +4317,7 @@ size_t NearHeapLimitCallback(void* data, size_t current_heap_limit,
}
UNINITIALIZED_TEST(DebugSetOutOfMemoryListener) {
i::FLAG_stress_concurrent_allocation = false;
i::v8_flags.stress_concurrent_allocation = false;
v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
create_params.constraints.set_max_old_generation_size_in_bytes(10 * i::MB);
......@@ -4340,7 +4340,7 @@ UNINITIALIZED_TEST(DebugSetOutOfMemoryListener) {
}
TEST(DebugCoverage) {
i::FLAG_always_turbofan = false;
i::v8_flags.always_turbofan = false;
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
......@@ -4395,7 +4395,7 @@ v8::debug::Coverage::ScriptData GetScriptDataAndDeleteCoverage(
} // namespace
TEST(DebugCoverageWithCoverageOutOfScope) {
i::FLAG_always_turbofan = false;
i::v8_flags.always_turbofan = false;
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
......@@ -4466,7 +4466,7 @@ v8::debug::Coverage::FunctionData GetFunctionDataAndDeleteCoverage(
} // namespace
TEST(DebugCoverageWithScriptDataOutOfScope) {
i::FLAG_always_turbofan = false;
i::v8_flags.always_turbofan = false;
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
......@@ -4619,7 +4619,7 @@ i::MaybeHandle<i::Script> FindScript(
} // anonymous namespace
UNINITIALIZED_TEST(LoadedAtStartupScripts) {
i::FLAG_expose_gc = true;
i::v8_flags.expose_gc = 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