[test] Make cctest/test-spaces/OldLargeObjectSpace more robust
The test has a loop that allocates large objects until it gets an allocation failure. The test then asserts that the subsequent allocation should also fail. That however does not necessarily hold because the previously allocated objects may be collected to free up the space. This change creates a handle for each allocated object. It also restricts the size of the heap to 20MB to reduce memory consumption. Bug: v8:11172 Change-Id: Ic3dc1a0f5f235b0313bab2071546b59a77bd55e5 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2912884 Auto-Submit: Ulan Degenbaev <ulan@chromium.org> Reviewed-by: Dominik Inführ <dinfuehr@chromium.org> Commit-Queue: Dominik Inführ <dinfuehr@chromium.org> Cr-Commit-Position: refs/heads/master@{#74728}
This commit is contained in:
parent
fc29fa8f2f
commit
4d7e6f4ce7
@ -310,6 +310,7 @@ TEST(OldLargeObjectSpace) {
|
||||
// This test does not initialize allocated objects, which confuses the
|
||||
// incremental marker.
|
||||
FLAG_incremental_marking = false;
|
||||
FLAG_max_heap_size = 20;
|
||||
v8::V8::Initialize();
|
||||
|
||||
OldLargeObjectSpace* lo = CcTest::heap()->lo_space();
|
||||
@ -335,16 +336,18 @@ TEST(OldLargeObjectSpace) {
|
||||
ho.address(),
|
||||
HeapObject::RequiredAlignment(
|
||||
ReadOnlyRoots(CcTest::i_isolate()).fixed_double_array_map())));
|
||||
|
||||
Isolate* isolate = CcTest::i_isolate();
|
||||
HandleScope handle_scope(isolate);
|
||||
while (true) {
|
||||
{
|
||||
AllocationResult allocation = lo->AllocateRaw(lo_size);
|
||||
if (allocation.IsRetry()) break;
|
||||
HeapObject ho = HeapObject::cast(allocation.ToObjectChecked());
|
||||
Handle<HeapObject> keep_alive(ho, isolate);
|
||||
}
|
||||
}
|
||||
|
||||
CHECK(!lo->IsEmpty());
|
||||
|
||||
CHECK(lo->AllocateRaw(lo_size).IsRetry());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user