Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(559)

Issue 1844223002: Literal AtomicString construction can rely on strlen optimization. (Closed)

Created:
4 years, 8 months ago by esprehn
Modified:
4 years, 8 months ago
CC:
aboxhall, aboxhall+watch_chromium.org, darktears, apavlov+blink_chromium.org, blink-reviews, blink-reviews-animation_chromium.org, blink-reviews-css, blink-reviews-dom_chromium.org, blink-reviews-html_chromium.org, blink-reviews-layout_chromium.org, blink-reviews-platform-graphics_chromium.org, blink-reviews-style_chromium.org, blink-reviews-wtf_chromium.org, Rik, caseq+blink_chromium.org, chromium-reviews, danakj+watch_chromium.org, devtools-reviews_chromium.org, dglazkov+blink, dmazzoni+watch_chromium.org, dmazzoni, dshwang, drott+blinkwatch_chromium.org, krit, dtapuska+blinkwatch_chromium.org, dtseng+watch_chromium.org, eae+blinkwatch, eric.carlson_apple.com, Eric Willigers, feature-media-reviews_chromium.org, f(malita), fs, gavinp+loader_chromium.org, gasubic, gyuyoung2, Nate Chapin, jbroman, jchaffraix+rendering, je_julie, Justin Novosad, kinuko+watch, kouhei+svg_chromium.org, kozyatinskiy+blink_chromium.org, leviw+renderwatch, loading-reviews+fetch_chromium.org, loading-reviews_chromium.org, lushnikov+blink_chromium.org, Mikhail, mlamouri+watch-screen-orientation_chromium.org, mlamouri+watch-blink_chromium.org, nektar+watch_chromium.org, nektarios, pdr+graphicswatchlist_chromium.org, pdr+svgwatchlist_chromium.org, pdr+renderingwatchlist_chromium.org, pfeldman+blink_chromium.org, philipj_slow, rjwright, rwlbuis, Stephen Chennney, sergeyv+blink_chromium.org, shans, sof, nessy, szager+layoutwatch_chromium.org, tyoshino+watch_chromium.org, vcarbune.chromium, Yoav Weiss, yuzo+watch_chromium.org, zoltan1
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Literal AtomicString construction can rely on strlen optimization. A literal string should have strlen() on it optimized into the length. We should be able to rely on that instead of using template and enum tagging crazy. This seems like it should be safe since base::StringPiece<std::string> does this too. I also tested with a small test program compiled with clang++ and g++ and both -O2 and -Os will turn strlen into the literal length. This machinery was once part of the ASCIILiteral optimization where we would share the read only string in the binary with the StringImpl to avoid making a copy for literal strings. This turned out to not be worth much savings and was removed in the process of adding the small string optimization to StringImpl. See: https://codereview.chromium.org/21274008 Committed: https://crrev.com/95188e3e597532927640b169d6cb8e096bf50588 Cr-Commit-Position: refs/heads/master@{#384333}

Patch Set 1 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+309 lines, -359 lines) Patch
M third_party/WebKit/Source/build/scripts/make_css_property_names.py View 1 chunk +2 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/animation/css/CSSAnimationData.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/css/FontFaceSet.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/dom/MutationRecord.cpp View 1 chunk +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/dom/StyleChangeReason.cpp View 1 chunk +6 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp View 1 chunk +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/fetch/ImageResource.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/fetch/ScriptResource.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/fetch/XSLStyleSheetResource.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/HTMLAudioElement.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/HTMLButtonElement.cpp View 1 chunk +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLElement.cpp View 2 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLFieldSetElement.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/HTMLImageFallbackHelper.cpp View 2 chunks +6 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLKeygenElement.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLMeterElement.cpp View 2 chunks +5 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLOptGroupElement.cpp View 1 chunk +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLOutputElement.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/HTMLProgressElement.cpp View 1 chunk +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLSelectElement.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLTextAreaElement.cpp View 3 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLTextFormControlElement.cpp View 2 chunks +8 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/core/html/forms/BaseChooserOnlyDateAndTimeInputType.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/forms/BaseMultipleFieldsDateAndTimeInputType.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/forms/ColorInputType.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/html/forms/FileInputType.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/forms/FormController.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/forms/InputType.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/forms/RangeInputType.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/forms/SearchInputType.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/forms/TextFieldInputType.cpp View 4 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/html/forms/TextInputType.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/shadow/ClearButtonElement.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/shadow/DateTimeEditElement.cpp View 3 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/html/shadow/DateTimeFieldElement.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/shadow/DateTimeFieldElements.cpp View 10 chunks +10 lines, -10 lines 0 comments Download
M third_party/WebKit/Source/core/html/shadow/DetailsMarkerControl.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp View 13 chunks +14 lines, -14 lines 0 comments Download
M third_party/WebKit/Source/core/html/shadow/MediaControls.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/shadow/PickerIndicatorElement.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/shadow/ShadowElementNames.cpp View 1 chunk +15 lines, -15 lines 0 comments Download
M third_party/WebKit/Source/core/html/shadow/SliderThumbElement.cpp View 2 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/html/shadow/SpinButtonElement.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/shadow/TextControlInnerElements.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/html/track/AudioTrack.cpp View 1 chunk +6 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/html/track/TextTrack.cpp View 1 chunk +8 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/core/html/track/TextTrackContainer.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/track/TextTrackCue.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/track/VideoTrack.cpp View 1 chunk +6 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/html/track/vtt/VTTCue.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/track/vtt/VTTParser.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/track/vtt/VTTRegion.cpp View 6 chunks +6 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/input/EventHandler.cpp View 1 chunk +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutThemeFontProvider.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/loader/BeaconLoader.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/loader/FormSubmission.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/loader/FormSubmission.cpp View 2 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/svg/SVGAElement.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/svg/SVGAnimateMotionElement.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/svg/SVGAnimationElement.cpp View 4 chunks +9 lines, -9 lines 0 comments Download
M third_party/WebKit/Source/core/svg/SVGElement.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/svg/SVGStyleElement.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/svg/SVGTextContentElement.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/svg/SVGUseElement.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp View 5 chunks +6 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp View 2 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/svg/graphics/filters/SVGFilterBuilder.cpp View 1 chunk +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp View 2 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/modules/credentialmanager/PasswordCredential.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandle.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/fetch/FetchRequestData.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/fetch/RequestInit.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/fetch/Response.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/mediasource/MediaSource.cpp View 2 chunks +5 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/mediasource/TrackDefault.cpp View 1 chunk +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp View 2 chunks +6 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/screen_orientation/ScreenOrientation.cpp View 1 chunk +8 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/platform/exported/linux/WebFontInfo.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/fonts/AlternateFontFamily.h View 4 chunks +18 lines, -18 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp View 1 chunk +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/mac/FontCacheMac.mm View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp View 1 chunk +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/platform/network/HTTPParsers.cpp View 1 chunk +5 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/platform/network/HTTPParsersTest.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/network/ResourceResponse.cpp View 7 chunks +14 lines, -14 lines 0 comments Download
M third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/web/WebViewImpl.cpp View 2 chunks +6 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/AtomicString.h View 4 chunks +7 lines, -16 lines 4 comments Download
M third_party/WebKit/Source/wtf/text/AtomicString.cpp View 3 chunks +0 lines, -39 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/StringStatics.cpp View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 23 (10 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1844223002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1844223002/1
4 years, 8 months ago (2016-03-31 00:29:01 UTC) #2
esprehn
This is much simpler, and seems like it should have identical performance, plus it doesn't ...
4 years, 8 months ago (2016-03-31 05:23:06 UTC) #5
haraken
LGTM, if you're confident that strlen is optimized as you expected :)
4 years, 8 months ago (2016-03-31 05:54:32 UTC) #6
dcheng
It might be worth mentioning in the CL description that originally, the literal optimization was ...
4 years, 8 months ago (2016-03-31 05:54:36 UTC) #8
Yuta Kitamura
https://codereview.chromium.org/1844223002/diff/1/third_party/WebKit/Source/wtf/text/AtomicString.h File third_party/WebKit/Source/wtf/text/AtomicString.h (right): https://codereview.chromium.org/1844223002/diff/1/third_party/WebKit/Source/wtf/text/AtomicString.h#newcode151 third_party/WebKit/Source/wtf/text/AtomicString.h:151: ALWAYS_INLINE static PassRefPtr<StringImpl> add(const LChar* characters) String literals have ...
4 years, 8 months ago (2016-03-31 06:12:07 UTC) #9
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_android_rel_ng on tryserver.chromium.android (JOB_TIMED_OUT, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/45714) linux_chromium_rel_ng on ...
4 years, 8 months ago (2016-03-31 06:30:57 UTC) #11
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1844223002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1844223002/1
4 years, 8 months ago (2016-03-31 09:21:12 UTC) #13
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 8 months ago (2016-03-31 12:41:04 UTC) #15
esprehn
On 2016/03/31 at 05:54:36, dcheng wrote: > It might be worth mentioning in the CL ...
4 years, 8 months ago (2016-03-31 18:03:50 UTC) #17
esprehn
https://codereview.chromium.org/1844223002/diff/1/third_party/WebKit/Source/wtf/text/AtomicString.h File third_party/WebKit/Source/wtf/text/AtomicString.h (right): https://codereview.chromium.org/1844223002/diff/1/third_party/WebKit/Source/wtf/text/AtomicString.h#newcode151 third_party/WebKit/Source/wtf/text/AtomicString.h:151: ALWAYS_INLINE static PassRefPtr<StringImpl> add(const LChar* characters) On 2016/03/31 at ...
4 years, 8 months ago (2016-03-31 18:04:12 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1844223002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1844223002/1
4 years, 8 months ago (2016-03-31 18:04:47 UTC) #20
commit-bot: I haz the power
Committed patchset #1 (id:1)
4 years, 8 months ago (2016-03-31 18:17:36 UTC) #21
commit-bot: I haz the power
4 years, 8 months ago (2016-03-31 18:19:27 UTC) #23
Message was sent while issue was closed.
Patchset 1 (id:??) landed as
https://crrev.com/95188e3e597532927640b169d6cb8e096bf50588
Cr-Commit-Position: refs/heads/master@{#384333}

Powered by Google App Engine
This is Rietveld 408576698