[d8] Make --dump-counters a d8-only flag
--dump-counters and --dump-counters-nvp are only functional in d8, thus they should be d8-only flags. R=mlippautz@chromium.org Bug: v8:12464 Change-Id: Ie3295990a1b4691ab95f8403ff6d9932543b03cd Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3312275 Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Commit-Queue: Clemens Backes <clemensb@chromium.org> Cr-Commit-Position: refs/heads/main@{#78247}
This commit is contained in:
parent
9c53e7a9c8
commit
3986012f4c
18
src/d8/d8.cc
18
src/d8/d8.cc
@ -3360,22 +3360,18 @@ void Shell::OnExit(v8::Isolate* isolate, bool dispose) {
|
||||
i::Isolate::Delete(reinterpret_cast<i::Isolate*>(shared_isolate));
|
||||
}
|
||||
|
||||
// {V8::Dispose} resets flags, thus get the flag values before disposing.
|
||||
bool dump_counters = i::FLAG_dump_counters;
|
||||
bool dump_counters_nvp = i::FLAG_dump_counters_nvp;
|
||||
|
||||
if (dispose) {
|
||||
V8::Dispose();
|
||||
V8::DisposePlatform();
|
||||
}
|
||||
|
||||
if (dump_counters || dump_counters_nvp) {
|
||||
if (options.dump_counters || options.dump_counters_nvp) {
|
||||
base::SharedMutexGuard<base::kShared> mutex_guard(&counter_mutex_);
|
||||
std::vector<std::pair<std::string, Counter*>> counters(
|
||||
counter_map_->begin(), counter_map_->end());
|
||||
std::sort(counters.begin(), counters.end());
|
||||
|
||||
if (dump_counters_nvp) {
|
||||
if (options.dump_counters_nvp) {
|
||||
// Dump counters as name-value pairs.
|
||||
for (const auto& pair : counters) {
|
||||
std::string key = pair.first;
|
||||
@ -4358,6 +4354,14 @@ bool Shell::SetOptions(int argc, char* argv[]) {
|
||||
} else if (strcmp(argv[i], "--no-fail") == 0) {
|
||||
options.no_fail = true;
|
||||
argv[i] = nullptr;
|
||||
} else if (strcmp(argv[i], "--dump-counters") == 0) {
|
||||
i::FLAG_slow_histograms = true;
|
||||
options.dump_counters = true;
|
||||
argv[i] = nullptr;
|
||||
} else if (strcmp(argv[i], "--dump-counters-nvp") == 0) {
|
||||
i::FLAG_slow_histograms = true;
|
||||
options.dump_counters_nvp = true;
|
||||
argv[i] = nullptr;
|
||||
} else if (strncmp(argv[i], "--icu-data-file=", 16) == 0) {
|
||||
options.icu_data_file = argv[i] + 16;
|
||||
argv[i] = nullptr;
|
||||
@ -5208,7 +5212,7 @@ int Shell::Main(int argc, char* argv[]) {
|
||||
base::SysInfo::AmountOfVirtualMemory());
|
||||
|
||||
Shell::counter_map_ = new CounterMap();
|
||||
if (i::FLAG_dump_counters || i::FLAG_dump_counters_nvp ||
|
||||
if (options.dump_counters || options.dump_counters_nvp ||
|
||||
i::TracingFlags::is_gc_stats_enabled()) {
|
||||
create_params.counter_lookup_callback = LookupCounter;
|
||||
create_params.create_histogram_callback = CreateHistogram;
|
||||
|
@ -393,6 +393,8 @@ class ShellOptions {
|
||||
bool test_shell = false;
|
||||
DisallowReassignment<bool> expected_to_throw = {"throws", false};
|
||||
DisallowReassignment<bool> no_fail = {"no-fail", false};
|
||||
DisallowReassignment<bool> dump_counters = {"dump-counters", false};
|
||||
DisallowReassignment<bool> dump_counters_nvp = {"dump-counters-nvp", false};
|
||||
DisallowReassignment<bool> ignore_unhandled_promises = {
|
||||
"ignore-unhandled-promises", false};
|
||||
DisallowReassignment<bool> mock_arraybuffer_allocator = {
|
||||
|
@ -1879,13 +1879,10 @@ DEFINE_BOOL_READONLY(minor_mc, false,
|
||||
DEFINE_BOOL(help, false, "Print usage message, including flags, on console")
|
||||
DEFINE_BOOL(print_flag_values, false, "Print all flag values of V8")
|
||||
|
||||
DEFINE_BOOL(dump_counters, false, "Dump counters on exit")
|
||||
// Slow histograms are also enabled via --dump-counters in d8.
|
||||
DEFINE_BOOL(slow_histograms, false,
|
||||
"Enable slow histograms with more overhead.")
|
||||
DEFINE_IMPLICATION(dump_counters, slow_histograms)
|
||||
|
||||
DEFINE_BOOL(dump_counters_nvp, false,
|
||||
"Dump counters as name-value pairs on exit")
|
||||
DEFINE_BOOL(use_external_strings, false, "Use external strings for source code")
|
||||
DEFINE_STRING(map_counters, "", "Map counters to a file")
|
||||
DEFINE_BOOL(mock_arraybuffer_allocator, false,
|
||||
|
Loading…
Reference in New Issue
Block a user