mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 13:19:05 +00:00
LibJS: Expose minimum possible cell size of JS::Heap
Use this to avoid creating a 16 byte cell allocator on x86_64, where the size of FreelistEntry is 24 bytes. Every JS::Cell must be at least the size of the FreelistEntry or things start crashing, so the 16 byte allocator was wasted on that platform.
This commit is contained in:
parent
07c62f9f42
commit
81a5dcde84
Notes:
sideshowbarker
2024-07-18 17:12:57 +09:00
Author: https://github.com/ADKaster
Commit: 81a5dcde84
Pull-request: https://github.com/SerenityOS/serenity/pull/7557
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/linusg
2 changed files with 7 additions and 1 deletions
|
@ -23,7 +23,10 @@ namespace JS {
|
|||
Heap::Heap(VM& vm)
|
||||
: m_vm(vm)
|
||||
{
|
||||
m_allocators.append(make<CellAllocator>(16));
|
||||
if constexpr (HeapBlock::min_possible_cell_size <= 16) {
|
||||
m_allocators.append(make<CellAllocator>(16));
|
||||
}
|
||||
static_assert(HeapBlock::min_possible_cell_size <= 24, "Heap Cell tracking uses too much data!");
|
||||
m_allocators.append(make<CellAllocator>(32));
|
||||
m_allocators.append(make<CellAllocator>(64));
|
||||
m_allocators.append(make<CellAllocator>(128));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue