Commit 38facbaa authored by Omer Katz's avatar Omer Katz Committed by V8 LUCI CQ

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/+/3571806Reviewed-by: 's avatarDominik Inführ <dinfuehr@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79819}
parent c7d5491d
...@@ -476,7 +476,9 @@ NewSpace::NewSpace(Heap* heap, v8::PageAllocator* page_allocator, ...@@ -476,7 +476,9 @@ NewSpace::NewSpace(Heap* heap, v8::PageAllocator* page_allocator,
ResetLinearAllocationArea(); 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); allocation_info_->Reset(kNullAddress, kNullAddress);
to_space_.TearDown(); to_space_.TearDown();
......
...@@ -249,16 +249,12 @@ class V8_EXPORT_PRIVATE NewSpace ...@@ -249,16 +249,12 @@ class V8_EXPORT_PRIVATE NewSpace
size_t initial_semispace_capacity, size_t max_semispace_capacity, size_t initial_semispace_capacity, size_t max_semispace_capacity,
LinearAllocationArea* allocation_info); LinearAllocationArea* allocation_info);
~NewSpace() override { TearDown(); } ~NewSpace() override;
inline bool ContainsSlow(Address a) const; inline bool ContainsSlow(Address a) const;
inline bool Contains(Object o) const; inline bool Contains(Object o) const;
inline bool Contains(HeapObject 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(); void ResetParkedAllocationBuffers();
// Flip the pair of spaces. // Flip the pair of spaces.
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <memory>
#include "include/v8-initialization.h" #include "include/v8-initialization.h"
#include "include/v8-platform.h" #include "include/v8-platform.h"
#include "src/base/bounded-page-allocator.h" #include "src/base/bounded-page-allocator.h"
...@@ -275,18 +277,19 @@ TEST(NewSpace) { ...@@ -275,18 +277,19 @@ TEST(NewSpace) {
MemoryAllocator* memory_allocator = test_allocator_scope.allocator(); MemoryAllocator* memory_allocator = test_allocator_scope.allocator();
LinearAllocationArea allocation_info; LinearAllocationArea allocation_info;
NewSpace new_space(heap, memory_allocator->data_page_allocator(), std::unique_ptr<NewSpace> new_space = std::make_unique<NewSpace>(
CcTest::heap()->InitialSemiSpaceSize(), heap, memory_allocator->data_page_allocator(),
CcTest::heap()->InitialSemiSpaceSize(), &allocation_info); CcTest::heap()->InitialSemiSpaceSize(),
CHECK(new_space.MaximumCapacity()); CcTest::heap()->InitialSemiSpaceSize(), &allocation_info);
CHECK(new_space->MaximumCapacity());
while (new_space.Available() >= kMaxRegularHeapObjectSize) { while (new_space->Available() >= kMaxRegularHeapObjectSize) {
CHECK(new_space.Contains( CHECK(new_space->Contains(
new_space.AllocateRaw(kMaxRegularHeapObjectSize, kTaggedAligned) new_space->AllocateRaw(kMaxRegularHeapObjectSize, kTaggedAligned)
.ToObjectChecked())); .ToObjectChecked()));
} }
new_space.TearDown(); new_space.reset();
memory_allocator->unmapper()->EnsureUnmappingCompleted(); memory_allocator->unmapper()->EnsureUnmappingCompleted();
} }
......
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