Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fb5264445a289d6a407ea8f089e7d4c121f778ef
      
https://github.com/WebKit/WebKit/commit/fb5264445a289d6a407ea8f089e7d4c121f778ef
  Author: Yusuke Suzuki <ysuz...@apple.com>
  Date:   2024-04-20 (Sat, 20 Apr 2024)

  Changed paths:
    M Source/WebCore/layout/formattingContexts/inline/AbstractLineBuilder.cpp
    M Source/WebCore/layout/formattingContexts/inline/AbstractLineBuilder.h
    M Source/WebCore/layout/formattingContexts/inline/InlineContentBalancer.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineFormattingUtils.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineFormattingUtils.h
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.h
    M Source/WebCore/layout/formattingContexts/inline/RangeBasedLineBuilder.cpp
    M Source/WebCore/layout/formattingContexts/inline/RangeBasedLineBuilder.h
    M 
Source/WebCore/layout/formattingContexts/inline/TextOnlySimpleLineBuilder.cpp
    M 
Source/WebCore/layout/formattingContexts/inline/TextOnlySimpleLineBuilder.h

  Log Message:
  -----------
  [WebCore] Use std::span instead of const InlineItemList& in 
AbstractLineBuilder
https://bugs.webkit.org/show_bug.cgi?id=273034
rdar://126803864

Reviewed by Alan Baradlay.

We found that InlineItemList's size / buffer getter accesses are very hot in 
AbstractLineBuilder related code.
This is interesting: since const InlineItemList& is a pointer in fact (in 
assembly), compiler does not know whether
it can be changed or not during running AbstractLineBuilder's algorithm. So 
operator[] access to const InlineItemList&
always need to get size and need to (index < size) assertion, which takes a lot 
of cost.

But InlineItemList will not change during AbstractLineBuilder's processing. If 
we take it as a std::span and store it
in AbstractLineBuilder, compiler knows that this is immutable and we can do the 
above checks without tracing a lot of pointers.

This patch changes const InlineItemList& to std::span in AbstractLineBuilder.

* Source/WebCore/layout/formattingContexts/inline/AbstractLineBuilder.cpp:
(WebCore::Layout::AbstractLineBuilder::AbstractLineBuilder):
* Source/WebCore/layout/formattingContexts/inline/AbstractLineBuilder.h:
* Source/WebCore/layout/formattingContexts/inline/InlineContentBalancer.cpp:
(WebCore::Layout::InlineContentBalancer::computeBreakOpportunities const):
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingUtils.cpp:
(WebCore::Layout::InlineFormattingUtils::nextWrapOpportunity const):
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingUtils.h:
* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::hasTrailingSoftWrapOpportunity):
* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.h:
(WebCore::Layout::LineBuilder::~LineBuilder): Deleted.
(WebCore::Layout::LineBuilder::isFloatLayoutSuspended const): Deleted.
(WebCore::Layout::LineBuilder::isLineConstrainedByFloat const): Deleted.
(WebCore::Layout::LineBuilder::floatingContext const): Deleted.
* Source/WebCore/layout/formattingContexts/inline/RangeBasedLineBuilder.cpp:
(WebCore::Layout::RangeBasedLineBuilder::layoutInlineContent):
* Source/WebCore/layout/formattingContexts/inline/RangeBasedLineBuilder.h:
* Source/WebCore/layout/formattingContexts/inline/TextOnlySimpleLineBuilder.cpp:
(WebCore::Layout::placedInlineItemEnd):
(WebCore::Layout::consumeTrailingLineBreakIfApplicable):
* Source/WebCore/layout/formattingContexts/inline/TextOnlySimpleLineBuilder.h:
(WebCore::Layout::TextOnlySimpleLineBuilder::isWrappingAllowed const): Deleted.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to