LibJS: Remove MarkedValueList in favor of MarkedVector<Value> :^)
This commit is contained in:
parent
6508ff5bbd
commit
7676b1b925
Notes:
sideshowbarker
2024-07-18 00:41:35 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/7676b1b925 Pull-request: https://github.com/SerenityOS/serenity/pull/12376 Reviewed-by: https://github.com/IdanHo
6 changed files with 0 additions and 116 deletions
|
@ -129,7 +129,6 @@ set(SOURCES
|
|||
Runtime/MapIterator.cpp
|
||||
Runtime/MapIteratorPrototype.cpp
|
||||
Runtime/MapPrototype.cpp
|
||||
Runtime/MarkedValueList.cpp
|
||||
Runtime/MathObject.cpp
|
||||
Runtime/ModuleEnvironment.cpp
|
||||
Runtime/ModuleNamespaceObject.cpp
|
||||
|
|
|
@ -159,7 +159,6 @@ class HandleImpl;
|
|||
class Heap;
|
||||
class HeapBlock;
|
||||
class Interpreter;
|
||||
class MarkedValueList;
|
||||
class Module;
|
||||
class NativeFunction;
|
||||
class ObjectEnvironment;
|
||||
|
|
|
@ -113,13 +113,6 @@ void Heap::gather_roots(HashTable<Cell*>& roots)
|
|||
for (auto& handle : m_handles)
|
||||
roots.set(handle.cell());
|
||||
|
||||
for (auto& list : m_marked_value_lists) {
|
||||
for (auto& value : list.values()) {
|
||||
if (value.is_cell())
|
||||
roots.set(&value.as_cell());
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& vector : m_marked_vectors)
|
||||
vector.gather_roots(roots);
|
||||
|
||||
|
@ -293,18 +286,6 @@ void Heap::did_destroy_handle(Badge<HandleImpl>, HandleImpl& impl)
|
|||
m_handles.remove(impl);
|
||||
}
|
||||
|
||||
void Heap::did_create_marked_value_list(Badge<MarkedValueList>, MarkedValueList& list)
|
||||
{
|
||||
VERIFY(!m_marked_value_lists.contains(list));
|
||||
m_marked_value_lists.append(list);
|
||||
}
|
||||
|
||||
void Heap::did_destroy_marked_value_list(Badge<MarkedValueList>, MarkedValueList& list)
|
||||
{
|
||||
VERIFY(m_marked_value_lists.contains(list));
|
||||
m_marked_value_lists.remove(list);
|
||||
}
|
||||
|
||||
void Heap::did_create_marked_vector(Badge<MarkedVectorBase>, MarkedVectorBase& vector)
|
||||
{
|
||||
VERIFY(!m_marked_vectors.contains(vector));
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <LibJS/Heap/CellAllocator.h>
|
||||
#include <LibJS/Heap/Handle.h>
|
||||
#include <LibJS/Heap/MarkedVector.h>
|
||||
#include <LibJS/Runtime/MarkedValueList.h>
|
||||
#include <LibJS/Runtime/Object.h>
|
||||
#include <LibJS/Runtime/WeakContainer.h>
|
||||
|
||||
|
@ -67,9 +66,6 @@ public:
|
|||
void did_create_handle(Badge<HandleImpl>, HandleImpl&);
|
||||
void did_destroy_handle(Badge<HandleImpl>, HandleImpl&);
|
||||
|
||||
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&);
|
||||
|
||||
|
@ -112,10 +108,7 @@ private:
|
|||
Vector<NonnullOwnPtr<CellAllocator>> m_allocators;
|
||||
|
||||
HandleImpl::List m_handles;
|
||||
|
||||
MarkedVectorBase::List m_marked_vectors;
|
||||
MarkedValueList::List m_marked_value_lists;
|
||||
|
||||
WeakContainer::List m_weak_containers;
|
||||
|
||||
Vector<Cell*> m_uprooted_cells;
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibJS/Heap/Heap.h>
|
||||
#include <LibJS/Heap/MarkedVector.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
MarkedValueList::MarkedValueList(Heap& heap)
|
||||
: m_heap(&heap)
|
||||
{
|
||||
m_heap->did_create_marked_value_list({}, *this);
|
||||
}
|
||||
|
||||
MarkedValueList::MarkedValueList(MarkedValueList const& other)
|
||||
: Vector<Value, 32>(other)
|
||||
, m_heap(other.m_heap)
|
||||
{
|
||||
m_heap->did_create_marked_value_list({}, *this);
|
||||
}
|
||||
|
||||
MarkedValueList::MarkedValueList(MarkedValueList&& other)
|
||||
: Vector<Value, 32>(move(static_cast<Vector<Value, 32>&>(other)))
|
||||
, m_heap(other.m_heap)
|
||||
{
|
||||
m_heap->did_create_marked_value_list({}, *this);
|
||||
}
|
||||
|
||||
MarkedValueList::~MarkedValueList()
|
||||
{
|
||||
m_heap->did_destroy_marked_value_list({}, *this);
|
||||
}
|
||||
|
||||
MarkedValueList& MarkedValueList::operator=(JS::MarkedValueList const& other)
|
||||
{
|
||||
Vector<Value, 32>::operator=(other);
|
||||
|
||||
if (m_heap != other.m_heap) {
|
||||
m_heap = other.m_heap;
|
||||
|
||||
// NOTE: IntrusiveList will remove this MarkedValueList from the old heap it was part of.
|
||||
m_heap->did_create_marked_value_list({}, *this);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/IntrusiveList.h>
|
||||
#include <AK/Noncopyable.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibJS/Runtime/Value.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
class MarkedValueList : public Vector<Value, 32> {
|
||||
public:
|
||||
explicit MarkedValueList(Heap&);
|
||||
MarkedValueList(MarkedValueList const&);
|
||||
MarkedValueList(MarkedValueList&&);
|
||||
~MarkedValueList();
|
||||
|
||||
Vector<Value, 32>& values() { return *this; }
|
||||
|
||||
MarkedValueList& operator=(JS::MarkedValueList const& other);
|
||||
|
||||
private:
|
||||
Heap* m_heap;
|
||||
|
||||
IntrusiveListNode<MarkedValueList> m_list_node;
|
||||
|
||||
public:
|
||||
using List = IntrusiveList<&MarkedValueList::m_list_node>;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue