Changeset 97052 in webkit


Ignore:
Timestamp:
Oct 10, 2011, 3:14:25 AM (14 years ago)
Author:
andreas.kling@nokia.com
Message:

Shrink RootInlineBox.
https://bugs.webkit.org/show_bug.cgi?id=69707

Reviewed by Antti Koivisto.

Move the bitfields from RootInlineBox up into its base class (InlineFlowBox.)
This shrinks RootInlineBox by one CPU word without growing InlineFlowBox.
Enum bitfields were changed to "unsigned" for the MSVC signedness quirk.

Also move one 32-bit member to the head of RootInlineBox so it falls into the
padding at the end of InlineFlowBox on 64-bit.

This reduces memory consumption by 780 kB (on 64-bit) when loading the full
HTML5 spec.

  • rendering/InlineFlowBox.h:

(WebCore::InlineFlowBox::InlineFlowBox):

  • rendering/RootInlineBox.cpp:

(WebCore::RootInlineBox::RootInlineBox):
(WebCore::RootInlineBox::lineBreakBidiStatus):

  • rendering/RootInlineBox.h:
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r97051 r97052  
     12011-10-10  Andreas Kling  <kling@webkit.org>
     2
     3        Shrink RootInlineBox.
     4        https://bugs.webkit.org/show_bug.cgi?id=69707
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Move the bitfields from RootInlineBox up into its base class (InlineFlowBox.)
     9        This shrinks RootInlineBox by one CPU word without growing InlineFlowBox.
     10        Enum bitfields were changed to "unsigned" for the MSVC signedness quirk.
     11
     12        Also move one 32-bit member to the head of RootInlineBox so it falls into the
     13        padding at the end of InlineFlowBox on 64-bit.
     14
     15        This reduces memory consumption by 780 kB (on 64-bit) when loading the full
     16        HTML5 spec.
     17
     18        * rendering/InlineFlowBox.h:
     19        (WebCore::InlineFlowBox::InlineFlowBox):
     20        * rendering/RootInlineBox.cpp:
     21        (WebCore::RootInlineBox::RootInlineBox):
     22        (WebCore::RootInlineBox::lineBreakBidiStatus):
     23        * rendering/RootInlineBox.h:
     24
    1252011-10-10  Pavel Podivilov  <podivilov@chromium.org>
    226
  • trunk/Source/WebCore/rendering/InlineFlowBox.h

    r94912 r97052  
    4747        , m_includeLogicalRightEdge(false)
    4848        , m_descendantsHaveSameLineHeightAndBaseline(true)
     49        , m_baselineType(AlphabeticBaseline)
     50        , m_hasAnnotationsBefore(false)
     51        , m_hasAnnotationsAfter(false)
    4952#ifndef NDEBUG
    5053        , m_hasBadChildList(false)
     
    297300    bool m_descendantsHaveSameLineHeightAndBaseline : 1;
    298301
    299 #ifndef NDEBUG
     302    // The following members are only used by RootInlineBox but moved here to keep the bits packed.
     303
     304    // Whether or not this line uses alphabetic or ideographic baselines by default.
     305    unsigned m_baselineType : 1; // FontBaseline
     306
     307    // If the line contains any ruby runs, then this will be true.
     308    bool m_hasAnnotationsBefore : 1;
     309    bool m_hasAnnotationsAfter : 1;
     310
     311    unsigned m_lineBreakBidiStatusEor : 5; // WTF::Unicode::Direction
     312    unsigned m_lineBreakBidiStatusLastStrong : 5; // WTF::Unicode::Direction
     313    unsigned m_lineBreakBidiStatusLast : 5; // WTF::Unicode::Direction
     314
     315    // End of RootInlineBox-specific members.
     316
     317#ifndef NDEBUG
     318private:
    300319    bool m_hasBadChildList;
    301320#endif
  • trunk/Source/WebCore/rendering/RootInlineBox.cpp

    r95750 r97052  
    3535#include "RenderBlock.h"
    3636#include "VerticalPositionCache.h"
     37#include <wtf/unicode/Unicode.h>
    3738
    3839using namespace std;
     
    4546RootInlineBox::RootInlineBox(RenderBlock* block)
    4647    : InlineFlowBox(block)
     48    , m_lineBreakPos(0)
    4749    , m_lineBreakObj(0)
    48     , m_lineBreakPos(0)
    4950    , m_lineTop(0)
    5051    , m_lineBottom(0)
     
    5354    , m_paginationStrut(0)
    5455    , m_paginatedLineWidth(0)
    55     , m_baselineType(AlphabeticBaseline)
    56     , m_hasAnnotationsBefore(false)
    57     , m_hasAnnotationsAfter(false)
    5856{
    5957    setIsHorizontal(block->isHorizontalWritingMode());
     
    515513BidiStatus RootInlineBox::lineBreakBidiStatus() const
    516514{
    517     return BidiStatus(m_lineBreakBidiStatusEor, m_lineBreakBidiStatusLastStrong, m_lineBreakBidiStatusLast, m_lineBreakContext);
     515    return BidiStatus(static_cast<WTF::Unicode::Direction>(m_lineBreakBidiStatusEor), static_cast<WTF::Unicode::Direction>(m_lineBreakBidiStatusLastStrong), static_cast<WTF::Unicode::Direction>(m_lineBreakBidiStatusLast), m_lineBreakContext);
    518516}
    519517
  • trunk/Source/WebCore/rendering/RootInlineBox.h

    r95750 r97052  
    185185    int beforeAnnotationsAdjustment() const;
    186186
     187    // This folds into the padding at the end of InlineFlowBox on 64-bit.
     188    unsigned m_lineBreakPos;
     189
    187190    // Where this line ended.  The exact object and the position within that object are stored so that
    188191    // we can create an InlineIterator beginning just after the end of this line.
    189192    RenderObject* m_lineBreakObj;
    190     unsigned m_lineBreakPos;
    191193    RefPtr<BidiContext> m_lineBreakContext;
    192194
     
    203205    // good for as long as the line has not been marked dirty.
    204206    OwnPtr<Vector<RenderBox*> > m_floats;
    205 
    206     // Whether or not this line uses alphabetic or ideographic baselines by default.
    207     unsigned m_baselineType : 1; // FontBaseline
    208    
    209     // If the line contains any ruby runs, then this will be true.
    210     bool m_hasAnnotationsBefore : 1;
    211     bool m_hasAnnotationsAfter : 1;
    212 
    213     WTF::Unicode::Direction m_lineBreakBidiStatusEor : 5;
    214     WTF::Unicode::Direction m_lineBreakBidiStatusLastStrong : 5;
    215     WTF::Unicode::Direction m_lineBreakBidiStatusLast : 5;
    216207};
    217208
Note: See TracChangeset for help on using the changeset viewer.