[webkit-reviews] review granted: [Bug 162315] Optimize StringView::CodePoints::Iterator : [Attachment 423934] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Mar 22 15:45:49 PDT 2021


Darin Adler <darin at apple.com> has granted Alex Christensen
<achristensen at apple.com>'s request for review:
Bug 162315: Optimize StringView::CodePoints::Iterator
https://bugs.webkit.org/show_bug.cgi?id=162315

Attachment 423934: Patch

https://bugs.webkit.org/attachment.cgi?id=423934&action=review




--- Comment #5 from Darin Adler <darin at apple.com> ---
Comment on attachment 423934
  --> https://bugs.webkit.org/attachment.cgi?id=423934
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=423934&action=review

> Source/WTF/wtf/text/StringView.h:847
> +    union {
> +	   const LChar* m_current8;
> +	   const UChar* m_current16;
> +    };
> +    union {
> +	   const LChar* m_end8;
> +	   const UChar* m_end16;
> +    };

We could consider using const void* for both of these. This would help us
understand the code is in operator== without relying on properties of unions
that aren’t deeply guaranteed.

We would use static_cast to pull values out: there would be only 4 places we’d
need them.

> Source/WTF/wtf/text/StringView.h:933
> +	   size_t length = m_end16 - m_current16;

Why local variable here?

> Source/WTF/wtf/text/StringView.h:951
> +    U16_GET(m_current16, 0, 0, m_end16 - m_current16, codePoint);

But not here for the same kind of argument?


More information about the webkit-reviews mailing list