1

Inline NodeType in C++ side · WebKit/WebKit@8718235 · GitHub

 1 month ago
source link: https://github.com/WebKit/WebKit/commit/871823510e94736614a4c2b1d1610648ddc1da6e
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Commit

Permalink

Inline NodeType in C++ side

Browse files Browse the repository at this point in the history

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
rniwa committed Dec 23, 2023
1 parent 97b4d91 commit 8718235

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK