1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:28:12 +00:00

LibJS: Always inline HeapBlock::allocate()

This thing is so simple and sits on the hot path so just inline it.
This commit is contained in:
Andreas Kling 2020-10-04 18:11:54 +02:00
parent ad0d377e4c
commit 2852ce4954
2 changed files with 7 additions and 8 deletions

View file

@ -42,7 +42,13 @@ public:
size_t cell_size() const { return m_cell_size; }
size_t cell_count() const { return (block_size - sizeof(HeapBlock)) / m_cell_size; }
Cell* allocate();
ALWAYS_INLINE Cell* allocate()
{
if (!m_freelist)
return nullptr;
return exchange(m_freelist, m_freelist->next);
}
void deallocate(Cell*);
template<typename Callback>