[flags] introduce --allow-overwriting-for-next-flag

Bug: v8:10942
Change-Id: Icbb1d8e054ee924a77f1fbeb9e48cde604ef69b1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2422001
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70130}
This commit is contained in:
Tobias Tebbi 2020-09-21 18:10:55 +02:00 committed by Commit Bot
parent c45c9bc295
commit e9bcaa91ea
5 changed files with 32 additions and 24 deletions

View File

@ -227,6 +227,12 @@ DEFINE_BOOL(abort_on_contradictory_flags, false,
// This implication is also hard-coded into the flags processing to make sure it
// becomes active before we even process subsequent flags.
DEFINE_NEG_IMPLICATION(fuzzing, abort_on_contradictory_flags)
// This is not really a flag, it affects the interpretation of the next flag but
// doesn't become permanently true when specified. This only works for flags
// defined in this file, but not for d8 flags defined in src/d8/d8.cc.
DEFINE_BOOL(allow_overwriting_for_next_flag, false,
"temporary disable flag contradiction to allow overwriting just "
"the next flag")
// Flags for language modes and experimental language features.
DEFINE_BOOL(use_strict, false, "enforce strict mode")

View File

@ -213,6 +213,13 @@ struct Flag {
}
static bool ShouldCheckFlagContradictions() {
if (FLAG_allow_overwriting_for_next_flag) {
// Setting the flag manually to false before calling Reset() avoids this
// becoming re-entrant.
FLAG_allow_overwriting_for_next_flag = false;
FindFlagByPointer(&FLAG_allow_overwriting_for_next_flag)->Reset();
return false;
}
return FLAG_abort_on_contradictory_flags && !FLAG_fuzzing;
}
@ -268,9 +275,17 @@ struct Flag {
name(), implied_by, hint);
} else if (new_set_by == SetBy::kCommandLine &&
check_command_line_flags) {
FATAL(
"Command-line provided flag --%s specified multiple times.\n%s",
name(), hint);
if (is_bool_flag) {
FATAL(
"Command-line provided flag --%s specified as both true and "
"false.\n%s",
name(), hint);
} else {
FATAL(
"Command-line provided flag --%s specified multiple "
"times.\n%s",
name(), hint);
}
}
break;
}

View File

@ -2,14 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// The flags are processed left to right. --no-abort-on-contradictory-flags
// disables the checking for conflicts, then we process --noverify-heap and
// Overwrite the value for --noverify-heap and
// --noenable-slow-asserts, which the test runner already set to true before.
// This causes the flags to be overwritten while silencing the error. Then we
// re-enable --abort-on-contradictory-flags to make sure that the processing of
// other flags and flag implications, which happens later, still produces
// errors.
// Flags: --no-abort-on-contradictory-flags --noverify-heap --noenable-slow-asserts --abort-on-contradictory-flags
// Due to flag contradiction checking, this requires
// --allow-overwriting-for-next-flag to avoid an error.
// Flags: --allow-overwriting-for-next-flag --noverify-heap
// Flags: --allow-overwriting-for-next-flag --noenable-slow-asserts
// Flags: --allow-natives-syntax --opt --no-always-opt
// --noverify-heap and --noenable-slow-asserts are set because the test is too

View File

@ -865,13 +865,6 @@
'harmony/atomics-waitasync-worker-shutdown-before-wait-finished-no-timeout': [SKIP],
}], # 'isolates'
##############################################################################
['deopt_fuzzer or gc_fuzzer', {
# https://crbug.com/v8/10942
'ensure-growing-store-learns': [SKIP],
'random-bit-correlations': [SKIP],
}], # 'deopt_fuzzer or gc_fuzzer'
##############################################################################
['deopt_fuzzer', {

View File

@ -3,13 +3,9 @@
// found in the LICENSE file.
// Overwrite the random seed provided by the test runner to make this test less
// flaky.
// The flags are processed left to right. --no-abort-on-contradictory-flags
// disables the checking for conflicts, then we process --random-seed=20 to
// overwrite the value the test runner already set before. Then we re-enable
// --abort-on-contradictory-flags to make sure that the processing of other
// flags and flag implications, which happens later, still produces errors.
// Flags: --no-abort-on-contradictory-flags --random-seed=20 --abort-on-contradictory-flags
// flaky. Due to flag contradiction checking, this requires
// --allow-overwriting-for-next-flag to avoid an error.
// Flags: --allow-overwriting-for-next-flag --random-seed=20
// Flags: --nostress-opt --noalways-opt --predictable
(function() {