Title: [98573] trunk/Source/WebCore
Revision
98573
Author
[email protected]
Date
2011-10-27 08:03:48 -0700 (Thu, 27 Oct 2011)

Log Message

Use StringHasher to generate the matched declaration cache hash
https://bugs.webkit.org/show_bug.cgi?id=71012

Reviewed by Kenneth Rohde Christiansen and Andreas Kling.

It is faster and better than the current custom function.

* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::computeDeclarationHash):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (98572 => 98573)


--- trunk/Source/WebCore/ChangeLog	2011-10-27 14:51:52 UTC (rev 98572)
+++ trunk/Source/WebCore/ChangeLog	2011-10-27 15:03:48 UTC (rev 98573)
@@ -1,3 +1,15 @@
+2011-10-27  Antti Koivisto  <[email protected]>
+
+        Use StringHasher to generate the matched declaration cache hash
+        https://bugs.webkit.org/show_bug.cgi?id=71012
+
+        Reviewed by Kenneth Rohde Christiansen and Andreas Kling.
+
+        It is faster and better than the current custom function.
+
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::computeDeclarationHash):
+
 2011-10-27  Kentaro Hara  <[email protected]>
 
         Refactor OptionsObject.cpp

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (98572 => 98573)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-10-27 14:51:52 UTC (rev 98572)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-10-27 15:03:48 UTC (rev 98573)
@@ -2136,14 +2136,7 @@
 
 unsigned CSSStyleSelector::computeDeclarationHash(MatchedStyleDeclaration* declarations, unsigned size)
 {
-    unsigned hash = 0;
-    for (unsigned i = 0; i < size; ++i) {
-        unsigned ptrHash = PtrHash<CSSMutableStyleDeclaration*>::hash(declarations[i].styleDeclaration);
-        ptrHash ^= IntHash<unsigned>::hash(declarations[i].linkMatchType);
-        // Make the position matter.
-        hash ^= (ptrHash << i) | (ptrHash >> (32 - i));
-    }
-    return hash;
+    return StringHasher::hashMemory(declarations, sizeof(MatchedStyleDeclaration) * size);
 }
 
 bool operator==(const CSSStyleSelector::MatchResult& a, const CSSStyleSelector::MatchResult& b)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to