Micro-optimize elementAffectsDirectionality().
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Feb 2014 23:18:26 +0000 (23:18 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Feb 2014 23:18:26 +0000 (23:18 +0000)
<https://webkit.org/b/129444>

Tweak this function to skip an unnecessary bit check and use
fastHasAttribute() instead of hasAttribute() for looking up dirAttr.

~1% speedup on DYEB/AngularJS.

Reviewed by Ryosuke Niwa.

* html/HTMLElement.cpp:
(WebCore::elementAffectsDirectionality):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@164833 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/html/HTMLElement.cpp

index 64805d7fa1e90b1fe0f6c62c6a83c178b5c002ab..298aa04e0166aea96aecb655b3e5a49252f46264 100644 (file)
@@ -1,3 +1,18 @@
+2014-02-27  Andreas Kling  <akling@apple.com>
+
+        Micro-optimize elementAffectsDirectionality().
+        <https://webkit.org/b/129444>
+
+        Tweak this function to skip an unnecessary bit check and use
+        fastHasAttribute() instead of hasAttribute() for looking up dirAttr.
+
+        ~1% speedup on DYEB/AngularJS.
+
+        Reviewed by Ryosuke Niwa.
+
+        * html/HTMLElement.cpp:
+        (WebCore::elementAffectsDirectionality):
+
 2014-02-27  Brian Burg  <bburg@apple.com>
 
         Web Inspector: model tests should use a special Test.html inspector page
index cd2b350172eca1349b3c2bb086850a39bd0cb061..f187d44f165238f7251bc8a05011927502b3b16d 100644 (file)
@@ -817,7 +817,7 @@ HTMLFormElement* HTMLElement::virtualForm() const
 
 static inline bool elementAffectsDirectionality(const Node& node)
 {
-    return node.isHTMLElement() && (node.hasTagName(bdiTag) || toHTMLElement(node).hasAttribute(dirAttr));
+    return node.isHTMLElement() && (toHTMLElement(node).hasTagName(bdiTag) || toHTMLElement(node).fastHasAttribute(dirAttr));
 }
 
 static void setHasDirAutoFlagRecursively(Node* firstNode, bool flag, Node* lastNode = nullptr)