Title: [294980] trunk/Source/WebCore/dom
Revision
294980
Author
cdu...@apple.com
Date
2022-05-27 20:16:46 -0700 (Fri, 27 May 2022)

Log Message

Remove some unnecessary work from the Node destructor
https://bugs.webkit.org/show_bug.cgi?id=241035

Reviewed by Geoffrey Garen.

Remove some unnecessary work from the Node destructor as it shows on
Speedometer profiles.

In particular, stop calling clearRareData() as this is just clearing a data
member. Also move work that only applies to non-ContainerNode to the Text
and CharacterData destructors since those are the only two non-ContainerNodes.

* Source/WebCore/dom/Attr.cpp:
(WebCore::Attr::~Attr):
* Source/WebCore/dom/CharacterData.cpp:
(WebCore::CharacterData::~CharacterData):
* Source/WebCore/dom/CharacterData.h:
* Source/WebCore/dom/Node.cpp:
(WebCore::Node::~Node):

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/dom/Attr.cpp (294979 => 294980)


--- trunk/Source/WebCore/dom/Attr.cpp	2022-05-28 03:13:21 UTC (rev 294979)
+++ trunk/Source/WebCore/dom/Attr.cpp	2022-05-28 03:16:46 UTC (rev 294980)
@@ -71,6 +71,8 @@
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!isInShadowTree());
     ASSERT_WITH_SECURITY_IMPLICATION(treeScope().rootNode().isDocumentNode());
+
+    willBeDeletedFrom(document());
 }
 
 ExceptionOr<void> Attr::setPrefix(const AtomString& prefix)

Modified: trunk/Source/WebCore/dom/CharacterData.cpp (294979 => 294980)


--- trunk/Source/WebCore/dom/CharacterData.cpp	2022-05-28 03:13:21 UTC (rev 294979)
+++ trunk/Source/WebCore/dom/CharacterData.cpp	2022-05-28 03:16:46 UTC (rev 294980)
@@ -42,6 +42,11 @@
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(CharacterData);
 
+CharacterData::~CharacterData()
+{
+    willBeDeletedFrom(document());
+}
+
 static bool canUseSetDataOptimization(const CharacterData& node)
 {
     auto& document = node.document();

Modified: trunk/Source/WebCore/dom/CharacterData.h (294979 => 294980)


--- trunk/Source/WebCore/dom/CharacterData.h	2022-05-28 03:13:21 UTC (rev 294979)
+++ trunk/Source/WebCore/dom/CharacterData.h	2022-05-28 03:16:46 UTC (rev 294980)
@@ -52,6 +52,8 @@
         ASSERT(type == CreateCharacterData || type == CreateText || type == CreateEditingText);
     }
 
+    ~CharacterData();
+
     void setDataWithoutUpdate(const String& data)
     {
         ASSERT(!data.isNull());

Modified: trunk/Source/WebCore/dom/Node.cpp (294979 => 294980)


--- trunk/Source/WebCore/dom/Node.cpp	2022-05-28 03:13:21 UTC (rev 294979)
+++ trunk/Source/WebCore/dom/Node.cpp	2022-05-28 03:16:46 UTC (rev 294980)
@@ -369,21 +369,14 @@
     liveNodeSet().remove(*this);
 #endif
 
-    RELEASE_ASSERT(!renderer());
+    ASSERT(!renderer());
     ASSERT(!parentNode());
     ASSERT(!m_previous);
     ASSERT(!m_next);
 
-    if (hasRareData())
-        clearRareData();
-
-    auto* textManipulationController = document().textManipulationControllerIfExists();
-    if (UNLIKELY(textManipulationController))
+    if (auto* textManipulationController = document().textManipulationControllerIfExists(); UNLIKELY(textManipulationController))
         textManipulationController->removeNode(*this);
 
-    if (!isContainerNode())
-        willBeDeletedFrom(document());
-
     if (hasEventTargetData())
         clearEventTargetData();
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to