[webkit-changes] [WebKit/WebKit] 0a1408: [JSC] Implement Intl.DurationFormat
Yusuke Suzuki
noreply at github.com
Fri Sep 23 09:26:20 PDT 2022
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 0a1408274330aa1999490790cee7d2b9b3b8ac2b
https://github.com/WebKit/WebKit/commit/0a1408274330aa1999490790cee7d2b9b3b8ac2b
Author: Yusuke Suzuki <ysuzuki at apple.com>
Date: 2022-09-23 (Fri, 23 Sep 2022)
Changed paths:
A JSTests/stress/intl-durationformat-basic.js
A JSTests/stress/intl-durationformat-digital.js
A JSTests/stress/intl-durationformat-format-to-parts.js
A JSTests/stress/intl-durationformat.js
M JSTests/stress/intl-enumeration.js
M JSTests/test262/config.yaml
M JSTests/test262/expectations.yaml
M Source/JavaScriptCore/CMakeLists.txt
M Source/JavaScriptCore/DerivedSources-input.xcfilelist
M Source/JavaScriptCore/DerivedSources-output.xcfilelist
M Source/JavaScriptCore/DerivedSources.make
M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
M Source/JavaScriptCore/Sources.txt
M Source/JavaScriptCore/heap/Heap.cpp
M Source/JavaScriptCore/heap/Heap.h
M Source/JavaScriptCore/heap/HeapSubspaceTypes.h
M Source/JavaScriptCore/runtime/CommonIdentifiers.h
A Source/JavaScriptCore/runtime/IntlDurationFormat.cpp
A Source/JavaScriptCore/runtime/IntlDurationFormat.h
A Source/JavaScriptCore/runtime/IntlDurationFormatConstructor.cpp
A Source/JavaScriptCore/runtime/IntlDurationFormatConstructor.h
A Source/JavaScriptCore/runtime/IntlDurationFormatPrototype.cpp
A Source/JavaScriptCore/runtime/IntlDurationFormatPrototype.h
M Source/JavaScriptCore/runtime/IntlListFormat.cpp
M Source/JavaScriptCore/runtime/IntlObject.cpp
M Source/JavaScriptCore/runtime/IntlObject.h
M Source/JavaScriptCore/runtime/IntlObjectInlines.h
M Source/JavaScriptCore/runtime/JSGlobalObject.cpp
M Source/JavaScriptCore/runtime/JSGlobalObject.h
M Source/JavaScriptCore/runtime/OptionsList.h
Log Message:
-----------
[JSC] Implement Intl.DurationFormat
https://bugs.webkit.org/show_bug.cgi?id=214794
<rdar://66436701>
Reviewed by Ross Kirsling.
This patch implements Intl.DurationFormat[1], which is now stage-3 feature.
It is decoupled from Temporal now: it can take an object with `hours` etc. properties, and
generate formatted string for duration. In the future, it will accept Temporal.Duration too.
1. We add new microsecond and nanosecond units because they are necessary to DurationFormat[2].
2. Implement Intl.DurationFormat with UNumberFormatter and UListFormatter.
[1]: https://github.com/tc39/proposal-intl-duration-format
[2]: https://github.com/tc39/ecma402/pull/708
* JSTests/stress/intl-durationformat-basic.js: Added.
(shouldBe):
(shouldBeOneOf):
(shouldBeForICUVersion):
(shouldNotThrow):
(shouldThrow):
* JSTests/stress/intl-durationformat-digital.js: Added.
(shouldBe):
(throw.new.Error):
* JSTests/stress/intl-durationformat-format-to-parts.js: Added.
(shouldBe):
(shouldBeOneOf):
(shouldBeForICUVersion):
(shouldNotThrow):
(shouldThrow):
(throw.new.Error):
* JSTests/stress/intl-durationformat.js: Added.
(shouldBe):
(shouldNotThrow):
(shouldThrow):
(test.DerivedDurationFormat):
(test.get shouldThrow):
(test):
* JSTests/stress/intl-enumeration.js:
* JSTests/test262/config.yaml:
* JSTests/test262/expectations.yaml:
* Source/JavaScriptCore/CMakeLists.txt:
* Source/JavaScriptCore/DerivedSources-input.xcfilelist:
* Source/JavaScriptCore/DerivedSources-output.xcfilelist:
* Source/JavaScriptCore/DerivedSources.make:
* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/JavaScriptCore/Sources.txt:
* Source/JavaScriptCore/heap/Heap.cpp:
(JSC::Heap::Heap):
* Source/JavaScriptCore/heap/Heap.h:
* Source/JavaScriptCore/heap/HeapSubspaceTypes.h:
* Source/JavaScriptCore/runtime/CommonIdentifiers.h:
* Source/JavaScriptCore/runtime/IntlDurationFormat.cpp: Added.
(JSC::IntlDurationFormat::create):
(JSC::IntlDurationFormat::createStructure):
(JSC::IntlDurationFormat::IntlDurationFormat):
(JSC::IntlDurationFormat::finishCreation):
(JSC::intlDurationUnitOptions):
(JSC::displayName):
(JSC::IntlDurationFormat::initializeDurationFormat):
(JSC::ListFormatInput::ListFormatInput):
(JSC::ListFormatInput::size const):
(JSC::ListFormatInput::stringPointers const):
(JSC::ListFormatInput::stringLengths const):
(JSC::retrieveSeparator):
(JSC::collectElements):
(JSC::IntlDurationFormat::format const):
(JSC::IntlDurationFormat::formatToParts const):
(JSC::IntlDurationFormat::resolvedOptions const):
(JSC::IntlDurationFormat::styleString):
(JSC::IntlDurationFormat::unitStyleString):
(JSC::IntlDurationFormat::displayString):
* Source/JavaScriptCore/runtime/IntlDurationFormat.h: Added.
* Source/JavaScriptCore/runtime/IntlDurationFormatConstructor.cpp: Added.
(JSC::IntlDurationFormatConstructor::create):
(JSC::IntlDurationFormatConstructor::createStructure):
(JSC::IntlDurationFormatConstructor::IntlDurationFormatConstructor):
(JSC::IntlDurationFormatConstructor::finishCreation):
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/IntlDurationFormatConstructor.h: Added.
* Source/JavaScriptCore/runtime/IntlDurationFormatPrototype.cpp: Added.
(JSC::IntlDurationFormatPrototype::create):
(JSC::IntlDurationFormatPrototype::createStructure):
(JSC::IntlDurationFormatPrototype::IntlDurationFormatPrototype):
(JSC::IntlDurationFormatPrototype::finishCreation):
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/IntlDurationFormatPrototype.h: Added.
* Source/JavaScriptCore/runtime/IntlObject.cpp:
(JSC::createDurationFormatConstructor):
(JSC::IntlObject::finishCreation):
* Source/JavaScriptCore/runtime/IntlObject.h:
(JSC::intlDurationFormatAvailableLocales):
* Source/JavaScriptCore/runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
* Source/JavaScriptCore/runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::durationFormatStructure):
Canonical link: https://commits.webkit.org/254791@main
More information about the webkit-changes
mailing list