[webkit-changes] [WebKit/WebKit] 855b9c: Use StringView in CSSParserToken and simplify its ...
Chris Dumez
noreply at github.com
Mon Oct 2 20:09:49 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 855b9cf6ef5a2b8b5ead0d06314779d7fd1884fc
https://github.com/WebKit/WebKit/commit/855b9cf6ef5a2b8b5ead0d06314779d7fd1884fc
Author: Chris Dumez <cdumez at apple.com>
Date: 2023-10-02 (Mon, 02 Oct 2023)
Changed paths:
M Source/WTF/wtf/text/StringView.cpp
M Source/WTF/wtf/text/StringView.h
M Source/WebCore/css/CSSVariableData.cpp
M Source/WebCore/css/parser/CSSParserToken.cpp
M Source/WebCore/css/parser/CSSParserToken.h
Log Message:
-----------
Use StringView in CSSParserToken and simplify its code
https://bugs.webkit.org/show_bug.cgi?id=262498
Reviewed by Darin Adler.
Use StringView in CSSParserToken and simplify its code.
Previously, CSSParserToken wasn't using StringView internally for better bit packing,
as the size of this object matters a lot. Instead, do better bit packing in StringView
so that CSSParserToken can use it without increasing its size (24 bits on my
macBookPro M1).
To better bit-pack StringView, we rely on PackedPtr to fit the is8Bit flag in the same
word as the character pointer.
This is performance neutral on Speedometer.
* Source/WTF/wtf/text/StringView.cpp:
(WTF::StringView::convertToASCIILowercase const):
(WTF::StringView::convertToASCIIUppercase const):
* Source/WTF/wtf/text/StringView.h:
(WTF::StringView::StringView):
(WTF::StringView::characters8 const):
(WTF::StringView::characters16 const):
* Source/WebCore/css/CSSVariableData.cpp:
(WebCore::CSSVariableData::updateBackingStringsInTokens):
* Source/WebCore/css/parser/CSSParserToken.cpp:
(WebCore::CSSParserToken::CSSParserToken):
(WebCore::CSSParserToken::convertToDimensionWithUnit):
(WebCore::CSSParserToken::copyWithUpdatedString const):
* Source/WebCore/css/parser/CSSParserToken.h:
(WebCore::CSSParserToken::value const):
(WebCore::CSSParserToken::updateString):
(WebCore::CSSParserToken::initValueFromStringView): Deleted.
(WebCore::CSSParserToken::updateCharacters): Deleted.
Canonical link: https://commits.webkit.org/268760@main
More information about the webkit-changes
mailing list