Title: [97052] trunk/Source/WebCore
Revision
97052
Author
[email protected]
Date
2011-10-10 03:14:25 -0700 (Mon, 10 Oct 2011)

Log 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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (97051 => 97052)


--- trunk/Source/WebCore/ChangeLog	2011-10-10 10:08:08 UTC (rev 97051)
+++ trunk/Source/WebCore/ChangeLog	2011-10-10 10:14:25 UTC (rev 97052)
@@ -1,3 +1,27 @@
+2011-10-10  Andreas Kling  <[email protected]>
+
+        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:
+
 2011-10-10  Pavel Podivilov  <[email protected]>
 
         Unreviewed, attempt to fix chromium mac build after r97034.

Modified: trunk/Source/WebCore/rendering/InlineFlowBox.h (97051 => 97052)


--- trunk/Source/WebCore/rendering/InlineFlowBox.h	2011-10-10 10:08:08 UTC (rev 97051)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.h	2011-10-10 10:14:25 UTC (rev 97052)
@@ -46,6 +46,9 @@
         , m_includeLogicalLeftEdge(false)
         , m_includeLogicalRightEdge(false)
         , m_descendantsHaveSameLineHeightAndBaseline(true)
+        , m_baselineType(AlphabeticBaseline)
+        , m_hasAnnotationsBefore(false)
+        , m_hasAnnotationsAfter(false)
 #ifndef NDEBUG
         , m_hasBadChildList(false)
 #endif
@@ -296,7 +299,23 @@
     bool m_hasTextDescendants : 1;
     bool m_descendantsHaveSameLineHeightAndBaseline : 1;
 
+    // The following members are only used by RootInlineBox but moved here to keep the bits packed.
+
+    // Whether or not this line uses alphabetic or ideographic baselines by default.
+    unsigned m_baselineType : 1; // FontBaseline
+
+    // If the line contains any ruby runs, then this will be true.
+    bool m_hasAnnotationsBefore : 1;
+    bool m_hasAnnotationsAfter : 1;
+
+    unsigned m_lineBreakBidiStatusEor : 5; // WTF::Unicode::Direction
+    unsigned m_lineBreakBidiStatusLastStrong : 5; // WTF::Unicode::Direction
+    unsigned m_lineBreakBidiStatusLast : 5; // WTF::Unicode::Direction
+
+    // End of RootInlineBox-specific members.
+
 #ifndef NDEBUG
+private:
     bool m_hasBadChildList;
 #endif
 };

Modified: trunk/Source/WebCore/rendering/RootInlineBox.cpp (97051 => 97052)


--- trunk/Source/WebCore/rendering/RootInlineBox.cpp	2011-10-10 10:08:08 UTC (rev 97051)
+++ trunk/Source/WebCore/rendering/RootInlineBox.cpp	2011-10-10 10:14:25 UTC (rev 97052)
@@ -34,6 +34,7 @@
 #include "RenderArena.h"
 #include "RenderBlock.h"
 #include "VerticalPositionCache.h"
+#include <wtf/unicode/Unicode.h>
 
 using namespace std;
 
@@ -44,17 +45,14 @@
 
 RootInlineBox::RootInlineBox(RenderBlock* block)
     : InlineFlowBox(block)
-    , m_lineBreakObj(0)
     , m_lineBreakPos(0)
+    , m_lineBreakObj(0)
     , m_lineTop(0)
     , m_lineBottom(0)
     , m_lineTopWithLeading(0)
     , m_lineBottomWithLeading(0)
     , m_paginationStrut(0)
     , m_paginatedLineWidth(0)
-    , m_baselineType(AlphabeticBaseline)
-    , m_hasAnnotationsBefore(false)
-    , m_hasAnnotationsAfter(false)
 {
     setIsHorizontal(block->isHorizontalWritingMode());
 }
@@ -514,7 +512,7 @@
 
 BidiStatus RootInlineBox::lineBreakBidiStatus() const
 { 
-    return BidiStatus(m_lineBreakBidiStatusEor, m_lineBreakBidiStatusLastStrong, m_lineBreakBidiStatusLast, m_lineBreakContext);
+    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);
 }
 
 void RootInlineBox::setLineBreakInfo(RenderObject* obj, unsigned breakPos, const BidiStatus& status)

Modified: trunk/Source/WebCore/rendering/RootInlineBox.h (97051 => 97052)


--- trunk/Source/WebCore/rendering/RootInlineBox.h	2011-10-10 10:08:08 UTC (rev 97051)
+++ trunk/Source/WebCore/rendering/RootInlineBox.h	2011-10-10 10:14:25 UTC (rev 97052)
@@ -184,10 +184,12 @@
 
     int beforeAnnotationsAdjustment() const;
 
+    // This folds into the padding at the end of InlineFlowBox on 64-bit.
+    unsigned m_lineBreakPos;
+
     // Where this line ended.  The exact object and the position within that object are stored so that
     // we can create an InlineIterator beginning just after the end of this line.
     RenderObject* m_lineBreakObj;
-    unsigned m_lineBreakPos;
     RefPtr<BidiContext> m_lineBreakContext;
 
     LayoutUnit m_lineTop;
@@ -202,17 +204,6 @@
     // Floats hanging off the line are pushed into this vector during layout. It is only
     // good for as long as the line has not been marked dirty.
     OwnPtr<Vector<RenderBox*> > m_floats;
-
-    // Whether or not this line uses alphabetic or ideographic baselines by default.
-    unsigned m_baselineType : 1; // FontBaseline
-    
-    // If the line contains any ruby runs, then this will be true.
-    bool m_hasAnnotationsBefore : 1;
-    bool m_hasAnnotationsAfter : 1;
-
-    WTF::Unicode::Direction m_lineBreakBidiStatusEor : 5;
-    WTF::Unicode::Direction m_lineBreakBidiStatusLastStrong : 5;
-    WTF::Unicode::Direction m_lineBreakBidiStatusLast : 5;
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to