Title: [102613] trunk/Source/WebCore
Revision
102613
Author
[email protected]
Date
2011-12-12 13:25:04 -0800 (Mon, 12 Dec 2011)

Log Message

r102234 caused RuleData to use 33 bits in its bitmask
https://bugs.webkit.org/show_bug.cgi?id=74314

Reviewed by Antti Koivisto.

Lower m_position to something more reasonable. A million
should be plenty. Current large sites (e.g. gmail) seem to use
tens of thousands.

Added a COMPILE_ASSERT to ensure this doesn't regress.

No new tests.

* css/CSSStyleSelector.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102612 => 102613)


--- trunk/Source/WebCore/ChangeLog	2011-12-12 20:58:15 UTC (rev 102612)
+++ trunk/Source/WebCore/ChangeLog	2011-12-12 21:25:04 UTC (rev 102613)
@@ -1,3 +1,20 @@
+2011-12-12  Ojan Vafai  <[email protected]>
+
+        r102234 caused RuleData to use 33 bits in its bitmask
+        https://bugs.webkit.org/show_bug.cgi?id=74314
+
+        Reviewed by Antti Koivisto.
+
+        Lower m_position to something more reasonable. A million
+        should be plenty. Current large sites (e.g. gmail) seem to use
+        tens of thousands.
+
+        Added a COMPILE_ASSERT to ensure this doesn't regress.
+
+        No new tests.
+
+        * css/CSSStyleSelector.cpp:
+
 2011-12-12  James Robinson  <[email protected]>
 
         Rename webkitCancelRequestAnimationFrame to webkitCancelAnimationFrame to match spec change

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (102612 => 102613)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-12-12 20:58:15 UTC (rev 102612)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-12-12 21:25:04 UTC (rev 102613)
@@ -190,7 +190,9 @@
     CSSStyleRule* m_rule;
     CSSSelector* m_selector;
     unsigned m_specificity;
-    unsigned m_position : 26;
+    // This number was picked fairly arbitrarily. We can probably lower it if we need to.
+    // Some simple testing showed <100,000 RuleData's on large sites.
+    unsigned m_position : 25;
     bool m_hasFastCheckableSelector : 1;
     bool m_hasMultipartSelector : 1;
     bool m_hasRightmostSelectorMatchingHTMLBasedOnRuleHash : 1;
@@ -200,7 +202,17 @@
     // Use plain array instead of a Vector to minimize memory overhead.
     unsigned m_descendantSelectorIdentifierHashes[maximumIdentifierCount];
 };
+    
+struct SameSizeAsRuleData {
+    void* a;
+    void* b;
+    unsigned c;
+    unsigned d;
+    unsigned e[4];
+};
 
+COMPILE_ASSERT(sizeof(RuleData) == sizeof(SameSizeAsRuleData), RuleData_should_stay_small);
+
 class RuleSet {
     WTF_MAKE_NONCOPYABLE(RuleSet);
 public:
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to