LibJS: Add and use PrimitiveString::length_in_utf16_code_units

I was investigating an optimization in this area, and while it
didn't seem to have a noticable improvement, it still seems
useful to apply this change.
This commit is contained in:
Shannon Booth 2025-05-04 00:06:34 +12:00 committed by Andreas Kling
commit e476d21ed0
Notes: github-actions[bot] 2025-05-03 14:19:42 +00:00
5 changed files with 12 additions and 9 deletions

View file

@ -45,6 +45,8 @@ public:
[[nodiscard]] Utf16View utf16_string_view() const;
bool has_utf16_string() const { return m_utf16_string.has_value(); }
size_t length_in_utf16_code_units() const;
ThrowCompletionOr<Optional<Value>> get(VM&, PropertyKey const&) const;
[[nodiscard]] bool operator==(PrimitiveString const&) const;