Bug 187430

Summary: Optimize packing of RootInlineBox
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: Layout and RenderingAssignee: Simon Fraser (smfr) <simon.fraser>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, commit-queue, koivisto, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Simon Fraser (smfr)
Reported 2018-07-06 21:53:13 PDT
RootInlineBox can be packed better.
Attachments
Patch (5.34 KB, patch)
2018-07-06 21:53 PDT, Simon Fraser (smfr)
no flags
Patch (15.17 KB, patch)
2018-07-07 20:50 PDT, Simon Fraser (smfr)
no flags
Simon Fraser (smfr)
Comment 1 2018-07-06 21:53:41 PDT
Simon Fraser (smfr)
Comment 2 2018-07-06 21:54:11 PDT
Before: 29$ $ ./Tools/Scripts/dump-class-layout -c Release WebCore RootInlineBox +0 <176> RootInlineBox +0 <112> WebCore::InlineFlowBox WebCore::InlineFlowBox +0 < 64> WebCore::InlineBox WebCore::InlineBox +0 < 8> __vtbl_ptr_type * _vptr +8 < 8> WebCore::InlineBox * m_next +16 < 8> WebCore::InlineBox * m_prev +24 < 8> WebCore::InlineFlowBox * m_parent +32 < 8> WebCore::RenderObject & m_renderer +40 < 4> float m_expansion +44 < 4> WebCore::InlineBox::InlineBoxBitfields m_bitfields +44 < 4> unsigned int m_firstLine : 1 +44 < 4> unsigned int m_constructed : 1 +44 < 4> unsigned int m_bidiEmbeddingLevel : 6 +45 < 4> unsigned int m_dirty : 1 +45 < 4> unsigned int m_extracted : 1 +45 < 4> unsigned int m_hasVirtualLogicalHeight : 1 +45 < 4> unsigned int m_isHorizontal : 1 +45 < 4> unsigned int m_endsWithBreak : 1 +45 < 4> unsigned int m_hasSelectedChildrenOrCanHaveLeadingExpansion : 1 +45 < 4> unsigned int m_canHaveTrailingExpansion : 1 +45 < 4> unsigned int m_knownToHaveNoOverflow : 1 +46 < 4> unsigned int m_hasEllipsisBoxOrHyphen : 1 +46 < 4> unsigned int m_dirOverride : 1 +46 < 4> unsigned int m_behavesLikeText : 1 +46 < 4> unsigned int m_forceTrailingExpansion : 1 +46 < 4> unsigned int m_forceLeadingExpansion : 1 +46 < 4> unsigned int m_determinedIfNextOnLineExists : 1 +46 < 4> unsigned int m_nextOnLineExists : 1 +48 < 8> WebCore::FloatPoint m_topLeft +48 < 4> float m_x +52 < 4> float m_y +56 < 4> float m_logicalWidth +60 < 4> <PADDING: 4 bytes> +64 < 8> WTF::RefPtr<WebCore::RenderOverflow, WTF::DumbPtrTraits<WebCore::RenderOverflow> > m_overflow +64 < 8> WTF::DumbPtrTraits<WebCore::RenderOverflow>::StorageType m_ptr +72 < 8> WebCore::InlineBox * m_firstChild +80 < 8> WebCore::InlineBox * m_lastChild +88 < 8> WebCore::InlineFlowBox * m_prevLineBox +96 < 8> WebCore::InlineFlowBox * m_nextLineBox +104 < 4> unsigned int m_includeLogicalLeftEdge : 1 +104 < 4> unsigned int m_includeLogicalRightEdge : 1 +104 < 4> unsigned int m_hasTextChildren : 1 +104 < 4> unsigned int m_hasTextDescendants : 1 +104 < 4> unsigned int m_descendantsHaveSameLineHeightAndBaseline : 1 +104 < 4> unsigned int m_baselineType : 1 +104 < 4> unsigned int m_hasAnnotationsBefore : 1 +104 < 4> unsigned int m_hasAnnotationsAfter : 1 +105 < 4> unsigned int m_lineBreakBidiStatusEor : 5 +105 < 4> unsigned int m_lineBreakBidiStatusLastStrong : 5 +106 < 4> unsigned int m_lineBreakBidiStatusLast : 5 +106 < 4> unsigned int m_isFirstAfterPageBreak : 1 +110 < 2> <PADDING: 2 bytes> +112 < 8> WTF::CanMakeWeakPtr<WebCore::RootInlineBox> WTF::CanMakeWeakPtr<WebCore::RootInlineBox> +112 < 8> WTF::WeakPtrFactory<WebCore::RootInlineBox> m_weakFactory +112 < 8> WTF::RefPtr<WTF::WeakReference<WebCore::RootInlineBox>, WTF::DumbPtrTraits<WTF::WeakReference<WebCore::RootInlineBox> > > m_ref +112 < 8> WTF::DumbPtrTraits<WTF::WeakReference<WebCore::RootInlineBox> >::StorageType m_ptr +120 < 4> unsigned int m_lineBreakPos +124 < 4> <PADDING: 4 bytes> +128 < 8> WTF::WeakPtr<WebCore::RenderObject> m_lineBreakObj +128 < 8> WTF::RefPtr<WTF::WeakReference<WebCore::RenderObject>, WTF::DumbPtrTraits<WTF::WeakReference<WebCore::RenderObject> > > m_ref +128 < 8> WTF::DumbPtrTraits<WTF::WeakReference<WebCore::RenderObject> >::StorageType m_ptr +136 < 8> WTF::RefPtr<WebCore::BidiContext, WTF::DumbPtrTraits<WebCore::BidiContext> > m_lineBreakContext +136 < 8> WTF::DumbPtrTraits<WebCore::BidiContext>::StorageType m_ptr +144 < 4> WebCore::LayoutUnit m_lineTop +144 < 4> int m_value +148 < 4> WebCore::LayoutUnit m_lineBottom +148 < 4> int m_value +152 < 4> WebCore::LayoutUnit m_lineTopWithLeading +152 < 4> int m_value +156 < 4> WebCore::LayoutUnit m_lineBottomWithLeading +156 < 4> int m_value +160 < 4> WebCore::LayoutUnit m_paginationStrut +160 < 4> int m_value +164 < 4> WebCore::LayoutUnit m_paginatedLineWidth +164 < 4> int m_value +168 < 8> std::__1::unique_ptr<WTF::Vector<WTF::WeakPtr<WebCore::RenderBox>, 0, WTF::CrashOnOverflow, 16>, std::__1::default_delete<WTF::Vector<WTF::WeakPtr<WebCore::RenderBox>, 0, WTF::CrashOnOverflow, 16> > > m_floats +168 < 8> std::__1::__compressed_pair<WTF::Vector<WTF::WeakPtr<WebCore::RenderBox>, 0, WTF::CrashOnOverflow, 16> *, std::__1::default_delete<WTF::Vector<WTF::WeakPtr<WebCore::RenderBox>, 0, WTF::CrashOnOverflow, 16> > > __ptr_ +168 < 8> std::__1::__compressed_pair_elem<WTF::Vector<WTF::WeakPtr<WebCore::RenderBox>, 0, WTF::CrashOnOverflow, 16> *, 0, false> std::__1::__compressed_pair_elem<WTF::Vector<WTF::WeakPtr<WebCore::RenderBox>, 0, WTF::CrashOnOverflow, 16> *, 0, false> +168 < 8> WTF::Vector<WTF::WeakPtr<WebCore::RenderBox>, 0, WTF::CrashOnOverflow, 16> * __value_ +168 < 1> std::__1::__compressed_pair_elem<std::__1::default_delete<WTF::Vector<WTF::WeakPtr<WebCore::RenderBox>, 0, WTF::CrashOnOverflow, 16> >, 1, true> std::__1::__compressed_pair_elem<std::__1::default_delete<WTF::Vector<WTF::WeakPtr<WebCore::RenderBox>, 0, WTF::CrashOnOverflow, 16> >, 1, true> +168 < 1> std::__1::default_delete<WTF::Vector<WTF::WeakPtr<WebCore::RenderBox>, 0, WTF::CrashOnOverflow, 16> > std::__1::default_delete<WTF::Vector<WTF::WeakPtr<WebCore::RenderBox>, 0, WTF::CrashOnOverflow, 16> > Total byte size: 176 Total pad bytes: 10 Padding percentage: 5.68 % After: 32$ $ ./Tools/Scripts/dump-class-layout -c Release WebCore RootInlineBox +0 <168> RootInlineBox +0 <104> WebCore::InlineFlowBox WebCore::InlineFlowBox +0 < 64> WebCore::InlineBox WebCore::InlineBox +0 < 8> __vtbl_ptr_type * _vptr +8 < 8> WebCore::InlineBox * m_next +16 < 8> WebCore::InlineBox * m_prev +24 < 8> WebCore::InlineFlowBox * m_parent +32 < 8> WebCore::RenderObject & m_renderer +40 < 4> float m_logicalWidth +44 < 4> float m_expansion +48 < 4> WebCore::InlineBox::InlineBoxBitfields m_bitfields +48 < 4> unsigned int m_firstLine : 1 +48 < 4> unsigned int m_constructed : 1 +48 < 4> unsigned int m_bidiEmbeddingLevel : 6 +49 < 4> unsigned int m_dirty : 1 +49 < 4> unsigned int m_extracted : 1 +49 < 4> unsigned int m_hasVirtualLogicalHeight : 1 +49 < 4> unsigned int m_isHorizontal : 1 +49 < 4> unsigned int m_endsWithBreak : 1 +49 < 4> unsigned int m_hasSelectedChildrenOrCanHaveLeadingExpansion : 1 +49 < 4> unsigned int m_canHaveTrailingExpansion : 1 +49 < 4> unsigned int m_knownToHaveNoOverflow : 1 +50 < 4> unsigned int m_hasEllipsisBoxOrHyphen : 1 +50 < 4> unsigned int m_dirOverride : 1 +50 < 4> unsigned int m_behavesLikeText : 1 +50 < 4> unsigned int m_forceTrailingExpansion : 1 +50 < 4> unsigned int m_forceLeadingExpansion : 1 +50 < 4> unsigned int m_determinedIfNextOnLineExists : 1 +50 < 4> unsigned int m_nextOnLineExists : 1 +52 < 8> WebCore::FloatPoint m_topLeft +52 < 4> float m_x +56 < 4> float m_y +60 < 4> unsigned int m_includeLogicalLeftEdge : 1 +60 < 4> unsigned int m_includeLogicalRightEdge : 1 +60 < 4> unsigned int m_hasTextChildren : 1 +60 < 4> unsigned int m_hasTextDescendants : 1 +60 < 4> unsigned int m_descendantsHaveSameLineHeightAndBaseline : 1 +60 < 4> unsigned int m_baselineType : 1 +60 < 4> unsigned int m_hasAnnotationsBefore : 1 +60 < 4> unsigned int m_hasAnnotationsAfter : 1 +61 < 4> unsigned int m_lineBreakBidiStatusEor : 5 +61 < 4> unsigned int m_lineBreakBidiStatusLastStrong : 5 +62 < 4> unsigned int m_lineBreakBidiStatusLast : 5 +62 < 4> unsigned int m_isFirstAfterPageBreak : 1 +64 < 8> WTF::RefPtr<WebCore::RenderOverflow, WTF::DumbPtrTraits<WebCore::RenderOverflow> > m_overflow +64 < 8> WTF::DumbPtrTraits<WebCore::RenderOverflow>::StorageType m_ptr +72 < 8> WebCore::InlineBox * m_firstChild +80 < 8> WebCore::InlineBox * m_lastChild +88 < 8> WebCore::InlineFlowBox * m_prevLineBox +96 < 8> WebCore::InlineFlowBox * m_nextLineBox +104 < 8> WTF::CanMakeWeakPtr<WebCore::RootInlineBox> WTF::CanMakeWeakPtr<WebCore::RootInlineBox> +104 < 8> WTF::WeakPtrFactory<WebCore::RootInlineBox> m_weakFactory +104 < 8> WTF::RefPtr<WTF::WeakReference<WebCore::RootInlineBox>, WTF::DumbPtrTraits<WTF::WeakReference<WebCore::RootInlineBox> > > m_ref +104 < 8> WTF::DumbPtrTraits<WTF::WeakReference<WebCore::RootInlineBox> >::StorageType m_ptr +112 < 8> WTF::WeakPtr<WebCore::RenderObject> m_lineBreakObj +112 < 8> WTF::RefPtr<WTF::WeakReference<WebCore::RenderObject>, WTF::DumbPtrTraits<WTF::WeakReference<WebCore::RenderObject> > > m_ref +112 < 8> WTF::DumbPtrTraits<WTF::WeakReference<WebCore::RenderObject> >::StorageType m_ptr +120 < 8> WTF::RefPtr<WebCore::BidiContext, WTF::DumbPtrTraits<WebCore::BidiContext> > m_lineBreakContext +120 < 8> WTF::DumbPtrTraits<WebCore::BidiContext>::StorageType m_ptr +128 < 4> WebCore::LayoutUnit m_lineTop +128 < 4> int m_value +132 < 4> WebCore::LayoutUnit m_lineBottom +132 < 4> int m_value +136 < 4> WebCore::LayoutUnit m_lineTopWithLeading +136 < 4> int m_value +140 < 4> WebCore::LayoutUnit m_lineBottomWithLeading +140 < 4> int m_value +144 < 4> WebCore::LayoutUnit m_paginationStrut +144 < 4> int m_value +148 < 4> WebCore::LayoutUnit m_paginatedLineWidth +148 < 4> int m_value +152 < 8> std::__1::unique_ptr<WTF::Vector<WTF::WeakPtr<WebCore::RenderBox>, 0, WTF::CrashOnOverflow, 16>, std::__1::default_delete<WTF::Vector<WTF::WeakPtr<WebCore::RenderBox>, 0, WTF::CrashOnOverflow, 16> > > m_floats +152 < 8> std::__1::__compressed_pair<WTF::Vector<WTF::WeakPtr<WebCore::RenderBox>, 0, WTF::CrashOnOverflow, 16> *, std::__1::default_delete<WTF::Vector<WTF::WeakPtr<WebCore::RenderBox>, 0, WTF::CrashOnOverflow, 16> > > __ptr_ +152 < 8> std::__1::__compressed_pair_elem<WTF::Vector<WTF::WeakPtr<WebCore::RenderBox>, 0, WTF::CrashOnOverflow, 16> *, 0, false> std::__1::__compressed_pair_elem<WTF::Vector<WTF::WeakPtr<WebCore::RenderBox>, 0, WTF::CrashOnOverflow, 16> *, 0, false> +152 < 8> WTF::Vector<WTF::WeakPtr<WebCore::RenderBox>, 0, WTF::CrashOnOverflow, 16> * __value_ +152 < 1> std::__1::__compressed_pair_elem<std::__1::default_delete<WTF::Vector<WTF::WeakPtr<WebCore::RenderBox>, 0, WTF::CrashOnOverflow, 16> >, 1, true> std::__1::__compressed_pair_elem<std::__1::default_delete<WTF::Vector<WTF::WeakPtr<WebCore::RenderBox>, 0, WTF::CrashOnOverflow, 16> >, 1, true> +152 < 1> std::__1::default_delete<WTF::Vector<WTF::WeakPtr<WebCore::RenderBox>, 0, WTF::CrashOnOverflow, 16> > std::__1::default_delete<WTF::Vector<WTF::WeakPtr<WebCore::RenderBox>, 0, WTF::CrashOnOverflow, 16> > +160 < 4> unsigned int m_lineBreakPos +164 < 4> <PADDING: 4 bytes> Total byte size: 168 Total pad bytes: 4 Padding percentage: 2.38 %
Simon Fraser (smfr)
Comment 3 2018-07-06 21:54:50 PDT
631 instances on nytimes.com, so this saves about 5KB.
Simon Fraser (smfr)
Comment 4 2018-07-07 20:50:44 PDT
WebKit Commit Bot
Comment 5 2018-07-08 22:09:28 PDT
Comment on attachment 344535 [details] Patch Clearing flags on attachment: 344535 Committed r233634: <https://trac.webkit.org/changeset/233634>
WebKit Commit Bot
Comment 6 2018-07-08 22:09:30 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 7 2018-07-08 22:10:23 PDT
Note You need to log in before you can comment on or make changes to this bug.