Commit c6cec7c9 authored by Anton Bikineev's avatar Anton Bikineev Committed by V8 LUCI CQ

cppgc: young-gen: Avoid eager commits of the age-table

The CL fixes PMF regressions that happend after increasing
the AgeTable size.

Bug: chromium:1336529
Change-Id: If1f099b43bfcb3a8c7dd4a1c229fcb08735eb744
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3707098Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81180}
parent 46e95920
...@@ -61,7 +61,7 @@ class V8_EXPORT AgeTable final { ...@@ -61,7 +61,7 @@ class V8_EXPORT AgeTable final {
Age GetAgeForRange(uintptr_t cage_offset_begin, Age GetAgeForRange(uintptr_t cage_offset_begin,
uintptr_t cage_offset_end) const; uintptr_t cage_offset_end) const;
void Reset(PageAllocator* allocator); void ResetForTesting();
private: private:
V8_INLINE size_t card(uintptr_t offset) const { V8_INLINE size_t card(uintptr_t offset) const {
...@@ -98,10 +98,6 @@ struct CagedHeapLocalData final { ...@@ -98,10 +98,6 @@ struct CagedHeapLocalData final {
#if defined(CPPGC_YOUNG_GENERATION) #if defined(CPPGC_YOUNG_GENERATION)
AgeTable age_table; AgeTable age_table;
#endif #endif
private:
friend class CagedHeap;
explicit CagedHeapLocalData(PageAllocator&);
}; };
} // namespace internal } // namespace internal
......
...@@ -13,12 +13,6 @@ ...@@ -13,12 +13,6 @@
namespace cppgc { namespace cppgc {
namespace internal { namespace internal {
CagedHeapLocalData::CagedHeapLocalData(PageAllocator& allocator) {
#if defined(CPPGC_YOUNG_GENERATION)
age_table.Reset(&allocator);
#endif // defined(CPPGC_YOUNG_GENERATION)
}
#if defined(CPPGC_YOUNG_GENERATION) #if defined(CPPGC_YOUNG_GENERATION)
static_assert( static_assert(
...@@ -63,17 +57,8 @@ AgeTable::Age AgeTable::GetAgeForRange(uintptr_t offset_begin, ...@@ -63,17 +57,8 @@ AgeTable::Age AgeTable::GetAgeForRange(uintptr_t offset_begin,
return result; return result;
} }
void AgeTable::Reset(PageAllocator* allocator) { void AgeTable::ResetForTesting() {
// TODO(chromium:1029379): Consider MADV_DONTNEED instead of MADV_FREE on
// POSIX platforms.
std::fill(table_.begin(), table_.end(), Age::kOld); std::fill(table_.begin(), table_.end(), Age::kOld);
const uintptr_t begin = RoundUp(reinterpret_cast<uintptr_t>(table_.data()),
allocator->CommitPageSize());
const uintptr_t end =
RoundDown(reinterpret_cast<uintptr_t>(table_.data() + table_.size()),
allocator->CommitPageSize());
allocator->DiscardSystemPages(reinterpret_cast<void*>(begin), end - begin);
} }
#endif // defined(CPPGC_YOUNG_GENERATION) #endif // defined(CPPGC_YOUNG_GENERATION)
......
...@@ -118,8 +118,6 @@ CagedHeap::CagedHeap(PageAllocator& platform_allocator) ...@@ -118,8 +118,6 @@ CagedHeap::CagedHeap(PageAllocator& platform_allocator)
// Failing to commit the reservation means that we are out of memory. // Failing to commit the reservation means that we are out of memory.
CHECK(is_not_oom); CHECK(is_not_oom);
new (cage_start) CagedHeapLocalData(platform_allocator);
const CagedAddress caged_heap_start = RoundUp( const CagedAddress caged_heap_start = RoundUp(
reinterpret_cast<CagedAddress>(cage_start) + sizeof(CagedHeapLocalData), reinterpret_cast<CagedAddress>(cage_start) + sizeof(CagedHeapLocalData),
kPageSize); kPageSize);
......
...@@ -22,7 +22,7 @@ class AgeTableTest : public testing::TestWithHeap { ...@@ -22,7 +22,7 @@ class AgeTableTest : public testing::TestWithHeap {
age_table_(CagedHeapLocalData::Get().age_table) {} age_table_(CagedHeapLocalData::Get().age_table) {}
~AgeTableTest() override { ~AgeTableTest() override {
age_table_.Reset(GetPlatform().GetPageAllocator()); age_table_.ResetForTesting();
// Collect all allocated pages. // Collect all allocated pages.
for (auto* page : allocated_pages_) BasePage::Destroy(page); for (auto* page : allocated_pages_) BasePage::Destroy(page);
} }
......
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