[webkit-reviews] review granted: [Bug 53711] Remove duplicated code from AtomicString::fromUTF8() : [Attachment 86263] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Mar 28 09:46:50 PDT 2011


Darin Adler <darin at apple.com> has granted Patrick R. Gansterer
<paroga at paroga.com>'s request for review:
Bug 53711: Remove duplicated code from AtomicString::fromUTF8()
https://bugs.webkit.org/show_bug.cgi?id=53711

Attachment 86263: Patch
https://bugs.webkit.org/attachment.cgi?id=86263&action=review

------- Additional Comments from Darin Adler <darin at apple.com>
View in context: https://bugs.webkit.org/attachment.cgi?id=86263&action=review

> Source/JavaScriptCore/wtf/text/AtomicString.h:182
> +inline AtomicString AtomicString::fromUTF8(const char* characters, size_t
length)
> +{
> +    if (!characters)
> +	   return nullAtom;
> +    if (!length)
> +	   return emptyAtom;
> +    return fromUTF8Internal(characters, characters + length);
> +}
> +
> +inline AtomicString AtomicString::fromUTF8(const char* characters)
> +{
> +    if (!characters)
> +	   return nullAtom;
> +    if (!*characters)
> +	   return emptyAtom;
> +    return fromUTF8Internal(characters, 0);
> +}

Inlining more like this is a big deal. It will probably make code size a bit
bigger because of more checks at every single callsite. When called with a
constant C literal, I think the code might get constant-folded away, which
would be great. I’m not sure about making this change without checking if there
is performance impact.


More information about the webkit-reviews mailing list