mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:57:44 +00:00
LibJS: Always allocate ExecutionContext objects on the malloc heap
Instead of allocating these in a mixture of ways, we now always put them on the malloc heap, and keep an intrusive linked list of them that we can iterate for GC marking purposes.
This commit is contained in:
parent
845da3901d
commit
3dc5f467a8
38 changed files with 251 additions and 217 deletions
|
@ -23,6 +23,7 @@
|
|||
#include <LibJS/Heap/Internals.h>
|
||||
#include <LibJS/Heap/MarkedVector.h>
|
||||
#include <LibJS/Runtime/Completion.h>
|
||||
#include <LibJS/Runtime/ExecutionContext.h>
|
||||
#include <LibJS/Runtime/WeakContainer.h>
|
||||
|
||||
namespace JS {
|
||||
|
@ -77,6 +78,9 @@ public:
|
|||
void did_create_weak_container(Badge<WeakContainer>, WeakContainer&);
|
||||
void did_destroy_weak_container(Badge<WeakContainer>, WeakContainer&);
|
||||
|
||||
void did_create_execution_context(Badge<ExecutionContext>, ExecutionContext&);
|
||||
void did_destroy_execution_context(Badge<ExecutionContext>, ExecutionContext&);
|
||||
|
||||
BlockAllocator& block_allocator() { return m_block_allocator; }
|
||||
|
||||
void uproot_cell(Cell* cell);
|
||||
|
@ -144,6 +148,7 @@ private:
|
|||
HandleImpl::List m_handles;
|
||||
MarkedVectorBase::List m_marked_vectors;
|
||||
WeakContainer::List m_weak_containers;
|
||||
ExecutionContext::List m_execution_contexts;
|
||||
|
||||
Vector<GCPtr<Cell>> m_uprooted_cells;
|
||||
|
||||
|
@ -191,4 +196,16 @@ inline void Heap::did_destroy_weak_container(Badge<WeakContainer>, WeakContainer
|
|||
m_weak_containers.remove(set);
|
||||
}
|
||||
|
||||
inline void Heap::did_create_execution_context(Badge<ExecutionContext>, ExecutionContext& set)
|
||||
{
|
||||
VERIFY(!m_execution_contexts.contains(set));
|
||||
m_execution_contexts.append(set);
|
||||
}
|
||||
|
||||
inline void Heap::did_destroy_execution_context(Badge<ExecutionContext>, ExecutionContext& set)
|
||||
{
|
||||
VERIFY(m_execution_contexts.contains(set));
|
||||
m_execution_contexts.remove(set);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue