[webkit-changes] [WebKit/WebKit] 871823: Inline NodeType in C++ side

Ryosuke Niwa noreply at github.com
Sat Dec 23 15:35:12 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 871823510e94736614a4c2b1d1610648ddc1da6e
      https://github.com/WebKit/WebKit/commit/871823510e94736614a4c2b1d1610648ddc1da6e
  Author: Ryosuke Niwa <rniwa at webkit.org>
  Date:   2023-12-23 (Sat, 23 Dec 2023)

  Changed paths:
    M Source/WebCore/dom/Attr.cpp
    M Source/WebCore/dom/Attr.h
    M Source/WebCore/dom/CDATASection.cpp
    M Source/WebCore/dom/CDATASection.h
    M Source/WebCore/dom/CharacterData.h
    M Source/WebCore/dom/Comment.cpp
    M Source/WebCore/dom/Comment.h
    M Source/WebCore/dom/ContainerNode.h
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Document.h
    M Source/WebCore/dom/DocumentFragment.cpp
    M Source/WebCore/dom/DocumentFragment.h
    M Source/WebCore/dom/DocumentType.cpp
    M Source/WebCore/dom/DocumentType.h
    M Source/WebCore/dom/Element.cpp
    M Source/WebCore/dom/Element.h
    M Source/WebCore/dom/Node.cpp
    M Source/WebCore/dom/Node.h
    M Source/WebCore/dom/ProcessingInstruction.cpp
    M Source/WebCore/dom/ProcessingInstruction.h
    M Source/WebCore/dom/TemplateContentDocumentFragment.h
    M Source/WebCore/dom/Text.cpp
    M Source/WebCore/dom/Text.h

  Log Message:
  -----------
  Inline NodeType in C++ side
https://bugs.webkit.org/show_bug.cgi?id=266829

Reviewed by Chris Dumez.

This PR inlines Node::nodeType in Node.h by using the remaining bits in m_typeFlags.
To do this optimization, we take the advantage of the fact nodeType is now fast to obtain,
and replace two of the existing TypeFlags (IsDocumentFragment and IsText) in favor of
checking nodeType instead.

* Source/WebCore/dom/Attr.cpp:
(WebCore::Attr::Attr):
* Source/WebCore/dom/Attr.h:
* Source/WebCore/dom/CDATASection.cpp:
(WebCore::CDATASection::CDATASection):
(WebCore::CDATASection::nodeType const): Deleted.
* Source/WebCore/dom/CDATASection.h:
* Source/WebCore/dom/CharacterData.h:
(WebCore::CharacterData::CharacterData):
* Source/WebCore/dom/Comment.cpp:
(WebCore::Comment::Comment):
(WebCore::Comment::nodeType const): Deleted.
* Source/WebCore/dom/Comment.h:
* Source/WebCore/dom/ContainerNode.h:
(WebCore::ContainerNode::ContainerNode):
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::nodeType const): Deleted.
* Source/WebCore/dom/Document.h:
* Source/WebCore/dom/DocumentFragment.cpp:
(WebCore::DocumentFragment::DocumentFragment):
(WebCore::DocumentFragment::create):
(WebCore::DocumentFragment::createForInnerOuterHTML):
(WebCore::DocumentFragment::nodeType const): Deleted.
* Source/WebCore/dom/DocumentFragment.h:
* Source/WebCore/dom/DocumentType.cpp:
(WebCore::DocumentType::DocumentType):
(WebCore::DocumentType::nodeType const): Deleted.
* Source/WebCore/dom/DocumentType.h:
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::Element):
(WebCore::Element::nodeType const): Deleted.
* Source/WebCore/dom/Element.h:
* Source/WebCore/dom/Node.cpp:
(WebCore::Node::Node):
* Source/WebCore/dom/Node.h:
(WebCore::Node::nodeType const):
(WebCore::Node::isDocumentNode const):
(WebCore::Node::isTreeScope const):
(WebCore::Node::isDocumentFragment const):
(WebCore::Node::typeFlagsMemoryOffset):
(WebCore::Node::constructBitFieldsFromNodeTypeAndFlags):
(WebCore::Node::nodeTypeFromBitFields):
(WebCore::Node::hasTypeFlag const):
* Source/WebCore/dom/ProcessingInstruction.cpp:
(WebCore::ProcessingInstruction::ProcessingInstruction):
(WebCore::ProcessingInstruction::nodeType const): Deleted.
* Source/WebCore/dom/ProcessingInstruction.h:
* Source/WebCore/dom/TemplateContentDocumentFragment.h:
* Source/WebCore/dom/Text.cpp:
(WebCore::Text::create):
(WebCore::Text::createEditingText):
(WebCore::Text::nodeType const): Deleted.
* Source/WebCore/dom/Text.h:
(WebCore::Text::Text):

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




More information about the webkit-changes mailing list