1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-08 13:37:10 +09:00
ladybird/Libraries/LibJS/Runtime/CompletionCell.cpp
Andreas Kling a0bb31f7a0 LibJS: Make async functions & generators faster with helper types
Instead of returning internal generator results as ordinary JS::Objects
with properties, we now use GeneratorResult and CompletionCell which
both inherit from Cell directly and allow efficient access to state.

1.59x speedup on JetStream3/lazy-collections.js :^)
2025-04-01 02:30:42 +02:00

22 lines
446 B
C++

/*
* Copyright (c) 2025, Andreas Kling <andreas@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibJS/Runtime/CompletionCell.h>
namespace JS {
GC_DEFINE_ALLOCATOR(CompletionCell);
CompletionCell::~CompletionCell() = default;
void CompletionCell::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
if (m_completion.value().has_value())
visitor.visit(m_completion.value().value());
}
}