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

LibJS: Remove MarkedValueList in favor of MarkedVector<Value> :^)

This commit is contained in:
Linus Groh 2022-02-09 10:18:48 +00:00
parent 6508ff5bbd
commit 7676b1b925
6 changed files with 0 additions and 116 deletions

View file

@ -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;
}
}

View file

@ -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>;
};
}