Title: [293278] trunk/Source/WebCore
- Revision
- 293278
- Author
- commit-qu...@webkit.org
- Date
- 2022-04-22 19:15:14 -0700 (Fri, 22 Apr 2022)
Log Message
Reduce sizeof(CSSNumericType)
https://bugs.webkit.org/show_bug.cgi?id=239680
Patch by Alex Christensen <achristen...@webkit.org> on 2022-04-22
Reviewed by Yusuke Suzuki.
* bindings/IDLTypes.h:
(WebCore::IDLType::nullValue):
(WebCore::IDLType::isNullType):
(WebCore::IDLType::extractValueFromNullable):
* css/typedom/numeric/CSSMathProduct.cpp:
(WebCore::multiplyTypes):
* css/typedom/numeric/CSSNumericType.h:
(WebCore::CSSNumericType::valueForType):
(WebCore::CSSNumericType::valueForType const):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (293277 => 293278)
--- trunk/Source/WebCore/ChangeLog 2022-04-23 02:05:07 UTC (rev 293277)
+++ trunk/Source/WebCore/ChangeLog 2022-04-23 02:15:14 UTC (rev 293278)
@@ -1,3 +1,20 @@
+2022-04-22 Alex Christensen <achristen...@webkit.org>
+
+ Reduce sizeof(CSSNumericType)
+ https://bugs.webkit.org/show_bug.cgi?id=239680
+
+ Reviewed by Yusuke Suzuki.
+
+ * bindings/IDLTypes.h:
+ (WebCore::IDLType::nullValue):
+ (WebCore::IDLType::isNullType):
+ (WebCore::IDLType::extractValueFromNullable):
+ * css/typedom/numeric/CSSMathProduct.cpp:
+ (WebCore::multiplyTypes):
+ * css/typedom/numeric/CSSNumericType.h:
+ (WebCore::CSSNumericType::valueForType):
+ (WebCore::CSSNumericType::valueForType const):
+
2022-04-22 Patrick Angle <pan...@apple.com>
Web Inspector: Regression(r287684) Resources from the memory cache show empty content in Network, Sources, and Search tabs
Modified: trunk/Source/WebCore/bindings/IDLTypes.h (293277 => 293278)
--- trunk/Source/WebCore/bindings/IDLTypes.h 2022-04-23 02:05:07 UTC (rev 293277)
+++ trunk/Source/WebCore/bindings/IDLTypes.h 2022-04-23 02:15:14 UTC (rev 293278)
@@ -30,6 +30,7 @@
#include <_javascript_Core/Strong.h>
#include <variant>
#include <wtf/Brigand.h>
+#include <wtf/Markable.h>
#include <wtf/StdLibExtras.h>
#include <wtf/URL.h>
#include <wtf/WallTime.h>
@@ -75,6 +76,14 @@
static NullableType nullValue() { return std::nullopt; }
static bool isNullValue(const NullableType& value) { return !value; }
static ImplementationType extractValueFromNullable(const NullableType& value) { return value.value(); }
+
+ template<typename Traits> using NullableTypeWithLessPadding = Markable<ImplementationType, Traits>;
+ template<typename Traits>
+ static NullableTypeWithLessPadding<Traits> nullValue() { return std::nullopt; }
+ template<typename Traits>
+ static bool isNullType(const NullableTypeWithLessPadding<Traits>& value) { return !value; }
+ template<typename Traits>
+ static ImplementationType extractValueFromNullable(const NullableTypeWithLessPadding<Traits>& value) { return value.value(); }
};
// IDLUnsupportedType is a special type that serves as a base class for currently unsupported types.
Modified: trunk/Source/WebCore/css/typedom/numeric/CSSMathProduct.cpp (293277 => 293278)
--- trunk/Source/WebCore/css/typedom/numeric/CSSMathProduct.cpp 2022-04-23 02:05:07 UTC (rev 293277)
+++ trunk/Source/WebCore/css/typedom/numeric/CSSMathProduct.cpp 2022-04-23 02:15:14 UTC (rev 293278)
@@ -43,7 +43,7 @@
if (a.percentHint && b.percentHint && *a.percentHint != *b.percentHint)
return std::nullopt;
- auto add = [] (auto left, auto right) -> std::optional<unsigned> {
+ auto add = [] (auto left, auto right) -> CSSNumericType::BaseTypeStorage {
if (!left)
return right;
if (!right)
Modified: trunk/Source/WebCore/css/typedom/numeric/CSSNumericType.h (293277 => 293278)
--- trunk/Source/WebCore/css/typedom/numeric/CSSNumericType.h 2022-04-23 02:05:07 UTC (rev 293277)
+++ trunk/Source/WebCore/css/typedom/numeric/CSSNumericType.h 2022-04-23 02:15:14 UTC (rev 293278)
@@ -29,6 +29,7 @@
#include "CSSNumericBaseType.h"
#include <optional>
+#include <wtf/Markable.h>
#include <wtf/text/StringConcatenateNumbers.h>
namespace WebCore {
@@ -35,14 +36,15 @@
// https://drafts.css-houdini.org/css-typed-om/#dom-cssnumericvalue-type
struct CSSNumericType {
- std::optional<long> length;
- std::optional<long> angle;
- std::optional<long> time;
- std::optional<long> frequency;
- std::optional<long> resolution;
- std::optional<long> flex;
- std::optional<long> percent;
- std::optional<CSSNumericBaseType> percentHint;
+ using BaseTypeStorage = Markable<int, IntegralMarkableTraits<int, std::numeric_limits<int>::min()>>;
+ BaseTypeStorage length;
+ BaseTypeStorage angle;
+ BaseTypeStorage time;
+ BaseTypeStorage frequency;
+ BaseTypeStorage resolution;
+ BaseTypeStorage flex;
+ BaseTypeStorage percent;
+ Markable<CSSNumericBaseType, EnumMarkableTraits<CSSNumericBaseType>> percentHint;
bool operator==(const CSSNumericType& other) const
{
@@ -56,7 +58,7 @@
&& percentHint == other.percentHint;
}
- std::optional<long>& valueForType(CSSNumericBaseType type)
+ BaseTypeStorage& valueForType(CSSNumericBaseType type)
{
switch (type) {
case CSSNumericBaseType::Length:
@@ -77,7 +79,7 @@
RELEASE_ASSERT_NOT_REACHED();
}
- const std::optional<long>& valueForType(CSSNumericBaseType type) const
+ const BaseTypeStorage& valueForType(CSSNumericBaseType type) const
{
return const_cast<CSSNumericType*>(this)->valueForType(type);
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes