[webkit-reviews] review granted: [Bug 238263] Avoid unnecessary String constructor under FunctionExecutable::toStringSlow() : [Attachment 455505] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Mar 23 09:02:40 PDT 2022


Darin Adler <darin at apple.com> has granted Chris Dumez <cdumez at apple.com>'s
request for review:
Bug 238263: Avoid unnecessary String constructor under
FunctionExecutable::toStringSlow()
https://bugs.webkit.org/show_bug.cgi?id=238263

Attachment 455505: Patch

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




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

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

> Source/JavaScriptCore/runtime/FunctionExecutable.cpp:144
> -    String functionHeader;
> +    ASCIILiteral functionHeader = ASCIILiteral::null();

A few other thoughts: Why ASCIILiteral::null() here, but ""_s below? I’m not
familiar with the variadic jsMakeNontrivialString. Does jsMakeNontrivialString
benefit from this being an ASCIILiteral rather than a const char* or a
StringView? Since src is a StringView I get the impression that we don’t need
to make a String so not sure why ASCIILiteral is better than const char*. I’m
sort of surprised that this idiom is jsMakeNontrivialString instead of just
jsNontrivialString(makeString()).

I think I would have done:

    auto functionHeader = "";


More information about the webkit-reviews mailing list