Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 0bd48dfc0abc8ec777b704fa303ffab37b38d0a9
https://github.com/WebKit/WebKit/commit/0bd48dfc0abc8ec777b704fa303ffab37b38d0a9
Author: Brent Fulgham <[email protected]>
Date: 2026-04-07 (Tue, 07 Apr 2026)
Changed paths:
M Source/WebCore/css/calc/CSSCalcTree.cpp
M Source/WebCore/css/calc/CSSCalcTree.h
M Source/WebCore/style/calc/StyleCalculationTree.cpp
M Source/WebCore/style/calc/StyleCalculationTree.h
Log Message:
-----------
Build Time Improvement: Move variant-heavy inline functions from CalcTree
headers to .cpp files
https://bugs.webkit.org/show_bug.cgi?id=311452
rdar://174049948
Reviewed by Abrar Rahman Protyasha.
The CSSCalc::Node (38-type variant) and Style::Calculation::Node (33-type
variant) trigger
expensive mpark::variant template instantiations (constructor, destructor,
move_constructor,
switchOn dispatch) in every translation unit that includes their headers.
This patch moves convenience functions that create, move, or switchOn these
variant types
from inline definitions in headers to their corresponding .cpp files. This
avoids unnecessary
variant template instantiation in files that include the headers but don't call
these functions.
(1) CSSCalcTree.h => CSSCalcTree.cpp:
* isNumeric() (switchOn over 38-type variant)add(), multiply(), subtract()
* makeChildWithValueBasedOn() (4 overloads)
(2) StyleCalculationTree.h => StyleCalculationTree.cpp:
* number(), percentage(), dimension()
* add(), multiply(), subtract(), blend()
Note: Trivial move constructors/operators (Children, ChildOrNone) were left
inline to avoid
runtime overhead on hot paths.
* Source/WebCore/css/calc/CSSCalcTree.cpp:
(WebCore::CSSCalc::isNumeric): Moved from header.
(WebCore::CSSCalc::add): Ditto.
(WebCore::CSSCalc::multiply): Ditto.
(WebCore::CSSCalc::subtract): Ditto.
(WebCore::CSSCalc::makeChildWithValueBasedOn): Ditto.
* Source/WebCore/css/calc/CSSCalcTree.h:
(WebCore::CSSCalc::isNumeric): Deleted.
(WebCore::CSSCalc::add): Deleted.
(WebCore::CSSCalc::multiply): Deleted.
(WebCore::CSSCalc::subtract): Deleted.
(WebCore::CSSCalc::makeChildWithValueBasedOn): Deleted.
* Source/WebCore/style/calc/StyleCalculationTree.cpp:
(WebCore::Style::Calculation::number): Moved from header.
(WebCore::Style::Calculation::percentage): Ditto.
(WebCore::Style::Calculation::dimension): Ditto.
(WebCore::Style::Calculation::add): Ditto.
(WebCore::Style::Calculation::multiply): Ditto.
(WebCore::Style::Calculation::subtract): Ditto.
(WebCore::Style::Calculation::blend): Ditto.
* Source/WebCore/style/calc/StyleCalculationTree.h:
(WebCore::Style::Calculation::number): Deleted.
(WebCore::Style::Calculation::percentage): Deleted.
(WebCore::Style::Calculation::dimension): Deleted.
(WebCore::Style::Calculation::add): Deleted.
(WebCore::Style::Calculation::multiply): Deleted.
(WebCore::Style::Calculation::subtract): Deleted.
(WebCore::Style::Calculation::blend): Deleted.
Canonical link: https://commits.webkit.org/310727@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications