[webkit-changes] [WebKit/WebKit] 0bdcca: Add Decimal::doubleMax

Yusuke Suzuki noreply at github.com
Mon Feb 19 09:35:45 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0bdcca7bafd75e649e513b9151c7a35d052110f6
      https://github.com/WebKit/WebKit/commit/0bdcca7bafd75e649e513b9151c7a35d052110f6
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2024-02-19 (Mon, 19 Feb 2024)

  Changed paths:
    M Source/WebCore/html/NumberInputType.cpp
    M Source/WebCore/html/parser/HTMLParserIdioms.cpp
    M Source/WebCore/platform/Decimal.cpp
    M Source/WebCore/platform/Decimal.h
    M Tools/TestWebKitAPI/CMakeLists.txt
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    A Tools/TestWebKitAPI/Tests/WebCore/Decimal.cpp

  Log Message:
  -----------
  Add Decimal::doubleMax
https://bugs.webkit.org/show_bug.cgi?id=269161
rdar://122739403

Reviewed by Justin Michaud.

Decimal::fromDouble(std::numeric_limits<double>::max()) is surprisingly slow. So, in this patch,

1. We made various functions in Decimal as constexpr to make a lot of Decimal constant computation constexpr.
2. Add Decimal::doubleMax and use it instead.
3. Do not allocate WTF::String when using Decimal::fromDouble. We use fixed-sized string buffer instead.
4. Remove UInt128 implementation in Decimal.cpp and use wtf/Int128.h's UInt128.

* Source/WebCore/html/NumberInputType.cpp:
(WebCore::NumberInputType::createStepRange const):
* Source/WebCore/html/parser/HTMLParserIdioms.cpp:
(WebCore::parseToDecimalForNumberType):
* Source/WebCore/platform/Decimal.cpp:
(WebCore::Decimal::fromDouble):
(WebCore::Decimal::EncodedData::EncodedData): Deleted.
(WebCore::Decimal::Decimal): Deleted.
(WebCore::Decimal::operator=): Deleted.
(WebCore::Decimal::operator== const): Deleted.
(WebCore::Decimal::infinity): Deleted.
(WebCore::Decimal::nan): Deleted.
(WebCore::Decimal::zero): Deleted.
* Source/WebCore/platform/Decimal.h:
(WebCore::Decimal::Decimal):
(WebCore::Decimal::EncodedData::EncodedData):
(WebCore::Decimal::operator== const):
(WebCore::Decimal::infinity):
(WebCore::Decimal::nan):
(WebCore::Decimal::zero):
(WebCore::Decimal::doubleMax):
* Tools/TestWebKitAPI/CMakeLists.txt:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebCore/Decimal.cpp: Added.
(TestWebKitAPI::TEST):

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list