⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 101218 in webkit


Ignore:
Timestamp:
Nov 27, 2011, 7:50:23 PM (15 years ago)
Author:
andreas.kling@nokia.com
Message:

CSSStyleRule: Pack m_sourceLine with CSSRule bits.
<http://webkit.org/b/73168>

Reviewed by Antti Koivisto.

Make CSSStyleRule::m_sourceLine a 27-bit integer and pack it with the rest
of the members in CSSRule. This shrinks CSSStyleRule by one CPU word
and reduces memory consumption by 81 kB on the GMail inbox (on 64-bit.)

  • css/CSSRule.h:

(WebCore::CSSRule::CSSRule):

  • css/CSSStyleRule.cpp:

(WebCore::CSSStyleRule::CSSStyleRule):

  • css/CSSStyleRule.h:
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r101215 r101218  
     12011-11-27  Andreas Kling  <kling@webkit.org>
     2
     3        CSSStyleRule: Pack m_sourceLine with CSSRule bits.
     4        <http://webkit.org/b/73168>
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Make CSSStyleRule::m_sourceLine a 27-bit integer and pack it with the rest
     9        of the members in CSSRule. This shrinks CSSStyleRule by one CPU word
     10        and reduces memory consumption by 81 kB on the GMail inbox (on 64-bit.)
     11
     12        * css/CSSRule.h:
     13        (WebCore::CSSRule::CSSRule):
     14        * css/CSSStyleRule.cpp:
     15        (WebCore::CSSStyleRule::CSSStyleRule):
     16        * css/CSSStyleRule.h:
     17
    1182011-11-27  Mark Rowe  <mrowe@apple.com>
    219
  • trunk/Source/WebCore/css/CSSRule.h

    r99171 r101218  
    110110protected:
    111111    CSSRule(CSSStyleSheet* parent, Type type)
    112         : m_parentIsRule(false)
     112        : m_sourceLine(0)
     113        , m_parentIsRule(false)
    113114        , m_type(type)
    114115        , m_parentStyleSheet(parent)
     
    121122    ~CSSRule() { }
    122123
     124    // Only used by CSSStyleRule but kept here to maximize struct packing.
     125    signed m_sourceLine : 27;
     126
    123127private:
    124     void destroy();
    125 
    126128    bool m_parentIsRule : 1;
    127     unsigned m_type : 31; // Plenty of space for additional flags here.
     129    unsigned m_type : 4;
    128130    union {
    129131        CSSRule* m_parentRule;
    130132        CSSStyleSheet* m_parentStyleSheet;
    131133    };
     134
     135    void destroy();
    132136};
    133137
  • trunk/Source/WebCore/css/CSSStyleRule.cpp

    r101172 r101218  
    3636CSSStyleRule::CSSStyleRule(CSSStyleSheet* parent, int sourceLine, CSSRule::Type type)
    3737    : CSSRule(parent, type)
    38     , m_sourceLine(sourceLine)
    3938{
     39    m_sourceLine = sourceLine;
     40
     41    // m_sourceLine is a bitfield, so let's catch any overflow early in debug mode.
     42    ASSERT(m_sourceLine == sourceLine);
    4043}
    4144
  • trunk/Source/WebCore/css/CSSStyleRule.h

    r99190 r101218  
    6464    RefPtr<CSSMutableStyleDeclaration> m_style;
    6565    CSSSelectorList m_selectorList;
    66     int m_sourceLine;
    6766};
    6867
Note: See TracChangeset for help on using the changeset viewer.