[webkit-reviews] review granted: [Bug 50516] Avoid strlen() in AtomicString::fromUTF8 : [Attachment 79110] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Feb 1 10:39:07 PST 2011
Darin Adler <darin at apple.com> has granted Patrick R. Gansterer
<paroga at paroga.com>'s request for review:
Bug 50516: Avoid strlen() in AtomicString::fromUTF8
https://bugs.webkit.org/show_bug.cgi?id=50516
Attachment 79110: Patch
https://bugs.webkit.org/attachment.cgi?id=79110&action=review
------- Additional Comments from Darin Adler <darin at apple.com>
View in context: https://bugs.webkit.org/attachment.cgi?id=79110&action=review
> Source/JavaScriptCore/wtf/unicode/UTF8.cpp:334
> + if (dataLength)
> + *dataLength += 1;
Seems better to not have if statements like this inside relatively hot loops.
We should instead have callers supply a place to put the length even if they
won’t use it.
> Source/JavaScriptCore/wtf/unicode/UTF8.cpp:369
> + if (utf16Length)
> + *utf16Length += 2;
No reason to have these branches in since utf16Length is never null.
> Source/JavaScriptCore/wtf/unicode/UTF8.h:75
> unsigned calculateStringHashFromUTF8(const char* data, const char*
dataEnd, unsigned& utf16Length);
>
> + unsigned calculateStringHashAndLengthFromUTF8(const char* data,
unsigned& dataLength, unsigned& utf16Length);
I’d group these together rather than leaving a blank line.
More information about the webkit-reviews
mailing list