Changeset 117353 in webkit
- Timestamp:
- May 16, 2012 3:25:10 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r117339 r117353 1 2012-05-16 Ojan Vafai <ojan@chromium.org> 2 3 Fix perf regression from r116487 4 https://bugs.webkit.org/show_bug.cgi?id=86680 5 6 Reviewed by Ryosuke Niwa. 7 8 http://trac.webkit.org/changeset/116487 caused a 6% regression on 9 Dromaeo's dom-attr test. The issue is that we invalidated NodeList 10 caches whenever an id/checked/type attribute changed. 11 12 First, we don't need to invalidate on checked/type since that only 13 affects the values return by NodeList items, not the list of items. 14 Second, we only need to invalidate NodeList caches when an id attribute 15 changes on a FormControlElement. 16 17 Incidentally, we also don't need to invalidate caches for changes 18 to attributes that don't have an ownerElement. 19 20 No new tests. This is strictly a performance improvement. 21 22 * dom/Attr.cpp: 23 (WebCore::Attr::setValue): 24 (WebCore::Attr::childrenChanged): 25 * dom/Element.cpp: 26 (WebCore::Element::attributeChanged): 27 * dom/Node.cpp: 28 (WebCore::Node::invalidateNodeListsCacheAfterAttributeChanged): 29 * dom/Node.h: 30 (Node): 31 1 32 2012-04-22 Robert Hogan <robert@webkit.org> 2 33 -
trunk/Source/WebCore/dom/Attr.cpp
r117195 r117353 120 120 m_ignoreChildrenChanged--; 121 121 122 invalidateNodeListsCacheAfterAttributeChanged(m_name );122 invalidateNodeListsCacheAfterAttributeChanged(m_name, m_element); 123 123 } 124 124 … … 163 163 return; 164 164 165 invalidateNodeListsCacheAfterAttributeChanged(qualifiedName() );165 invalidateNodeListsCacheAfterAttributeChanged(qualifiedName(), m_element); 166 166 167 167 // FIXME: We should include entity references in the value -
trunk/Source/WebCore/dom/Element.cpp
r117323 r117353 717 717 } 718 718 719 invalidateNodeListsCacheAfterAttributeChanged(attribute.name() );719 invalidateNodeListsCacheAfterAttributeChanged(attribute.name(), this); 720 720 721 721 if (!AXObjectCache::accessibilityEnabled()) -
trunk/Source/WebCore/dom/Node.cpp
r117210 r117353 977 977 } 978 978 979 void Node::invalidateNodeListsCacheAfterAttributeChanged(const QualifiedName& attrName )979 void Node::invalidateNodeListsCacheAfterAttributeChanged(const QualifiedName& attrName, Element* attributeOwnerElement) 980 980 { 981 981 if (hasRareData() && isAttributeNode()) { … … 985 985 } 986 986 987 // This list should be sync'ed with NodeListsNodeData. 987 // Modifications to attributes that are not associated with an Element can't invalidate NodeList caches. 988 if (!attributeOwnerElement) 989 return; 990 991 // FIXME: Move the list of attributes each NodeList type cares about to be a static on the 992 // appropriate NodeList class. Then use those lists here and in invalidateCachesThatDependOnAttributes 993 // to only invalidate the cache types that depend on the attribute that changed. 994 // FIXME: Keep track of when we have no caches of a given type so that we can avoid the for-loop 995 // below even if a related attribute changed (e.g. if we have no RadioNodeLists, we don't need 996 // to invalidate any caches when id attributes change.) 988 997 if (attrName != classAttr 989 998 #if ENABLE(MICRODATA) … … 992 1001 && attrName != itemtypeAttr 993 1002 #endif 994 && attrName != idAttr995 && attrName != typeAttr996 && attrName != checkedAttr997 1003 && attrName != nameAttr 998 && attrName != forAttr) 1004 && attrName != forAttr 1005 && (attrName != idAttr || !attributeOwnerElement->isFormControlElement())) 999 1006 return; 1000 1007 -
trunk/Source/WebCore/dom/Node.h
r117323 r117353 558 558 void registerDynamicSubtreeNodeList(DynamicSubtreeNodeList*); 559 559 void unregisterDynamicSubtreeNodeList(DynamicSubtreeNodeList*); 560 void invalidateNodeListsCacheAfterAttributeChanged(const QualifiedName& );560 void invalidateNodeListsCacheAfterAttributeChanged(const QualifiedName&, Element* attributeOwnerElement); 561 561 void invalidateNodeListsCacheAfterChildrenChanged(); 562 562 void removeCachedClassNodeList(ClassNodeList*, const String&);
Note: See TracChangeset
for help on using the changeset viewer.