[webkit-changes] [WebKit/WebKit] de86b9: [IFC] Save memory by rearranging InlineDisplay::Bo...

Antti Koivisto noreply at github.com
Mon Feb 13 11:24:27 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: de86b9514094c624d049e72b92ff12f5af21286c
      https://github.com/WebKit/WebKit/commit/de86b9514094c624d049e72b92ff12f5af21286c
  Author: Antti Koivisto <antti at apple.com>
  Date:   2023-02-13 (Mon, 13 Feb 2023)

  Changed paths:
    M Source/WebCore/display/DisplayTreeBuilder.cpp
    M Source/WebCore/display/css/DisplayBoxFactory.cpp
    M Source/WebCore/display/css/DisplayTextBox.cpp
    M Source/WebCore/layout/Verification.cpp
    M Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayBox.h
    M Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp
    M Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp
    M Source/WebCore/layout/integration/inline/InlineIteratorBoxModernPath.h
    M Source/WebCore/layout/integration/inline/InlineIteratorTextBox.cpp
    M Source/WebCore/layout/integration/inline/LayoutIntegrationInlineContentPainter.cpp
    M Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp

  Log Message:
  -----------
  [IFC] Save memory by rearranging InlineDisplay::Box fields
https://bugs.webkit.org/show_bug.cgi?id=252173
rdar://105396411

Reviewed by Simon Fraser.

Mechanical savings:

- rearrange fields to minimize space
- add more fields to the bitfields
- replace std::optionals with plain values and a bitfield bits
- replace size_t index fields with unsigned
- use #pragma pack(push, 4) to avoid the Text struct being padded to 8 bytes

InlineDisplay::Box goes from

Total byte size: 136
Total pad bytes: 19
Padding percentage: 14.61 %

Total byte size: 80
Total pad bytes: 1
Padding percentage: 1.25 %

* Source/WebCore/display/DisplayTreeBuilder.cpp:
(WebCore::Display::TreeBuilder::buildInlineDisplayTree):
* Source/WebCore/display/css/DisplayBoxFactory.cpp:
(WebCore::Display::BoxFactory::displayBoxForTextRun const):
* Source/WebCore/display/css/DisplayTextBox.cpp:
(WebCore::Display::m_text):
* Source/WebCore/layout/Verification.cpp:
(WebCore::Layout::checkForMatchingTextRuns):
(WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded):
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayBox.h:
(WebCore::InlineDisplay::Box::Text::length const):
(WebCore::InlineDisplay::Box::Text::partiallyVisibleContentLength const):
(WebCore::InlineDisplay::Box::Text::setPartiallyVisibleContentLength):
(WebCore::InlineDisplay::Box::text):
(WebCore::InlineDisplay::Box::text const):
(WebCore::InlineDisplay::Box::expansion const):
(WebCore::InlineDisplay::Box::Box):
(WebCore::InlineDisplay::m_isFullyTruncated):
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp:
(WebCore::Layout::truncateOverflowingDisplayBoxes):
* Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp:
(WebCore::LayoutIntegration::showInlineContent):
* Source/WebCore/layout/integration/inline/InlineIteratorBoxModernPath.h:
(WebCore::InlineIterator::BoxModernPath::hasHyphen const):
(WebCore::InlineIterator::BoxModernPath::originalText const):
(WebCore::InlineIterator::BoxModernPath::start const):
(WebCore::InlineIterator::BoxModernPath::end const):
(WebCore::InlineIterator::BoxModernPath::length const):
(WebCore::InlineIterator::BoxModernPath::selectableRange const):
(WebCore::InlineIterator::BoxModernPath::textRun const):
* Source/WebCore/layout/integration/inline/InlineIteratorTextBox.cpp:
(WebCore::InlineIterator::textBoxFor):
* Source/WebCore/layout/integration/inline/LayoutIntegrationInlineContentPainter.cpp:
(WebCore::LayoutIntegration::InlineContentPainter::paintDisplayBox):
* Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::showInlineTreeAndRuns):

Canonical link: https://commits.webkit.org/260211@main




More information about the webkit-changes mailing list