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, ...@@ -675,9 +675,9 @@ DEFINE_BOOL(force_marking_deque_overflows, false,
DEFINE_BOOL(stress_compaction, false, DEFINE_BOOL(stress_compaction, false,
"stress the GC compactor to flush out bugs (implies " "stress the GC compactor to flush out bugs (implies "
"--force_marking_deque_overflows)") "--force_marking_deque_overflows)")
DEFINE_INT(stress_compaction_percentage, 0, DEFINE_BOOL(stress_compaction_random, false,
"Stress GC compaction by selecting X percent of pages as evacuation " "Stress GC compaction by selecting random percent of pages as "
"candidates. It overrides stress_compaction.") "evacuation candidates. It overrides stress_compaction.")
DEFINE_BOOL(stress_incremental_marking, false, DEFINE_BOOL(stress_incremental_marking, false,
"force incremental marking for small heaps and run it more often") "force incremental marking for small heaps and run it more often")
DEFINE_INT(stress_marking, 0, DEFINE_INT(stress_marking, 0,
......
...@@ -911,19 +911,16 @@ void MarkCompactCollector::CollectEvacuationCandidates(PagedSpace* space) { ...@@ -911,19 +911,16 @@ void MarkCompactCollector::CollectEvacuationCandidates(PagedSpace* space) {
AddEvacuationCandidate(p); AddEvacuationCandidate(p);
} }
} }
} else if (FLAG_stress_compaction_percentage > 0) { } else if (FLAG_stress_compaction_random) {
size_t percent = double fraction = isolate()->fuzzer_rng()->NextDouble();
isolate()->fuzzer_rng()->NextInt(FLAG_stress_compaction_percentage + 1); size_t pages_to_mark_count =
static_cast<size_t>(fraction * (pages.size() + 1));
size_t pages_to_mark_count = percent * pages.size() / 100;
if (pages_to_mark_count) {
for (uint64_t i : isolate()->fuzzer_rng()->NextSample( for (uint64_t i : isolate()->fuzzer_rng()->NextSample(
pages.size(), pages_to_mark_count)) { pages.size(), pages_to_mark_count)) {
candidate_count++; candidate_count++;
total_live_bytes += pages[i].first; total_live_bytes += pages[i].first;
AddEvacuationCandidate(pages[i].second); AddEvacuationCandidate(pages[i].second);
} }
}
} else if (FLAG_stress_compaction) { } else if (FLAG_stress_compaction) {
for (size_t i = 0; i < pages.size(); i++) { for (size_t i = 0; i < pages.size(); i++) {
Page* p = pages[i].second; Page* p = pages[i].second;
......
...@@ -244,9 +244,7 @@ class GCFuzzer(base_runner.BaseTestRunner): ...@@ -244,9 +244,7 @@ class GCFuzzer(base_runner.BaseTestRunner):
'--fuzzer_random_seed', str(fuzzer_seed), '--fuzzer_random_seed', str(fuzzer_seed),
] ]
if options.stress_compaction: if options.stress_compaction:
fuzzing_flags += [ fuzzing_flags.append('--stress_compaction_random')
'--stress_compaction_percentage', '100',
]
s.tests.append(t.CopyAddingFlags(t.variant, fuzzing_flags)) s.tests.append(t.CopyAddingFlags(t.variant, fuzzing_flags))
num_tests += len(s.tests) 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