mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 16:37:47 +00:00
LibWeb+LibJS: Move some code around to make CSS/Parser parse faster
This makes it possible to include fewer full definitions of things, which makes the file about 30% faster to compile.
This commit is contained in:
parent
392b5c3b19
commit
06c6c40df9
28 changed files with 117 additions and 64 deletions
|
@ -23,6 +23,7 @@ set(SOURCES
|
|||
Contrib/Test262/IsHTMLDDA.cpp
|
||||
CyclicModule.cpp
|
||||
Heap/BlockAllocator.cpp
|
||||
Heap/Cell.cpp
|
||||
Heap/CellAllocator.cpp
|
||||
Heap/Handle.cpp
|
||||
Heap/Heap.cpp
|
||||
|
|
25
Userland/Libraries/LibJS/Heap/Cell.cpp
Normal file
25
Userland/Libraries/LibJS/Heap/Cell.cpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright (c) 2020-2022, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibJS/Heap/Cell.h>
|
||||
#include <LibJS/Heap/Heap.h>
|
||||
#include <LibJS/Runtime/Completion.h>
|
||||
#include <LibJS/Runtime/Value.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
ThrowCompletionOr<void> JS::Cell::initialize(JS::Realm&)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
void JS::Cell::Visitor::visit(JS::Value value)
|
||||
{
|
||||
if (value.is_cell())
|
||||
visit_impl(value.as_cell());
|
||||
}
|
||||
|
||||
}
|
|
@ -14,8 +14,6 @@
|
|||
#include <LibJS/Forward.h>
|
||||
#include <LibJS/Heap/GCPtr.h>
|
||||
#include <LibJS/Heap/Internals.h>
|
||||
#include <LibJS/Runtime/Completion.h>
|
||||
#include <LibJS/Runtime/Value.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
|
@ -33,7 +31,7 @@ class Cell {
|
|||
AK_MAKE_NONMOVABLE(Cell);
|
||||
|
||||
public:
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&) { return {}; }
|
||||
virtual ThrowCompletionOr<void> initialize(Realm&);
|
||||
virtual ~Cell() = default;
|
||||
|
||||
bool is_marked() const { return m_mark; }
|
||||
|
@ -75,11 +73,7 @@ public:
|
|||
visit_impl(const_cast<RemoveConst<T>&>(*cell.ptr()));
|
||||
}
|
||||
|
||||
void visit(Value value)
|
||||
{
|
||||
if (value.is_cell())
|
||||
visit_impl(value.as_cell());
|
||||
}
|
||||
void visit(Value value);
|
||||
|
||||
// Allow explicitly ignoring a GC-allocated member in a visit_edges implementation instead
|
||||
// of just not using it.
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <LibJS/Heap/Handle.h>
|
||||
#include <LibJS/Heap/Internals.h>
|
||||
#include <LibJS/Heap/MarkedVector.h>
|
||||
#include <LibJS/Runtime/Completion.h>
|
||||
#include <LibJS/Runtime/WeakContainer.h>
|
||||
|
||||
namespace JS {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue