[heap] Handle paged spaces in Heap::MakeHeapIterable
Complete implementation of Heap::MakeHeapIterable() by also making the LABs of paged spaces iterable. This method is the one to use when the heap and/or a particular space shall be iterable. Bug: v8:12338 Change-Id: Id859cf1a05df21a54939c504c59d7b1ccd659c9b Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3277888 Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Commit-Queue: Dominik Inführ <dinfuehr@chromium.org> Cr-Commit-Position: refs/heads/main@{#77891}
This commit is contained in:
parent
0e6eb3e219
commit
195f6e11a6
@ -3522,13 +3522,18 @@ void Heap::CreateFillerForArray(T object, int elements_to_trim,
|
|||||||
void Heap::MakeHeapIterable() {
|
void Heap::MakeHeapIterable() {
|
||||||
mark_compact_collector()->EnsureSweepingCompleted();
|
mark_compact_collector()->EnsureSweepingCompleted();
|
||||||
|
|
||||||
MakeLocalHeapLabsIterable();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Heap::MakeLocalHeapLabsIterable() {
|
|
||||||
safepoint()->IterateLocalHeaps([](LocalHeap* local_heap) {
|
safepoint()->IterateLocalHeaps([](LocalHeap* local_heap) {
|
||||||
local_heap->MakeLinearAllocationAreaIterable();
|
local_heap->MakeLinearAllocationAreaIterable();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
PagedSpaceIterator spaces(this);
|
||||||
|
for (PagedSpace* space = spaces.Next(); space != nullptr;
|
||||||
|
space = spaces.Next()) {
|
||||||
|
space->MakeLinearAllocationAreaIterable();
|
||||||
|
}
|
||||||
|
|
||||||
|
// New space is bump-pointer allocation only and therefore guaranteed to be
|
||||||
|
// iterable up to top().
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -4598,8 +4603,6 @@ void Heap::VerifyRememberedSetFor(HeapObject object) {
|
|||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void Heap::VerifyCountersAfterSweeping() {
|
void Heap::VerifyCountersAfterSweeping() {
|
||||||
MakeLocalHeapLabsIterable();
|
|
||||||
|
|
||||||
PagedSpaceIterator spaces(this);
|
PagedSpaceIterator spaces(this);
|
||||||
for (PagedSpace* space = spaces.Next(); space != nullptr;
|
for (PagedSpace* space = spaces.Next(); space != nullptr;
|
||||||
space = spaces.Next()) {
|
space = spaces.Next()) {
|
||||||
|
@ -1652,6 +1652,10 @@ class Heap {
|
|||||||
|
|
||||||
void UpdateEpochFull();
|
void UpdateEpochFull();
|
||||||
|
|
||||||
|
// Ensure that we have swept all spaces in such a way that we can iterate
|
||||||
|
// over all objects.
|
||||||
|
void MakeHeapIterable();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using ExternalStringTableUpdaterCallback = String (*)(Heap* heap,
|
using ExternalStringTableUpdaterCallback = String (*)(Heap* heap,
|
||||||
FullObjectSlot pointer);
|
FullObjectSlot pointer);
|
||||||
@ -1781,13 +1785,6 @@ class Heap {
|
|||||||
// with the allocation memento of the object at the top
|
// with the allocation memento of the object at the top
|
||||||
void EnsureFillerObjectAtTop();
|
void EnsureFillerObjectAtTop();
|
||||||
|
|
||||||
// Ensure that we have swept all spaces in such a way that we can iterate
|
|
||||||
// over all objects. May cause a GC.
|
|
||||||
void MakeHeapIterable();
|
|
||||||
|
|
||||||
// Ensure that LABs of local heaps are iterable.
|
|
||||||
void MakeLocalHeapLabsIterable();
|
|
||||||
|
|
||||||
// Performs garbage collection in a safepoint.
|
// Performs garbage collection in a safepoint.
|
||||||
// Returns the number of freed global handles.
|
// Returns the number of freed global handles.
|
||||||
size_t PerformGarbageCollection(
|
size_t PerformGarbageCollection(
|
||||||
|
@ -37,8 +37,8 @@ PagedSpaceObjectIterator::PagedSpaceObjectIterator(Heap* heap,
|
|||||||
cage_base_(heap->isolate())
|
cage_base_(heap->isolate())
|
||||||
#endif // V8_COMPRESS_POINTERS
|
#endif // V8_COMPRESS_POINTERS
|
||||||
{
|
{
|
||||||
space_->MakeLinearAllocationAreaIterable();
|
heap->MakeHeapIterable();
|
||||||
heap->mark_compact_collector()->EnsureSweepingCompleted();
|
USE(space_);
|
||||||
}
|
}
|
||||||
|
|
||||||
PagedSpaceObjectIterator::PagedSpaceObjectIterator(Heap* heap,
|
PagedSpaceObjectIterator::PagedSpaceObjectIterator(Heap* heap,
|
||||||
@ -54,8 +54,7 @@ PagedSpaceObjectIterator::PagedSpaceObjectIterator(Heap* heap,
|
|||||||
cage_base_(heap->isolate())
|
cage_base_(heap->isolate())
|
||||||
#endif // V8_COMPRESS_POINTERS
|
#endif // V8_COMPRESS_POINTERS
|
||||||
{
|
{
|
||||||
space_->MakeLinearAllocationAreaIterable();
|
heap->MakeHeapIterable();
|
||||||
heap->mark_compact_collector()->EnsureSweepingCompleted();
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
AllocationSpace owner = page->owner_identity();
|
AllocationSpace owner = page->owner_identity();
|
||||||
DCHECK(owner == OLD_SPACE || owner == MAP_SPACE || owner == CODE_SPACE);
|
DCHECK(owner == OLD_SPACE || owner == MAP_SPACE || owner == CODE_SPACE);
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "src/heap/heap-inl.h"
|
#include "src/heap/heap-inl.h"
|
||||||
#include "src/heap/paged-spaces-inl.h"
|
#include "src/heap/paged-spaces-inl.h"
|
||||||
#include "src/heap/read-only-heap.h"
|
#include "src/heap/read-only-heap.h"
|
||||||
|
#include "src/heap/safepoint.h"
|
||||||
#include "src/heap/spaces.h"
|
#include "src/heap/spaces.h"
|
||||||
#include "src/objects/objects-inl.h"
|
#include "src/objects/objects-inl.h"
|
||||||
|
|
||||||
@ -128,6 +129,7 @@ static int DumpHeapConstants(FILE* out, const char* argv0) {
|
|||||||
{
|
{
|
||||||
Isolate::Scope scope(isolate);
|
Isolate::Scope scope(isolate);
|
||||||
i::Heap* heap = reinterpret_cast<i::Isolate*>(isolate)->heap();
|
i::Heap* heap = reinterpret_cast<i::Isolate*>(isolate)->heap();
|
||||||
|
i::SafepointScope safepoint_scope(heap);
|
||||||
i::ReadOnlyHeap* read_only_heap =
|
i::ReadOnlyHeap* read_only_heap =
|
||||||
reinterpret_cast<i::Isolate*>(isolate)->read_only_heap();
|
reinterpret_cast<i::Isolate*>(isolate)->read_only_heap();
|
||||||
i::PrintF(out, "%s", kHeader);
|
i::PrintF(out, "%s", kHeader);
|
||||||
|
Loading…
Reference in New Issue
Block a user