RESOLVED FIXED95291
Deploy ASCIILiteral and StringBuilder in more places in WebCore
https://bugs.webkit.org/show_bug.cgi?id=95291
Summary Deploy ASCIILiteral and StringBuilder in more places in WebCore
Adam Barth
Reported 2012-08-28 23:07:24 PDT
Deploy ASCIILiteral and StringBuilder in more places in WebCore
Attachments
Patch (33.71 KB, patch)
2012-08-28 23:08 PDT, Adam Barth
benjamin: review+
Adam Barth
Comment 1 2012-08-28 23:08:32 PDT
Benjamin Poulain
Comment 2 2012-08-28 23:24:34 PDT
Comment on attachment 161140 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=161140&action=review Looks great! How did you fix all the string? Manually or you have made a smart script? I have a few comments but they are nitpicking. > Source/WebCore/css/CSSCanvasValue.cpp:47 > + result.appendLiteral(")"); append(')') is faster (it is mostly inline IIRC) You can also use the string operators (operator+). If you do not have a branch, they do a better job than StringBuilder. > Source/WebCore/css/CSSCrossfadeValue.cpp:96 > + result.appendLiteral(")"); append(')') > Source/WebCore/css/CSSPageRule.cpp:64 > + text.appendLiteral(" "); append(' ') > Source/WebCore/css/CSSSelector.cpp:527 > + str.append(prefix.string()); This is unfortunate. If that is useful elsewhere, we add StringBuilder::append(AtomicString). > Source/WebCore/css/CSSSelector.cpp:631 > + return tagHistoryText + " " + str.toString(); ' ' > Source/WebCore/html/HTMLTitleElement.cpp:79 > for (Node *n = firstChild(); n; n = n->nextSibling()) { > if (n->isTextNode()) > - val += toText(n)->data(); > + result.append(toText(n)->data()); > } Wow, that was pretty bad. > Source/WebCore/platform/sql/SQLiteDatabase.cpp:96 > + if (!SQLiteStatement(*this, ASCIILiteral("PRAGMA temp_store = MEMORY;")).executeCommand()) I have looked at our use of SQLiteStatement and I think we could make a malloc-free version for many operations. But that would be stupid not to use ASCIILiteral in the meantime. :)
Adam Barth
Comment 3 2012-08-28 23:28:48 PDT
> How did you fix all the string? Manually or you have made a smart script? This isn't all of them. I'm just greping around and fixing obvious stuff.
Adam Barth
Comment 4 2012-08-29 00:32:00 PDT
Adam Barth
Comment 5 2012-08-29 00:32:31 PDT
I fixed all the above before landing.
Note You need to log in before you can comment on or make changes to this bug.