Commit 91497ff8 authored by Michal Majewski's avatar Michal Majewski Committed by Commit Bot

[test] Enable random marking start points.

Stress marking by starting it in random points between 0 and
--stress_marking percent of the standard limit.

Bug: v8:6972

Change-Id: I84572ba937f34cf4fd7b5eb2d532f48ff122a060
Reviewed-on: https://chromium-review.googlesource.com/763453
Commit-Queue: Michał Majewski <majeski@google.com>
Reviewed-by: 's avatarHannes Payer <hpayer@chromium.org>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49332}
parent 306bb1ff
...@@ -679,8 +679,9 @@ DEFINE_INT(stress_compaction_percentage, 0, ...@@ -679,8 +679,9 @@ DEFINE_INT(stress_compaction_percentage, 0,
"candidates. It overrides stress_compaction.") "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_incremental_marking_percentage, 0, DEFINE_INT(stress_marking, 0,
"force incremental marking after X percent of the standard limit") "force marking at random points between 0 and X (inclusive) percent "
"of the regular marking start limit")
DEFINE_BOOL(manual_evacuation_candidates_selection, false, DEFINE_BOOL(manual_evacuation_candidates_selection, false,
"Test mode only flag. It allows an unit test to select evacuation " "Test mode only flag. It allows an unit test to select evacuation "
"candidates pages (requires --stress_compaction).") "candidates pages (requires --stress_compaction).")
......
...@@ -5346,7 +5346,7 @@ Heap::IncrementalMarkingLimit Heap::IncrementalMarkingLimitReached() { ...@@ -5346,7 +5346,7 @@ Heap::IncrementalMarkingLimit Heap::IncrementalMarkingLimitReached() {
return IncrementalMarkingLimit::kHardLimit; return IncrementalMarkingLimit::kHardLimit;
} }
if (FLAG_stress_incremental_marking_percentage > 0) { if (FLAG_stress_marking > 0) {
double gained_since_last_gc = double gained_since_last_gc =
PromotedSinceLastGC() + PromotedSinceLastGC() +
(external_memory_ - external_memory_at_last_mark_compact_); (external_memory_ - external_memory_at_last_mark_compact_);
...@@ -5361,8 +5361,8 @@ Heap::IncrementalMarkingLimit Heap::IncrementalMarkingLimitReached() { ...@@ -5361,8 +5361,8 @@ Heap::IncrementalMarkingLimit Heap::IncrementalMarkingLimitReached() {
current_percent); current_percent);
} }
if (static_cast<int>(current_percent) >= if (static_cast<int>(current_percent) >= stress_marking_percentage_) {
FLAG_stress_incremental_marking_percentage) { stress_marking_percentage_ = NextStressMarkingLimit();
return IncrementalMarkingLimit::kHardLimit; return IncrementalMarkingLimit::kHardLimit;
} }
} }
...@@ -5514,6 +5514,10 @@ bool Heap::SetUp() { ...@@ -5514,6 +5514,10 @@ bool Heap::SetUp() {
SetGetExternallyAllocatedMemoryInBytesCallback( SetGetExternallyAllocatedMemoryInBytesCallback(
DefaultGetExternallyAllocatedMemoryInBytesCallback); DefaultGetExternallyAllocatedMemoryInBytesCallback);
if (FLAG_stress_marking > 0) {
stress_marking_percentage_ = NextStressMarkingLimit();
}
return true; return true;
} }
...@@ -5550,6 +5554,9 @@ void Heap::PrintAllocationsHash() { ...@@ -5550,6 +5554,9 @@ void Heap::PrintAllocationsHash() {
PrintF("\n### Allocations = %u, hash = 0x%08x\n", allocations_count(), hash); PrintF("\n### Allocations = %u, hash = 0x%08x\n", allocations_count(), hash);
} }
int Heap::NextStressMarkingLimit() {
return isolate()->fuzzer_rng()->NextInt(FLAG_stress_marking + 1);
}
void Heap::NotifyDeserializationComplete() { void Heap::NotifyDeserializationComplete() {
PagedSpaces spaces(this); PagedSpaces spaces(this);
......
...@@ -1802,6 +1802,8 @@ class Heap { ...@@ -1802,6 +1802,8 @@ class Heap {
inline void UpdateAllocationsHash(uint32_t value); inline void UpdateAllocationsHash(uint32_t value);
void PrintAllocationsHash(); void PrintAllocationsHash();
int NextStressMarkingLimit();
void AddToRingBuffer(const char* string); void AddToRingBuffer(const char* string);
void GetFromRingBuffer(char* buffer); void GetFromRingBuffer(char* buffer);
...@@ -2293,6 +2295,10 @@ class Heap { ...@@ -2293,6 +2295,10 @@ class Heap {
// Running hash over allocations performed. // Running hash over allocations performed.
uint32_t raw_allocations_hash_; uint32_t raw_allocations_hash_;
// Starts marking when stress_marking_percentage_% of the marking start limit
// is reached.
int stress_marking_percentage_;
// How many mark-sweep collections happened. // How many mark-sweep collections happened.
unsigned int ms_count_; unsigned int ms_count_;
......
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