1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:07:36 +00:00

LibJS: Add MarkedVector<T>

This abstracts a vector of Cell* with a strongly typed span() accessor
that gives you Span<T*> instead of Span<Cell*>.

It is intended to replace MarkedValueList in situations where you only
need to store pointers to Cell (or an even more specific type of Cell).

The API can definitely be improved, it's just the bare basics for now.
This commit is contained in:
Andreas Kling 2021-12-16 18:54:06 +01:00
parent c26b58bc53
commit 8bb9fe63b7
6 changed files with 126 additions and 0 deletions

View file

@ -19,6 +19,7 @@
#include <LibJS/Heap/Cell.h>
#include <LibJS/Heap/CellAllocator.h>
#include <LibJS/Heap/Handle.h>
#include <LibJS/Heap/MarkedVector.h>
#include <LibJS/Runtime/Object.h>
#include <LibJS/Runtime/WeakContainer.h>
@ -75,6 +76,9 @@ public:
void did_create_marked_value_list(Badge<MarkedValueList>, MarkedValueList&);
void did_destroy_marked_value_list(Badge<MarkedValueList>, MarkedValueList&);
void did_create_marked_vector(Badge<MarkedVectorBase>, MarkedVectorBase&);
void did_destroy_marked_vector(Badge<MarkedVectorBase>, MarkedVectorBase&);
void did_create_weak_container(Badge<WeakContainer>, WeakContainer&);
void did_destroy_weak_container(Badge<WeakContainer>, WeakContainer&);
@ -115,6 +119,7 @@ private:
HandleImpl::List m_handles;
MarkedVectorBase::List m_marked_vectors;
MarkedValueList::List m_marked_value_lists;
WeakContainer::List m_weak_containers;