heap: Remove NewSpace::TearDown

TearDown was actually redundant and can be replaced with the dtor.

Bug: v8:12612
Change-Id: Idc4a77c3f20372a53b0003cda6fb00ae7ec0035c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3571806
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79819}
This commit is contained in:
Omer Katz 2022-04-06 12:28:21 +02:00 committed by V8 LUCI CQ
parent c7d5491d64
commit 38facbaae8
3 changed files with 15 additions and 14 deletions

View File

@ -476,7 +476,9 @@ NewSpace::NewSpace(Heap* heap, v8::PageAllocator* page_allocator,
ResetLinearAllocationArea();
}
void NewSpace::TearDown() {
NewSpace::~NewSpace() {
// Tears down the space. Heap memory was not allocated by the space, so it
// is not deallocated here.
allocation_info_->Reset(kNullAddress, kNullAddress);
to_space_.TearDown();

View File

@ -249,16 +249,12 @@ class V8_EXPORT_PRIVATE NewSpace
size_t initial_semispace_capacity, size_t max_semispace_capacity,
LinearAllocationArea* allocation_info);
~NewSpace() override { TearDown(); }
~NewSpace() override;
inline bool ContainsSlow(Address a) const;
inline bool Contains(Object o) const;
inline bool Contains(HeapObject o) const;
// Tears down the space. Heap memory was not allocated by the space, so it
// is not deallocated here.
void TearDown();
void ResetParkedAllocationBuffers();
// Flip the pair of spaces.

View File

@ -27,6 +27,8 @@
#include <stdlib.h>
#include <memory>
#include "include/v8-initialization.h"
#include "include/v8-platform.h"
#include "src/base/bounded-page-allocator.h"
@ -275,18 +277,19 @@ TEST(NewSpace) {
MemoryAllocator* memory_allocator = test_allocator_scope.allocator();
LinearAllocationArea allocation_info;
NewSpace new_space(heap, memory_allocator->data_page_allocator(),
CcTest::heap()->InitialSemiSpaceSize(),
CcTest::heap()->InitialSemiSpaceSize(), &allocation_info);
CHECK(new_space.MaximumCapacity());
std::unique_ptr<NewSpace> new_space = std::make_unique<NewSpace>(
heap, memory_allocator->data_page_allocator(),
CcTest::heap()->InitialSemiSpaceSize(),
CcTest::heap()->InitialSemiSpaceSize(), &allocation_info);
CHECK(new_space->MaximumCapacity());
while (new_space.Available() >= kMaxRegularHeapObjectSize) {
CHECK(new_space.Contains(
new_space.AllocateRaw(kMaxRegularHeapObjectSize, kTaggedAligned)
while (new_space->Available() >= kMaxRegularHeapObjectSize) {
CHECK(new_space->Contains(
new_space->AllocateRaw(kMaxRegularHeapObjectSize, kTaggedAligned)
.ToObjectChecked()));
}
new_space.TearDown();
new_space.reset();
memory_allocator->unmapper()->EnsureUnmappingCompleted();
}