Commit 243eaf8b authored by Michal Majewski's avatar Michal Majewski Committed by Commit Bot

[test] Change stress compaction flag to boolean value.

Bug: v8:6972
Change-Id: I116d48f22045cf42cf2123297458640b551d37da
Reviewed-on: https://chromium-review.googlesource.com/768868Reviewed-by: 's avatarHannes Payer <hpayer@chromium.org>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Michał Majewski <majeski@google.com>
Cr-Commit-Position: refs/heads/master@{#49408}
parent 68668834
......@@ -675,9 +675,9 @@ DEFINE_BOOL(force_marking_deque_overflows, false,
DEFINE_BOOL(stress_compaction, false,
"stress the GC compactor to flush out bugs (implies "
"--force_marking_deque_overflows)")
DEFINE_INT(stress_compaction_percentage, 0,
"Stress GC compaction by selecting X percent of pages as evacuation "
"candidates. It overrides stress_compaction.")
DEFINE_BOOL(stress_compaction_random, false,
"Stress GC compaction by selecting random percent of pages as "
"evacuation candidates. It overrides stress_compaction.")
DEFINE_BOOL(stress_incremental_marking, false,
"force incremental marking for small heaps and run it more often")
DEFINE_INT(stress_marking, 0,
......
......@@ -911,18 +911,15 @@ void MarkCompactCollector::CollectEvacuationCandidates(PagedSpace* space) {
AddEvacuationCandidate(p);
}
}
} else if (FLAG_stress_compaction_percentage > 0) {
size_t percent =
isolate()->fuzzer_rng()->NextInt(FLAG_stress_compaction_percentage + 1);
size_t pages_to_mark_count = percent * pages.size() / 100;
if (pages_to_mark_count) {
for (uint64_t i : isolate()->fuzzer_rng()->NextSample(
pages.size(), pages_to_mark_count)) {
candidate_count++;
total_live_bytes += pages[i].first;
AddEvacuationCandidate(pages[i].second);
}
} else if (FLAG_stress_compaction_random) {
double fraction = isolate()->fuzzer_rng()->NextDouble();
size_t pages_to_mark_count =
static_cast<size_t>(fraction * (pages.size() + 1));
for (uint64_t i : isolate()->fuzzer_rng()->NextSample(
pages.size(), pages_to_mark_count)) {
candidate_count++;
total_live_bytes += pages[i].first;
AddEvacuationCandidate(pages[i].second);
}
} else if (FLAG_stress_compaction) {
for (size_t i = 0; i < pages.size(); i++) {
......
......@@ -244,9 +244,7 @@ class GCFuzzer(base_runner.BaseTestRunner):
'--fuzzer_random_seed', str(fuzzer_seed),
]
if options.stress_compaction:
fuzzing_flags += [
'--stress_compaction_percentage', '100',
]
fuzzing_flags.append('--stress_compaction_random')
s.tests.append(t.CopyAddingFlags(t.variant, fuzzing_flags))
num_tests += len(s.tests)
......
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