Bug 95420 - Use ASCIILiteral for DEFINE_STATIC_LOCAL string
Summary: Use ASCIILiteral for DEFINE_STATIC_LOCAL string
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Gyuyoung Kim
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-29 22:12 PDT by Gyuyoung Kim
Modified: 2012-08-30 03:25 PDT (History)
3 users (show)

See Also:


Attachments
Patch (21.23 KB, patch)
2012-08-29 22:14 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch (16.27 KB, patch)
2012-08-29 22:42 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gyuyoung Kim 2012-08-29 22:12:53 PDT
As recommended by http://trac.webkit.org/wiki/EfficientStrings, WebKit needs to use ASCIILiteral for the string of DEFINE_STATIC_LOCAL.
Comment 1 Gyuyoung Kim 2012-08-29 22:14:43 PDT
Created attachment 161400 [details]
Patch
Comment 2 Gyuyoung Kim 2012-08-29 22:17:42 PDT
CC'ing Benjamin
Comment 3 Benjamin Poulain 2012-08-29 22:32:51 PDT
Comment on attachment 161400 [details]
Patch

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

r- because of the AtomicStrings.
My apologies about that, I should have documented it earlier.

It is very nice of you to update all the ports.

> Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp:240
> +    DEFINE_STATIC_LOCAL(AtomicString, Default, (ASCIILiteral("default")));
> +    DEFINE_STATIC_LOCAL(AtomicString, Url, (ASCIILiteral("url")));
> +    DEFINE_STATIC_LOCAL(AtomicString, Email, (ASIILiteral("email")));
> +    DEFINE_STATIC_LOCAL(AtomicString, Password, (ASCIILiteral("password")));
> +    DEFINE_STATIC_LOCAL(AtomicString, Web, (ASCIILiteral("web")));
> +    DEFINE_STATIC_LOCAL(AtomicString, Number, (ASCIILiteral("number")));
> +    DEFINE_STATIC_LOCAL(AtomicString, Symbol, (ASCIILiteral("symbol")));
> +    DEFINE_STATIC_LOCAL(AtomicString, Phone, (ASCIILiteral("phone")));
> +    DEFINE_STATIC_LOCAL(AtomicString, Pin, (ASCIILiteral("pin")));
> +    DEFINE_STATIC_LOCAL(AtomicString, Hex, (ASCIILiteral("hexadecimal")));

AtomicString should not use ASCIILiteral, I updated the Wiki this afternoon.
You should use the constructor with AtomicString::ConstructFromLiteral so that I can do more optimizations later for AtomicString.

> Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp:295
> +    DEFINE_STATIC_LOCAL(AtomicString, Default, (ASCIILiteral("default")));
> +    DEFINE_STATIC_LOCAL(AtomicString, Connect, (ASCIILiteral("connect")));
> +    DEFINE_STATIC_LOCAL(AtomicString, Done, (ASCIILiteral("done")));
> +    DEFINE_STATIC_LOCAL(AtomicString, Go, (ASCIILiteral("go")));
> +    DEFINE_STATIC_LOCAL(AtomicString, Join, (ASCIILiteral("join")));
> +    DEFINE_STATIC_LOCAL(AtomicString, Next, (ASCIILiteral("next")));
> +    DEFINE_STATIC_LOCAL(AtomicString, Search, (ASCIILiteral("search")));
> +    DEFINE_STATIC_LOCAL(AtomicString, Send, (ASCIILiteral("send")));
> +    DEFINE_STATIC_LOCAL(AtomicString, Submit, (ASCIILiteral("submit")));

Ditto.

> Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp:99
> +    DEFINE_STATIC_LOCAL(AtomicString, name, (ASCIILiteral("ContextFeaturesCache")));

Ditto.

> Source/WebKit/gtk/webkit/webkitwebsettings.cpp:137
> -    DEFINE_STATIC_LOCAL(const String, uaPlatform, (String("")));
> +    DEFINE_STATIC_LOCAL(const String, uaPlatform, (ASCIILiteral("")));

Please leave this one as it is. There is no construction from literal for empty strings, it is gonna assert.

I need to do some measurement to find the fastest way to initialize empty strings. I'll update the wiki as soon as I have the solution.
Comment 4 Gyuyoung Kim 2012-08-29 22:42:47 PDT
Created attachment 161403 [details]
Patch
Comment 5 Gyuyoung Kim 2012-08-29 22:44:23 PDT
Thank you for your review. I would like to fix the stuff you pointed out in new bug.
Comment 6 Benjamin Poulain 2012-08-29 22:47:24 PDT
Comment on attachment 161403 [details]
Patch

Everything looks good.
Comment 7 WebKit Review Bot 2012-08-30 03:25:56 PDT
Comment on attachment 161403 [details]
Patch

Clearing flags on attachment: 161403

Committed r127121: <http://trac.webkit.org/changeset/127121>
Comment 8 WebKit Review Bot 2012-08-30 03:25:59 PDT
All reviewed patches have been landed.  Closing bug.