Title: [160829] trunk/Source/WebCore
Revision
160829
Author
[email protected]
Date
2013-12-19 05:59:11 -0800 (Thu, 19 Dec 2013)

Log Message

Two small refinements to matched properties cache.
<https://webkit.org/b/125992>

- Avoid computing the matched properties hash if we're banned from
  using the cache anyway.

- When adding a new entry to the cache, use move semantics to avoid
  creating a transient copy of all the data.

Reviewed by Antti Koivisto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (160828 => 160829)


--- trunk/Source/WebCore/ChangeLog	2013-12-19 12:15:44 UTC (rev 160828)
+++ trunk/Source/WebCore/ChangeLog	2013-12-19 13:59:11 UTC (rev 160829)
@@ -1,5 +1,18 @@
 2013-12-19  Andreas Kling  <[email protected]>
 
+        Two small refinements to matched properties cache.
+        <https://webkit.org/b/125992>
+
+        - Avoid computing the matched properties hash if we're banned from
+          using the cache anyway.
+
+        - When adding a new entry to the cache, use move semantics to avoid
+          creating a transient copy of all the data.
+
+        Reviewed by Antti Koivisto.
+
+2013-12-19  Andreas Kling  <[email protected]>
+
         CascadedProperties should use a bitset to track property presence.
         <https://webkit.org/b/125991>
 

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (160828 => 160829)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2013-12-19 12:15:44 UTC (rev 160828)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2013-12-19 13:59:11 UTC (rev 160829)
@@ -1735,7 +1735,7 @@
     // The RenderStyle in the cache is really just a holder for the substructures and never used as-is.
     cacheItem.renderStyle = RenderStyle::clone(style);
     cacheItem.parentRenderStyle = RenderStyle::clone(parentStyle);
-    m_matchedPropertiesCache.add(hash, cacheItem);
+    m_matchedPropertiesCache.add(hash, std::move(cacheItem));
 }
 
 void StyleResolver::invalidateMatchedPropertiesCache()
@@ -1799,10 +1799,10 @@
 {
     ASSERT(element);
     State& state = m_state;
-    unsigned cacheHash = matchResult.isCacheable ? computeMatchedPropertiesHash(matchResult.matchedProperties.data(), matchResult.matchedProperties.size()) : 0;
+    unsigned cacheHash = shouldUseMatchedPropertiesCache && matchResult.isCacheable ? computeMatchedPropertiesHash(matchResult.matchedProperties.data(), matchResult.matchedProperties.size()) : 0;
     bool applyInheritedOnly = false;
     const MatchedPropertiesCacheItem* cacheItem = 0;
-    if (shouldUseMatchedPropertiesCache && cacheHash && (cacheItem = findFromMatchedPropertiesCache(cacheHash, matchResult))) {
+    if (cacheHash && (cacheItem = findFromMatchedPropertiesCache(cacheHash, matchResult))) {
         // We can build up the style by copying non-inherited properties from an earlier style object built using the same exact
         // style declarations. We then only need to apply the inherited properties, if any, as their values can depend on the 
         // element context. This is fast and saves memory by reusing the style data structures.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to