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

[cleanup] Remove redundant FLAG_SCOPE macros

FLAG_SCOPE_EXTERNAL can be used outside of the v8::internal namespace,
while FLAG_SCOPE can not.
This CL refactors FLAG_SCOPE such that it can be used anywhere, and
removes the redudant FLAG_SCOPE_EXTERNAL macro.
Also, UNFLAG_SCOPE_EXTERNAL is removed in favor of FLAG_SCOPE_VAL, as
the word "flag" in the macro name is meant to refer to a flag, and not
to the verb or action of "flagging" something, hence "unflag" does not
match the terminology.

R=ahaas@chromium.org

Bug: v8:11879
Change-Id: I2d761012c3e4330abb611bf67130eb57ec5bb964
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2988920
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75482}
parent ea5eac42
......@@ -26307,7 +26307,7 @@ HostImportModuleDynamicallyWithAssertionsCallbackResolve(
}
TEST(DynamicImportWithAssertions) {
FLAG_SCOPE_EXTERNAL(harmony_import_assertions);
FLAG_SCOPE(harmony_import_assertions);
LocalContext context;
v8::Isolate* isolate = context->GetIsolate();
......@@ -4145,13 +4145,13 @@ TEST(FastApiCPUProfiler) {
if (i::FLAG_jitless) return;
if (i::FLAG_turboprop) return;
FLAG_SCOPE_EXTERNAL(opt);
FLAG_SCOPE_EXTERNAL(turbo_fast_api_calls);
FLAG_SCOPE_EXTERNAL(allow_natives_syntax);
FLAG_SCOPE(opt);
FLAG_SCOPE(turbo_fast_api_calls);
FLAG_SCOPE(allow_natives_syntax);
// Disable --always_opt, otherwise we haven't generated the necessary
// feedback to go down the "best optimization" path for the fast call.
UNFLAG_SCOPE_EXTERNAL(always_opt);
UNFLAG_SCOPE_EXTERNAL(prof_browser_mode);
FLAG_VALUE_SCOPE(always_opt, false);
FLAG_VALUE_SCOPE(prof_browser_mode, false);
CcTest::InitializeVM();
LocalContext env;
......
......@@ -21,18 +21,12 @@ class V8_NODISCARD FlagScope {
T previous_value_;
};
#define FLAG_SCOPE(flag) \
FlagScope<bool> __scope_##flag##__LINE__(&FLAG_##flag, true)
} // namespace internal
} // namespace v8
#define FLAG_SCOPE_EXTERNAL(flag) \
v8::internal::FlagScope<bool> __scope_##flag##__LINE__( \
&v8::internal::FLAG_##flag, true)
#define UNFLAG_SCOPE_EXTERNAL(flag) \
#define FLAG_VALUE_SCOPE(flag, value) \
v8::internal::FlagScope<bool> __scope_##flag##__LINE__( \
&v8::internal::FLAG_##flag, false)
&v8::internal::FLAG_##flag, value)
#define FLAG_SCOPE(flag) FLAG_VALUE_SCOPE(flag, true)
#endif // V8_TEST_COMMON_FLAG_UTILS_H
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