mirror of
https://github.com/zebrajr/ladybird.git
synced 2026-01-15 12:15:15 +00:00
Instead of creating PropertyKeys on the fly during interpreter execution, we now store fully-formed ones in the Executable. This avoids a whole bunch of busywork in property access instructions and substantially reduces code size bloat.
31 lines
721 B
C++
31 lines
721 B
C++
/*
|
|
* Copyright (c) 2025, Andreas Kling <andreas@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibJS/Bytecode/PropertyKeyTable.h>
|
|
|
|
namespace JS::Bytecode {
|
|
|
|
PropertyKeyTableIndex PropertyKeyTable::insert(PropertyKey key)
|
|
{
|
|
m_property_keys.append(move(key));
|
|
VERIFY(m_property_keys.size() <= NumericLimits<u32>::max());
|
|
return { static_cast<u32>(m_property_keys.size() - 1) };
|
|
}
|
|
|
|
PropertyKey const& PropertyKeyTable::get(PropertyKeyTableIndex index) const
|
|
{
|
|
return m_property_keys[index.value];
|
|
}
|
|
|
|
void PropertyKeyTable::dump() const
|
|
{
|
|
outln("Property Key Table:");
|
|
for (size_t i = 0; i < m_property_keys.size(); i++)
|
|
outln("{}: {}", i, m_property_keys[i]);
|
|
}
|
|
|
|
}
|