Commit graph

4 commits

Author SHA1 Message Date
Andreas Kling
ce16bdd07d Revert "AK: Use HashMap::ensure() for FlyString and Utf16FlyString lookups"
This reverts commit 9425ee6d2b.

Appears to have introduced flakiness on WPT.
2025-10-06 10:07:40 +02:00
Andreas Kling
9425ee6d2b AK: Use HashMap::ensure() for FlyString and Utf16FlyString lookups
This consolidates sometimes-two hash lookups into always-one, which is
less work in the case where a new fly-string is introduced.
2025-10-05 21:44:06 +02:00
Timothy Flynn
8472e469f4 AK+LibJS+LibWeb: Recognize that our UTF-16 string is actually WTF-16
For the web, we allow a wobbly UTF-16 encoding (i.e. lonely surrogates
are permitted). Only in a few exceptional cases do we strictly require
valid UTF-16. As such, our `validate(AllowLonelySurrogates::Yes)` calls
will always succeed. It's a wasted effort to ever make such a check.

This patch eliminates such invocations. The validation methods will now
only check for strict UTF-16, and are only invoked when needed.
2025-08-13 09:56:13 -04:00
Timothy Flynn
7f069efbc4 AK: Implement a flyweight string for Utf16String
Utf16FlyString more or less works exactly the same as FlyString. It will
store the raw encoded data of the string instance. If the string is a
short ASCII string, Utf16FlyString holds the ShortString bytes; else,
Utf16FlyString holds a pointer to the Utf16StringData.
2025-07-18 12:45:38 -04:00