Diff
Modified: trunk/Source/WebCore/ChangeLog (99872 => 99873)
--- trunk/Source/WebCore/ChangeLog 2011-11-10 17:32:31 UTC (rev 99872)
+++ trunk/Source/WebCore/ChangeLog 2011-11-10 17:46:27 UTC (rev 99873)
@@ -1,3 +1,21 @@
+2011-11-10 Andreas Kling <[email protected]>
+
+ Shrink CSSMutableStyleDeclaration.
+ <http://webkit.org/b/72032>
+
+ Reviewed by Antti Koivisto.
+
+ Move m_strictParsing and m_iteratorCount (debug only) up into
+ CSSStyleDeclaration, effectively shaving one CPU word (4/8 bytes)
+ off of every CSSMutableStyleDeclaration.
+
+ * css/CSSMutableStyleDeclaration.cpp:
+ (WebCore::CSSMutableStyleDeclaration::CSSMutableStyleDeclaration):
+ * css/CSSMutableStyleDeclaration.h:
+ * css/CSSStyleDeclaration.cpp:
+ (WebCore::CSSStyleDeclaration::CSSStyleDeclaration):
+ * css/CSSStyleDeclaration.h:
+
2011-11-10 Balazs Kelemen <[email protected]>
[Qt] X11 plugins need to be reworked for Qt5
Modified: trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp (99872 => 99873)
--- trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp 2011-11-10 17:32:31 UTC (rev 99872)
+++ trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp 2011-11-10 17:46:27 UTC (rev 99873)
@@ -43,20 +43,14 @@
CSSMutableStyleDeclaration::CSSMutableStyleDeclaration()
: CSSStyleDeclaration(0, /* isMutable */ true)
, m_node(0)
- , m_strictParsing(false)
-#ifndef NDEBUG
- , m_iteratorCount(0)
-#endif
{
+ // This constructor is used for various inline style declarations, so disable strict parsing.
+ m_strictParsing = false;
}
CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent)
: CSSStyleDeclaration(parent, /* isMutable */ true)
, m_node(0)
- , m_strictParsing(!parent || parent->useStrictParsing())
-#ifndef NDEBUG
- , m_iteratorCount(0)
-#endif
{
}
@@ -64,10 +58,6 @@
: CSSStyleDeclaration(parent, /* isMutable */ true)
, m_properties(properties)
, m_node(0)
- , m_strictParsing(!parent || parent->useStrictParsing())
-#ifndef NDEBUG
- , m_iteratorCount(0)
-#endif
{
m_properties.shrinkToFit();
// FIXME: This allows duplicate properties.
@@ -76,10 +66,6 @@
CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent, const CSSProperty* const * properties, int numProperties)
: CSSStyleDeclaration(parent, /* isMutable */ true)
, m_node(0)
- , m_strictParsing(!parent || parent->useStrictParsing())
-#ifndef NDEBUG
- , m_iteratorCount(0)
-#endif
{
m_properties.reserveInitialCapacity(numProperties);
HashMap<int, bool> candidates;
Modified: trunk/Source/WebCore/css/CSSMutableStyleDeclaration.h (99872 => 99873)
--- trunk/Source/WebCore/css/CSSMutableStyleDeclaration.h 2011-11-10 17:32:31 UTC (rev 99872)
+++ trunk/Source/WebCore/css/CSSMutableStyleDeclaration.h 2011-11-10 17:46:27 UTC (rev 99873)
@@ -172,10 +172,6 @@
Vector<CSSProperty, 4> m_properties;
Node* m_node;
- bool m_strictParsing : 1;
-#ifndef NDEBUG
- unsigned m_iteratorCount : 4;
-#endif
friend class CSSMutableStyleDeclarationConstIterator;
};
Modified: trunk/Source/WebCore/css/CSSStyleDeclaration.cpp (99872 => 99873)
--- trunk/Source/WebCore/css/CSSStyleDeclaration.cpp 2011-11-10 17:32:31 UTC (rev 99872)
+++ trunk/Source/WebCore/css/CSSStyleDeclaration.cpp 2011-11-10 17:46:27 UTC (rev 99873)
@@ -39,7 +39,11 @@
namespace WebCore {
CSSStyleDeclaration::CSSStyleDeclaration(CSSRule* parent, bool isMutable)
- : m_isMutableStyleDeclaration(isMutable)
+ : m_strictParsing(!parent || parent->useStrictParsing())
+#ifndef NDEBUG
+ , m_iteratorCount(0)
+#endif
+ , m_isMutableStyleDeclaration(isMutable)
, m_parentIsRule(true)
, m_parentRule(parent)
{
Modified: trunk/Source/WebCore/css/CSSStyleDeclaration.h (99872 => 99873)
--- trunk/Source/WebCore/css/CSSStyleDeclaration.h 2011-11-10 17:32:31 UTC (rev 99872)
+++ trunk/Source/WebCore/css/CSSStyleDeclaration.h 2011-11-10 17:46:27 UTC (rev 99873)
@@ -109,6 +109,13 @@
virtual bool cssPropertyMatches(const CSSProperty*) const;
+ // These bits are only used by CSSMutableStyleDeclaration but kept here
+ // to maximize struct packing.
+ bool m_strictParsing : 1;
+#ifndef NDEBUG
+ unsigned m_iteratorCount : 4;
+#endif
+
private:
bool m_isMutableStyleDeclaration : 1;
bool m_parentIsRule : 1;