Commit a8ffcacb authored by Dominik Inführ's avatar Dominik Inführ Committed by Commit Bot

[heap] Enforce safepoint in unittest when iterating chunks

HeapWithPointerCompressionTest.HeapLayout sometimes raced with
background threads. When iterating chunks, background threads might add
chunks concurrently. Prevent this by enforcing safepoint during
iteration.

Bug: v8:10315
Change-Id: I2852ec3ea18905b669e60eadc660d9343ea35f48
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2390767
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69696}
parent 634c2a63
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "src/handles/handles-inl.h" #include "src/handles/handles-inl.h"
#include "src/heap/memory-chunk.h" #include "src/heap/memory-chunk.h"
#include "src/heap/safepoint.h"
#include "src/heap/spaces-inl.h" #include "src/heap/spaces-inl.h"
#include "src/objects/objects-inl.h" #include "src/objects/objects-inl.h"
#include "test/unittests/test-utils.h" #include "test/unittests/test-utils.h"
...@@ -151,6 +152,7 @@ TEST_F(HeapWithPointerCompressionTest, HeapLayout) { ...@@ -151,6 +152,7 @@ TEST_F(HeapWithPointerCompressionTest, HeapLayout) {
// Check that all memory chunks belong this region. // Check that all memory chunks belong this region.
base::AddressRegion heap_reservation(isolate_root, size_t{4} * GB); base::AddressRegion heap_reservation(isolate_root, size_t{4} * GB);
SafepointScope scope(i_isolate()->heap());
OldGenerationMemoryChunkIterator iter(i_isolate()->heap()); OldGenerationMemoryChunkIterator iter(i_isolate()->heap());
for (;;) { for (;;) {
MemoryChunk* chunk = iter.next(); MemoryChunk* chunk = iter.next();
......
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