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

LibJS: Move Cell.{cpp,h} from Runtime/ to Heap/

This commit is contained in:
Andreas Kling 2021-05-17 19:50:20 +02:00
parent ee6600ea24
commit 6714cf3631
12 changed files with 11 additions and 11 deletions

View file

@ -7,7 +7,7 @@
#pragma once
#include <LibCrypto/BigInt/SignedBigInteger.h>
#include <LibJS/Runtime/Cell.h>
#include <LibJS/Heap/Cell.h>
namespace JS {

View file

@ -1,26 +0,0 @@
/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibJS/Heap/Heap.h>
#include <LibJS/Heap/HeapBlock.h>
#include <LibJS/Runtime/Cell.h>
#include <LibJS/Runtime/Value.h>
namespace JS {
void Cell::Visitor::visit(Cell* cell)
{
if (cell)
visit_impl(cell);
}
void Cell::Visitor::visit(Value value)
{
if (value.is_cell())
visit_impl(value.as_cell());
}
}

View file

@ -1,68 +0,0 @@
/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Format.h>
#include <AK/Forward.h>
#include <AK/Noncopyable.h>
#include <AK/String.h>
#include <AK/TypeCasts.h>
#include <LibJS/Forward.h>
namespace JS {
class Cell {
AK_MAKE_NONCOPYABLE(Cell);
AK_MAKE_NONMOVABLE(Cell);
public:
virtual void initialize(GlobalObject&) { }
virtual ~Cell() { }
bool is_marked() const { return m_mark; }
void set_marked(bool b) { m_mark = b; }
bool is_live() const { return m_live; }
void set_live(bool b) { m_live = b; }
virtual const char* class_name() const = 0;
class Visitor {
public:
void visit(Cell*);
void visit(Value);
protected:
virtual void visit_impl(Cell*) = 0;
virtual ~Visitor() = default;
};
virtual void visit_edges(Visitor&) { }
Heap& heap() const;
VM& vm() const;
protected:
Cell() { }
private:
bool m_mark { false };
bool m_live { true };
};
}
template<>
struct AK::Formatter<JS::Cell> : AK::Formatter<FormatString> {
void format(FormatBuilder& builder, const JS::Cell* cell)
{
if (!cell)
Formatter<FormatString>::format(builder, "Cell{nullptr}");
else
Formatter<FormatString>::format(builder, "{}({})", cell->class_name(), cell);
}
};

View file

@ -9,7 +9,7 @@
#include <AK/FlyString.h>
#include <AK/Vector.h>
#include <LibJS/Runtime/Cell.h>
#include <LibJS/Heap/Cell.h>
#include <LibJS/Runtime/Value.h>
#include <LibJS/SourceRange.h>

View file

@ -10,7 +10,7 @@
#include <AK/HashMap.h>
#include <AK/String.h>
#include <LibJS/Forward.h>
#include <LibJS/Runtime/Cell.h>
#include <LibJS/Heap/Cell.h>
#include <LibJS/Runtime/IndexedProperties.h>
#include <LibJS/Runtime/MarkedValueList.h>
#include <LibJS/Runtime/PrimitiveString.h>

View file

@ -7,7 +7,7 @@
#pragma once
#include <AK/String.h>
#include <LibJS/Runtime/Cell.h>
#include <LibJS/Heap/Cell.h>
namespace JS {

View file

@ -9,7 +9,7 @@
#include <AK/HashMap.h>
#include <AK/OwnPtr.h>
#include <LibJS/Forward.h>
#include <LibJS/Runtime/Cell.h>
#include <LibJS/Heap/Cell.h>
#include <LibJS/Runtime/PropertyAttributes.h>
#include <LibJS/Runtime/StringOrSymbol.h>
#include <LibJS/Runtime/Value.h>

View file

@ -7,7 +7,7 @@
#pragma once
#include <AK/String.h>
#include <LibJS/Runtime/Cell.h>
#include <LibJS/Heap/Cell.h>
namespace JS {