[webkit-changes] [WebKit/WebKit] f70bfc: Merge isXMLSpace() into isJSONOrHTTPWhitespace()

Anne van Kesteren noreply at github.com
Mon Jul 24 10:24:40 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f70bfc73d58cb05654edbe416adde6bb63804c79
      https://github.com/WebKit/WebKit/commit/f70bfc73d58cb05654edbe416adde6bb63804c79
  Author: Anne van Kesteren <annevk at annevk.nl>
  Date:   2023-07-24 (Mon, 24 Jul 2023)

  Changed paths:
    M Source/WTF/wtf/ASCIICType.h
    M Source/WTF/wtf/JSONValues.cpp
    M Source/WTF/wtf/text/StringToIntegerConversion.h
    M Source/WebCore/Modules/cache/DOMCache.cpp
    M Source/WebCore/Modules/cache/DOMCacheEngine.cpp
    M Source/WebCore/Modules/fetch/FetchBodyConsumer.cpp
    M Source/WebCore/Modules/fetch/FetchHeaders.cpp
    M Source/WebCore/mathml/MathMLPresentationElement.cpp
    M Source/WebCore/mathml/MathMLTokenElement.cpp
    M Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp
    M Source/WebCore/platform/ReferrerPolicy.cpp
    M Source/WebCore/platform/network/DataURLDecoder.cpp
    M Source/WebCore/platform/network/HTTPParsers.cpp
    M Source/WebCore/platform/network/HTTPParsers.h
    M Source/WebCore/platform/network/ParsedContentType.cpp
    M Source/WebCore/platform/network/ResourceResponseBase.cpp
    M Source/WebCore/platform/network/TimingAllowOrigin.cpp
    M Source/WebCore/xml/XMLHttpRequest.cpp
    M Source/WebCore/xml/XPathFunctions.cpp
    M Source/WebCore/xml/XPathParser.cpp
    M Source/WebCore/xml/XPathUtil.cpp
    M Source/WebCore/xml/XPathUtil.h
    M Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp
    M Source/WebKit/NetworkProcess/soup/WebSocketTaskSoup.cpp
    M Source/WebKit/NetworkProcess/storage/CacheStorageRecord.h
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp

  Log Message:
  -----------
  Merge isXMLSpace() into isJSONOrHTTPWhitespace()
https://bugs.webkit.org/show_bug.cgi?id=255872
rdar://108738795

Reviewed by Darin Adler.

It turns out that JSON, HTTP, and XML all use the same whitespace
definition, so let's make them share it. Also correct an existing
comment for that function as \v is not part of isASCIIWhitespace(), but
\f is.

Furthermore, remove the "optimization" from these whitespace functions
per a comment from Chris Dumez at
https://github.com/WebKit/WebKit/pull/13080#discussion_r1174653845:

> Just verified out of curiosity and llvm does generate the same code
> with -O2 (tried both arm64 and x86_64):
>
> isXMLSpace1(char):                       // @isXMLSpace1(char)
>         mov     x8, #9728                       // =0x2600
>         and     w9, w0, #0xff
>         movk    x8, #1, lsl #32
>         cmp     w9, #33
>         cset    w9, lo
>         lsr     x8, x8, x0
>         and     w0, w9, w8
>         ret
> isXMLSpace2(char):                       // @isXMLSpace2(char)
>         mov     x8, #9728                       // =0x2600
>         and     w9, w0, #0xff
>         movk    x8, #1, lsl #32
>         cmp     w9, #33
>         cset    w9, lo
>         lsr     x8, x8, x0
>         and     w0, w9, w8
>         ret
>
> Ahmad-S792 Let's simplify the code then.

* Source/WTF/wtf/ASCIICType.h:
(WTF::isASCIIWhitespace):
(WTF::isJSONOrHTTPOrXMLWhitespace):
(WTF::isJSONOrHTTPWhitespace): Deleted.
* Source/WTF/wtf/JSONValues.cpp:
(WTF::JSONImpl::Value::parseJSON):
* Source/WTF/wtf/text/StringToIntegerConversion.h:
* Source/WebCore/Modules/cache/DOMCache.cpp:
(WebCore::hasResponseVaryStarHeaderValue):
* Source/WebCore/Modules/cache/DOMCacheEngine.cpp:
(WebCore::DOMCacheEngine::queryCacheMatch):
* Source/WebCore/Modules/fetch/FetchBodyConsumer.cpp:
(WebCore::parseParameters):
(WebCore::parseMIMEType):
(WebCore::FetchBodyConsumer::packageFormData):
* Source/WebCore/Modules/fetch/FetchHeaders.cpp:
(WebCore::canWriteHeader):
(WebCore::appendToHeaderMap):
(WebCore::FetchHeaders::set):
(WebCore::FetchHeaders::filterAndFill):
* Source/WebCore/mathml/MathMLPresentationElement.cpp:
(WebCore::MathMLPresentationElement::parseMathMLLength):
* Source/WebCore/mathml/MathMLTokenElement.cpp:
(WebCore::MathMLTokenElement::convertToSingleCodePoint):
* Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp:
(WebCore::ContentSecurityPolicyDirectiveList::parse):
* Source/WebCore/platform/ReferrerPolicy.cpp:
(WebCore::parseReferrerPolicy):
* Source/WebCore/platform/network/DataURLDecoder.cpp:
(WebCore::DataURLDecoder::DecodeTask::process):
* Source/WebCore/platform/network/HTTPParsers.cpp:
(WebCore::parseContentTypeOptionsHeader):
(WebCore::parseClearSiteDataHeader):
(WebCore::parseRange):
(WebCore::parseCrossOriginResourcePolicyHeader):
* Source/WebCore/platform/network/HTTPParsers.h:
(WebCore::addToAccessControlAllowList):
* Source/WebCore/platform/network/ParsedContentType.cpp:
(WebCore::skipSpaces):
(WebCore::parseToken):
(WebCore::ParsedContentType::create):
(WebCore::ParsedContentType::setContentType):
* Source/WebCore/platform/network/ResourceResponseBase.cpp:
(WebCore::ResourceResponseBase::containsInvalidHTTPHeaders const):
* Source/WebCore/platform/network/TimingAllowOrigin.cpp:
(WebCore::passesTimingAllowOriginCheck):
* Source/WebCore/xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::setRequestHeader):
* Source/WebCore/xml/XPathFunctions.cpp:
(WebCore::XPath::FunNormalizeSpace::evaluate const):
* Source/WebCore/xml/XPathParser.cpp:
(WebCore::XPath::Parser::skipWS):
* Source/WebCore/xml/XPathUtil.cpp:
(WebCore::XPath::isXMLSpace): Deleted.
* Source/WebCore/xml/XPathUtil.h:
* Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp:
(WebKit::CacheStorage::updateVaryInformation):
* Source/WebKit/NetworkProcess/soup/WebSocketTaskSoup.cpp:
(WebKit::WebSocketTask::WebSocketTask):
* Source/WebKit/NetworkProcess/storage/CacheStorageRecord.h:
(WebKit::CacheStorageRecordInformation::updateVaryHeaders):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::shouldSkipDecidePolicyForResponse const):

Canonical link: https://commits.webkit.org/266253@main




More information about the webkit-changes mailing list