[heap] Test aborting of evacuation with --stress-compaction
Do not require the --verify-heap flag to test aborting evacuation of a page but randomly abort evacuation in debug builds with --stress-compaction. This is intended to increase test coverage of this mechanism. Bug: v8:12251 Change-Id: I6cd08904ee195dbf2a1ef1e9c2c773c514c2cf7e Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3201999 Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Commit-Queue: Dominik Inführ <dinfuehr@chromium.org> Cr-Commit-Position: refs/heads/main@{#77230}
This commit is contained in:
parent
75dd3600b4
commit
3c4247924d
@ -1435,9 +1435,10 @@ class EvacuateVisitorBase : public HeapObjectVisitor {
|
||||
|
||||
inline bool TryEvacuateObject(AllocationSpace target_space, HeapObject object,
|
||||
int size, HeapObject* target_object) {
|
||||
#ifdef VERIFY_HEAP
|
||||
if (FLAG_verify_heap && AbortCompactionForTesting(object)) return false;
|
||||
#endif // VERIFY_HEAP
|
||||
#ifdef DEBUG
|
||||
if (FLAG_stress_compaction && AbortCompactionForTesting(object))
|
||||
return false;
|
||||
#endif // DEBUG
|
||||
AllocationAlignment alignment = HeapObject::RequiredAlignment(object.map());
|
||||
AllocationResult allocation = local_allocator_->Allocate(
|
||||
target_space, size, AllocationOrigin::kGC, alignment);
|
||||
@ -1464,7 +1465,7 @@ class EvacuateVisitorBase : public HeapObjectVisitor {
|
||||
migration_function_(this, dst, src, size, dest);
|
||||
}
|
||||
|
||||
#ifdef VERIFY_HEAP
|
||||
#ifdef DEBUG
|
||||
bool AbortCompactionForTesting(HeapObject object) {
|
||||
if (FLAG_stress_compaction) {
|
||||
const uintptr_t mask = static_cast<uintptr_t>(FLAG_random_seed) &
|
||||
@ -1481,7 +1482,7 @@ class EvacuateVisitorBase : public HeapObjectVisitor {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif // VERIFY_HEAP
|
||||
#endif // DEBUG
|
||||
|
||||
Heap* heap_;
|
||||
EvacuationAllocator* local_allocator_;
|
||||
|
Loading…
Reference in New Issue
Block a user