On Mon, Jan 6, 2020 at 2:51 AM Emilio Cobos Álvarez <emi...@mozilla.com>
wrote:

> If it's not, it could be optimized teaching JSStrings to store UTF-8
> instead of / on top of Latin1 or such, or returning more information
> from the callee, but I don't know how easy would be the first (IIRC
> we're out of JSString bits), and how worth it would be the second.
> Feedback here from JS engine hackers would be much appreciated.
>

Supporting UTF8 JSStrings natively would be quite a lot of work. I added
Latin1 strings a few years ago but Latin1 is a bit simpler than UTF8
because most algorithms could be templatized to work with either char type.
If most of your UTF8 strings are (7-bit) ASCII, it might make sense
short-term to use a Latin1 external string to avoid copies.

One possible approach would be to treat UTF8 JSStrings somewhat similar to
ropes: initially most places working with JSString characters would end up
converting from UTF8 to Latin1/TwoByte but after that we could
(incrementally) optimize these functions to work with UTF8 strings directly
where possible.

Jan

_______________________________________________
> dev-platform mailing list
> dev-platform@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-platform
>
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to