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

Issue 2668903003: Replace WTF::emptyString{16Bit}() with a static global (Closed)

Created:
3 years, 10 months ago by Charlie Harrison
Modified:
3 years, 10 months ago
Reviewers:
haraken, esprehn, Nico, dcheng
CC:
Aaron Boodman, abarth-chromium, ajuma+watch_chromium.org, darktears, apavlov+blink_chromium.org, atotic+reviews_chromium.org, blink-reviews, blink-reviews-animation_chromium.org, blink-reviews-bindings_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, blink-worker-reviews_chromium.org, Rik, caseq+blink_chromium.org, cbiesinger, chromium-reviews, danakj+watch_chromium.org, darin (slow to review), devtools-reviews_chromium.org, dglazkov+blink, dgrogan+ng_chromium.org, dominicc+watchlist_chromium.org, dominickn+watch_chromium.org, dshwang, drott+blinkwatch_chromium.org, krit, eae+blinkwatch, eric.carlson_apple.com, Eric Willigers, falken+watch_chromium.org, feature-media-reviews_chromium.org, f(malita), fs, gavinp+loader_chromium.org, glebl+reviews_chromium.org, gasubic, gogerald+paymentswatch_chromium.org, gyuyoung2, horo+watch_chromium.org, Nate Chapin, jbroman+watch_chromium.org, jbroman, jchaffraix+rendering, jsbell+serviceworker_chromium.org, Justin Novosad, kinuko+serviceworker, kinuko+fileapi, kinuko+watch, kinuko+worker_chromium.org, kouhei+svg_chromium.org, kozyatinskiy+blink_chromium.org, leviw+renderwatch, loading-reviews+parser_chromium.org, loading-reviews+fetch_chromium.org, loading-reviews_chromium.org, lushnikov+blink_chromium.org, michaeln, Mikhail, mlamouri+watch-blink_chromium.org, nhiroki, ojan+watch_chromium.org, pdr+graphicswatchlist_chromium.org, pdr+svgwatchlist_chromium.org, pdr+renderingwatchlist_chromium.org, pfeldman+blink_chromium.org, pkotwicz+watch_chromium.org, qsr+mojo_chromium.org, rjwright, rwlbuis, rouslan+payments_chromium.org, Stephen Chennney, sebsg+paymentswatch_chromium.org, serviceworker-reviews, shans, shimazu+serviceworker_chromium.org, shimazu+worker_chromium.org, sof, nessy, Srirama, szager+layoutwatch_chromium.org, toyoshim+midi_chromium.org, tyoshino+watch_chromium.org, tzik, viettrungluu+watch_chromium.org, yhirano+watch_chromium.org, Yoav Weiss, yzshen+watch_chromium.org, zoltan1, zpeng+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Replace WTF::emptyString{16Bit}() with a static global This is an extension of [1] which applies this approach to StringImpl. In that patch, a simple micro-benchmark testing: StringView("<some literal>") == StringView("<some literal>") in a tight loop is improved by 30% with this approach, as StringViews of literals are backed with empty StringImpls. To fix callers I ran: git grep -l "emptyString()" | xargs sed -i 's/emptyString()/emptyString/g' with 16 bit variants in third_party/WebKit/Source. Also note: The trick to make static strings without static constructors technically uses undefined behavior and breaks strict aliasing, see DEFINE_GLOBAL for details. [1] https://codereview.chromium.org/2655853003/ BUG=684604 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel Review-Url: https://codereview.chromium.org/2668903003 Cr-Commit-Position: refs/heads/master@{#447703} Committed: https://chromium.googlesource.com/chromium/src/+/166d82710cf7ee3212dd839e46547a3ce83e35aa

Patch Set 1 #

Patch Set 2 : Replace WTF::emptyString{16Bit}() with a static global #

Unified diffs Side-by-side diffs Delta from patch set Stats (+245 lines, -249 lines) Patch
M third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/V8StringResource.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/custom/V8XMLHttpRequestCustom.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializer.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/build/scripts/make_css_property_names.py View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/css/CSSSyntaxDescriptor.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/css/FontFace.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/css/StylePropertySerializer.cpp View 5 chunks +8 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSParserContext.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSParserContext.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/AttrTest.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/dom/CharacterData.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/CharacterData.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/DOMURLUtilsReadOnly.cpp View 1 chunk +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Document.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/Document.cpp View 3 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Element.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/dom/ExecutionContext.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/IconURL.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/PseudoElement.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/SelectorQuery.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp View 3 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Text.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/editing/InputMethodController.cpp View 3 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp View 6 chunks +14 lines, -14 lines 0 comments Download
M third_party/WebKit/Source/core/editing/Position.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp View 3 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/editing/markers/DocumentMarker.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/editing/serializers/Serialization.cpp View 1 chunk +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/events/ApplicationCacheErrorEvent.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/events/EventListener.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/events/InputEvent.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/frame/Deprecation.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/frame/LocalFrame.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/frame/NavigatorID.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/frame/SubresourceIntegrity.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/HTMLFormControlElement.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLInputElement.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/HTMLMarqueeElement.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/HTMLMediaElement.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/HTMLMediaElementTest.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/TextControlElement.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/html/forms/BaseTemporalInputType.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/forms/ChooserOnlyTemporalInputTypeView.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/forms/DateInputType.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/forms/DateTimeFieldsState.cpp View 1 chunk +9 lines, -10 lines 0 comments Download
M third_party/WebKit/Source/core/html/forms/DateTimeLocalInputType.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 3 chunks +21 lines, -19 lines 0 comments Download
M third_party/WebKit/Source/core/html/forms/MonthInputType.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/forms/MultipleFieldsTemporalInputTypeView.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/forms/NumberInputType.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/forms/TimeInputType.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/forms/WeekInputType.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/html/parser/TextResourceDecoder.cpp View 3 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/html/parser/XSSAuditor.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/shadow/DateTimeEditElement.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/shadow/DateTimeNumericFieldElement.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/shadow/DateTimeSymbolicFieldElement.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/track/vtt/VTTCue.cpp View 4 chunks +4 lines, -4 lines 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 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/html/track/vtt/VTTScannerTest.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp View 4 chunks +5 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutMenuList.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutQuote.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/layout/ng/ng_layout_inline_items_builder.cc View 3 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/loader/FormSubmission.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/loader/FrameLoader.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/page/CreateWindow.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/page/PagePopupController.cpp View 3 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/style/QuotesData.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/svg/SVGAnimationElement.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/svg/SVGEnumeration.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/svg/SVGPathParserTest.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/svg/SVGTransform.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/testing/DictionaryTest.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/testing/NullExecutionContext.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/xml/XSLStyleSheet.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/app_banner/AppBannerController.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/credentialmanager/FederatedCredential.h View 1 chunk +1 line, -1 line 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/filesystem/EntryBase.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/imagecapture/PhotoCapabilities.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/payments/PaymentAppManager.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerScriptCachedMetadataHandler.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/shapedetection/DetectedBarcode.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/shapedetection/DetectedText.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/webdatabase/Database.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/webgl/GLStringQuery.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/webmidi/MIDIPort.cpp View 3 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/modules/webshare/NavigatorShare.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/websockets/WebSocketHandleImpl.cpp View 3 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/SharedBufferChunkReader.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/fonts/OrientationIteratorTest.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/ScriptRunIteratorTest.cpp View 4 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/SmallCapsIteratorTest.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/SymbolsIteratorTest.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/shaping/RunSegmenterTest.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/loader/fetch/MemoryCache.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/mojo/KURLStructTraits.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/network/HTTPParsersTest.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/text/LocaleICU.cpp View 1 chunk +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/text/LocaleWin.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/weborigin/KURL.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/weborigin/KnownPorts.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp View 2 chunks +5 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/web/tests/KeyboardTest.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/wtf/text/StringBuilder.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/StringBuilderTest.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/StringStatics.cpp View 2 chunks +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/StringView.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/wtf/text/StringViewTest.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/wtf/text/TextCodecLatin1.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/wtf/text/WTFString.h View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/WTFString.cpp View 4 chunks +3 lines, -13 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/WTFStringTest.cpp View 2 chunks +2 lines, -2 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 33 (19 generated)
Charlie Harrison
esprehn: PTAL. The only non-trivial changes (i.e. non-sed based changed) are in WTFString and StringStatics. ...
3 years, 10 months ago (2017-02-01 16:18:43 UTC) #10
esprehn
lgtm
3 years, 10 months ago (2017-02-01 16:24:06 UTC) #11
haraken
LGTM
3 years, 10 months ago (2017-02-01 16:32:37 UTC) #12
Charlie Harrison
Thanks, I think I need IPC folk for the mojo stuff, +dcheng?
3 years, 10 months ago (2017-02-01 17:01:39 UTC) #14
esprehn
On 2017/02/01 at 17:01:39, csharrison wrote: > Thanks, I think I need IPC folk for ...
3 years, 10 months ago (2017-02-01 17:14:16 UTC) #15
Charlie Harrison
On 2017/02/01 17:14:16, esprehn wrote: > On 2017/02/01 at 17:01:39, csharrison wrote: > > Thanks, ...
3 years, 10 months ago (2017-02-01 17:20:58 UTC) #16
dcheng
Is the gain here because we don't have to bounce through a function-local static? It ...
3 years, 10 months ago (2017-02-01 17:30:56 UTC) #17
Charlie Harrison
Hm, nameStorage has type void*, and we dereference *reinterpret_cast<String*>(&nameStorage) which is dereferences &nameStorage as a ...
3 years, 10 months ago (2017-02-01 17:56:16 UTC) #19
dcheng
On 2017/02/01 17:56:16, Charlie Harrison-slow til Feb3 wrote: > Hm, nameStorage has type void*, and ...
3 years, 10 months ago (2017-02-01 17:58:33 UTC) #20
esprehn
This is the same thing we do for all the fooAtom constants and tag names ...
3 years, 10 months ago (2017-02-01 20:32:45 UTC) #21
dcheng
LGTM As discussed, let's include the benchmark numbers in the CL description and mentions that ...
3 years, 10 months ago (2017-02-02 05:30:35 UTC) #22
Charlie Harrison
Alright, I've updated the description. Thanks for the review
3 years, 10 months ago (2017-02-02 05:56:00 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2668903003/20001
3 years, 10 months ago (2017-02-02 05:56:35 UTC) #29
commit-bot: I haz the power
3 years, 10 months ago (2017-02-02 06:10:22 UTC) #33
Message was sent while issue was closed.
Committed patchset #2 (id:20001) as
https://chromium.googlesource.com/chromium/src/+/166d82710cf7ee3212dd839e4654...

Powered by Google App Engine
This is Rietveld 408576698