Title: [123243] trunk/Source/WebCore
- Revision
- 123243
- Author
- [email protected]
- Date
- 2012-07-20 11:28:24 -0700 (Fri, 20 Jul 2012)
Log Message
REGRESSION(r122873): 15% regression on Dromaeo/dom-attr
https://bugs.webkit.org/show_bug.cgi?id=91827
Reviewed by Anders Carlsson.
Move shouldInvalidateNodeListCaches from Document.cpp to Node.cpp since it's only called
in Node::invalidateNodeListCachesInAncestors.
Test: PerformanceTests/Dromaeo/dom-attr.html.
* dom/Document.cpp:
(WebCore):
* dom/Node.cpp:
(WebCore::shouldInvalidateNodeListCachesForAttr): Extracted from shouldInvalidateNodeListCaches
to unroll the loop in shouldInvalidateNodeListCaches. Apparently gcc wasn't doing the right thing.
(WebCore::Document::shouldInvalidateNodeListCaches):
(WebCore::Document::invalidateNodeListCaches):
(WebCore::Node::invalidateNodeListCachesInAncestors):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (123242 => 123243)
--- trunk/Source/WebCore/ChangeLog 2012-07-20 18:27:06 UTC (rev 123242)
+++ trunk/Source/WebCore/ChangeLog 2012-07-20 18:28:24 UTC (rev 123243)
@@ -1,3 +1,24 @@
+2012-07-20 Ryosuke Niwa <[email protected]>
+
+ REGRESSION(r122873): 15% regression on Dromaeo/dom-attr
+ https://bugs.webkit.org/show_bug.cgi?id=91827
+
+ Reviewed by Anders Carlsson.
+
+ Move shouldInvalidateNodeListCaches from Document.cpp to Node.cpp since it's only called
+ in Node::invalidateNodeListCachesInAncestors.
+
+ Test: PerformanceTests/Dromaeo/dom-attr.html.
+
+ * dom/Document.cpp:
+ (WebCore):
+ * dom/Node.cpp:
+ (WebCore::shouldInvalidateNodeListCachesForAttr): Extracted from shouldInvalidateNodeListCaches
+ to unroll the loop in shouldInvalidateNodeListCaches. Apparently gcc wasn't doing the right thing.
+ (WebCore::Document::shouldInvalidateNodeListCaches):
+ (WebCore::Document::invalidateNodeListCaches):
+ (WebCore::Node::invalidateNodeListCachesInAncestors):
+
2012-07-20 Nico Weber <[email protected]>
Fix more -Wunused-private-field violations
Modified: trunk/Source/WebCore/dom/Document.cpp (123242 => 123243)
--- trunk/Source/WebCore/dom/Document.cpp 2012-07-20 18:27:06 UTC (rev 123242)
+++ trunk/Source/WebCore/dom/Document.cpp 2012-07-20 18:28:24 UTC (rev 123243)
@@ -3900,31 +3900,6 @@
}
}
-bool Document::shouldInvalidateNodeListCaches(const QualifiedName* attrName) const
-{
- if (attrName) {
- for (int type = DoNotInvalidateOnAttributeChanges + 1; type < numNodeListInvalidationTypes; type++) {
- if (m_nodeListCounts[type] && DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChange(static_cast<NodeListInvalidationType>(type), *attrName))
- return true;
- }
- return false;
- }
-
- for (int type = 0; type < numNodeListInvalidationTypes; type++) {
- if (m_nodeListCounts[type])
- return true;
- }
-
- return false;
-}
-
-void Document::invalidateNodeListCaches(const QualifiedName* attrName)
-{
- HashSet<DynamicNodeListCacheBase*>::iterator end = m_listsInvalidatedAtDocument.end();
- for (HashSet<DynamicNodeListCacheBase*>::iterator it = m_listsInvalidatedAtDocument.begin(); it != end; ++it)
- (*it)->invalidateCache(attrName);
-}
-
void Document::attachNodeIterator(NodeIterator* ni)
{
m_nodeIterators.add(ni);
Modified: trunk/Source/WebCore/dom/Node.cpp (123242 => 123243)
--- trunk/Source/WebCore/dom/Node.cpp 2012-07-20 18:27:06 UTC (rev 123242)
+++ trunk/Source/WebCore/dom/Node.cpp 2012-07-20 18:28:24 UTC (rev 123243)
@@ -927,6 +927,40 @@
return count;
}
+template<unsigned type>
+bool shouldInvalidateNodeListCachesForAttr(const unsigned nodeListCounts[], const QualifiedName& attrName)
+{
+ if (nodeListCounts[type] && DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChange(static_cast<NodeListInvalidationType>(type), attrName))
+ return true;
+ return shouldInvalidateNodeListCachesForAttr<type + 1>(nodeListCounts, attrName);
+}
+
+template<>
+bool shouldInvalidateNodeListCachesForAttr<numNodeListInvalidationTypes>(const unsigned[], const QualifiedName&)
+{
+ return false;
+}
+
+bool Document::shouldInvalidateNodeListCaches(const QualifiedName* attrName) const
+{
+ if (attrName)
+ return shouldInvalidateNodeListCachesForAttr<DoNotInvalidateOnAttributeChanges + 1>(m_nodeListCounts, *attrName);
+
+ for (int type = 0; type < numNodeListInvalidationTypes; type++) {
+ if (m_nodeListCounts[type])
+ return true;
+ }
+
+ return false;
+}
+
+void Document::invalidateNodeListCaches(const QualifiedName* attrName)
+{
+ HashSet<DynamicNodeListCacheBase*>::iterator end = m_listsInvalidatedAtDocument.end();
+ for (HashSet<DynamicNodeListCacheBase*>::iterator it = m_listsInvalidatedAtDocument.begin(); it != end; ++it)
+ (*it)->invalidateCache(attrName);
+}
+
void Node::invalidateNodeListCachesInAncestors(const QualifiedName* attrName, Element* attributeOwnerElement)
{
if (hasRareData() && (!attrName || isAttributeNode()))
@@ -936,7 +970,7 @@
if (attrName && !attributeOwnerElement)
return;
- if (!document()->shouldInvalidateNodeListCaches())
+ if (!document()->shouldInvalidateNodeListCaches(attrName))
return;
document()->invalidateNodeListCaches(attrName);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes