Bug 256435 - AX: De-virtualize AXCoreObject::isDetachedFromParent
Summary: AX: De-virtualize AXCoreObject::isDetachedFromParent
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tyler Wilcock
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-05-07 16:02 PDT by Tyler Wilcock
Modified: 2023-05-08 06:48 PDT (History)
10 users (show)

See Also:


Attachments
Patch (10.66 KB, patch)
2023-05-07 16:16 PDT, Tyler Wilcock
andresg_22: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tyler Wilcock 2023-05-07 16:02:32 PDT
This function is called in hot paths and takes non-insignificant amounts of time in samples.
Comment 1 Radar WebKit Bug Importer 2023-05-07 16:02:45 PDT
<rdar://problem/109018200>
Comment 2 Tyler Wilcock 2023-05-07 16:16:36 PDT
Created attachment 466266 [details]
Patch
Comment 3 Andres Gonzalez 2023-05-08 06:47:40 PDT
(In reply to Tyler Wilcock from comment #2)
> Created attachment 466266 [details]
> Patch

--- a/Source/WebCore/accessibility/AccessibilityMockObject.cpp
+++ b/Source/WebCore/accessibility/AccessibilityMockObject.cpp


+void AccessibilityMockObject::setParent(AccessibilityObject* parent)
+{
+    m_parent = parent;
+    m_isDetachedFromParent = !parent;
+}

Do we even need to keep m_isDetachedFromParent? I'd think that we could tell whether has a parent or not just by checking m_parent.

--- a/Source/WebCore/accessibility/AccessibilityObjectInterface.h
+++ b/Source/WebCore/accessibility/AccessibilityObjectInterface.h

-    virtual bool isDetachedFromParent() = 0;
+    // Intentionally non-virtual because this is called in hot paths.
+    bool isDetachedFromParent() const { return m_isDetachedFromParent; }

Again, don't think we need m_isDetachedFromParent, check for the parent instead.