LibJS: Inline Cell::Visitor::visit() functions
This allows the calls to MarkingVisitor::visit_impl() during GC to be devirtualized in Heap::mark_live_cells().
This commit is contained in:
parent
c81b3e1ee3
commit
91656d63c7
Notes:
sideshowbarker
2024-07-18 17:25:13 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/91656d63c7f
4 changed files with 11 additions and 28 deletions
|
@ -2,7 +2,6 @@ set(SOURCES
|
|||
AST.cpp
|
||||
Console.cpp
|
||||
Heap/Allocator.cpp
|
||||
Heap/Cell.cpp
|
||||
Heap/Handle.cpp
|
||||
Heap/HeapBlock.cpp
|
||||
Heap/Heap.cpp
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibJS/Heap/Cell.h>
|
||||
#include <LibJS/Heap/Heap.h>
|
||||
#include <LibJS/Heap/HeapBlock.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());
|
||||
}
|
||||
|
||||
}
|
|
@ -33,7 +33,11 @@ public:
|
|||
|
||||
class Visitor {
|
||||
public:
|
||||
void visit(Cell*);
|
||||
void visit(Cell* cell)
|
||||
{
|
||||
if (cell)
|
||||
visit_impl(cell);
|
||||
}
|
||||
void visit(Value);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -327,6 +327,12 @@ inline Value js_negative_infinity()
|
|||
return Value(-INFINITY);
|
||||
}
|
||||
|
||||
inline void Cell::Visitor::visit(Value value)
|
||||
{
|
||||
if (value.is_cell())
|
||||
visit_impl(value.as_cell());
|
||||
}
|
||||
|
||||
Value greater_than(GlobalObject&, Value lhs, Value rhs);
|
||||
Value greater_than_equals(GlobalObject&, Value lhs, Value rhs);
|
||||
Value less_than(GlobalObject&, Value lhs, Value rhs);
|
||||
|
|
Loading…
Add table
Reference in a new issue