LibJS/Bytecode: Inline indexed property access in GetByVal better

This commit is contained in:
Andreas Kling 2024-05-07 12:28:59 +02:00
commit 161298b5d1
Notes: sideshowbarker 2024-07-17 03:16:02 +09:00
3 changed files with 20 additions and 5 deletions

View file

@ -74,6 +74,18 @@ public:
Vector<Value> const& elements() const { return m_packed_elements; }
[[nodiscard]] bool inline_has_index(u32 index) const
{
return index < m_array_size && !m_packed_elements.data()[index].is_empty();
}
[[nodiscard]] Optional<ValueAndAttributes> inline_get(u32 index) const
{
if (!inline_has_index(index))
return {};
return ValueAndAttributes { m_packed_elements.data()[index], default_attributes };
}
private:
friend GenericIndexedPropertyStorage;