Skip to content

Conversation

@catamorphism
Copy link
Contributor

@catamorphism catamorphism commented Oct 1, 2025

0275bce

[Temporal] Implement TemporalDuration::subtract() according to spec
https://bugs.webkit.org/show_bug.cgi?id=298562

Reviewed by Yusuke Suzuki.

Add a new addDurations() operation that TemporalDuration::subtract()
calls, as well as some auxiliary classes and ops:

* PlainYearMonth class (will be elaborated in a future PR)
* balanceISOYearMonth()
* balanceISODate()
* regulateISODate()

Some of the previously-failing tests for Temporal/Duration/prototype/subtract
are now enabled.

* JSTests/stress/temporal-duration.js:
* JSTests/test262/config.yaml:
* JSTests/test262/expectations.yaml:
* Source/JavaScriptCore/runtime/DateConstructor.cpp:
(JSC::makeDate): Deleted.
(JSC::makeTime): Deleted.
(JSC::makeDay): Deleted.
* Source/JavaScriptCore/runtime/DateConstructor.h:
(JSC::makeDay):
(JSC::makeDate):
(JSC::makeTime):
* Source/JavaScriptCore/runtime/ISO8601.cpp:
(JSC::ISO8601::isValidISODate):
(JSC::ISO8601::createISODateRecord):
* Source/JavaScriptCore/runtime/ISO8601.h:
* Source/JavaScriptCore/runtime/TemporalCalendar.cpp:
(JSC::balanceISODateOld):
(JSC::epochTimeToEpochYear):
(JSC::epochTimeToMonthInYear):
(JSC::epochTimeToDate):
(JSC::TemporalCalendar::balanceISODate):
(JSC::TemporalCalendar::isoDateAdd):
(JSC::TemporalCalendar::isoDateDifference):
(JSC::TemporalCalendar::balanceISOYearMonth):
(JSC::balanceISODate): Deleted.
* Source/JavaScriptCore/runtime/TemporalCalendar.h:
* Source/JavaScriptCore/runtime/TemporalDuration.cpp:
(JSC::TemporalDuration::toInternalDurationRecordWith24HourDays):
(JSC::TemporalDuration::regulateISODate):
(JSC::TemporalDuration::add const):
(JSC::TemporalDuration::addDurations const):
(JSC::TemporalDuration::subtract const):
* Source/JavaScriptCore/runtime/TemporalDuration.h:
* Source/JavaScriptCore/runtime/TemporalObject.h:

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

1c11ed3

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ❌ 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🛠 wpe-cairo
✅ 🛠 🧪 jsc ✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 🧪 jsc-arm64 ✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🧪 api-gtk
🛠 🧪 merge ✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2 🛠 playstation
✅ 🛠 🧪 unsafe-merge ✅ 🛠 tv ✅ 🛠 mac-safer-cpp ✅ 🛠 jsc-armv7
✅ 🛠 tv-sim ✅ 🧪 jsc-armv7-tests
✅ 🛠 watch
✅ 🛠 watch-sim

@catamorphism catamorphism requested a review from a team as a code owner October 1, 2025 19:10
@catamorphism catamorphism self-assigned this Oct 1, 2025
@catamorphism catamorphism added the JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues. label Oct 1, 2025
Comment on lines 316 to 317
int32_t y = epochTimeToEpochYear(ms);
int32_t m = epochTimeToMonthInYear(ms) + 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not call WTF::yearMonthDayFromDays directly since it is costly.
Please use JSDateMath's cache.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed in bd306a9

Copy link
Member

@Constellation Constellation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me

@Constellation Constellation added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Oct 2, 2025
@webkit-commit-queue
Copy link
Collaborator

This change contains multiple commits which are not squashed together, blocking PR #51637. Please squash the commits to land.

@webkit-commit-queue webkit-commit-queue added merging-blocked Applied to prevent a change from being merged and removed unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing labels Oct 2, 2025
@catamorphism catamorphism force-pushed the balance-precision-part-8 branch from bd306a9 to 4220184 Compare October 2, 2025 02:19
@catamorphism catamorphism added request-merge-queue Request a pull request to be added to merge-queue once ready and removed merging-blocked Applied to prevent a change from being merged labels Oct 2, 2025
@Constellation Constellation added unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing and removed request-merge-queue Request a pull request to be added to merge-queue once ready labels Oct 2, 2025
@webkit-commit-queue
Copy link
Collaborator

Commit message contains (OOPS!), blocking PR #51637. Details: Build #19507

@webkit-commit-queue webkit-commit-queue added merging-blocked Applied to prevent a change from being merged and removed unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing labels Oct 2, 2025
@catamorphism catamorphism force-pushed the balance-precision-part-8 branch from 4220184 to 1c11ed3 Compare October 2, 2025 16:29
@catamorphism catamorphism added unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing and removed merging-blocked Applied to prevent a change from being merged labels Oct 2, 2025
@webkit-commit-queue
Copy link
Collaborator

@catamorphism does not have committer permissions according to https://raw.githubusercontent.com/WebKit/WebKit/main/metadata/contributors.json.

If you do have committer permissions, please ensure that your GitHub username is added to contributors.json.

Rejecting 1c11ed3 from merge queue.

@webkit-commit-queue webkit-commit-queue added merging-blocked Applied to prevent a change from being merged and removed unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing labels Oct 2, 2025
@catamorphism catamorphism added request-merge-queue Request a pull request to be added to merge-queue once ready and removed merging-blocked Applied to prevent a change from being merged labels Oct 2, 2025
@Constellation
Copy link
Member

You need to remove No new tests (OOPS!)..

@catamorphism
Copy link
Contributor Author

You need to remove No new tests (OOPS!)..

@Constellation I did remove it in the commit message, but didn't remove it in the GitHub summary. I've fixed it now, hopefully it works?

@sosukesuzuki sosukesuzuki added merge-queue Applied to send a pull request to merge-queue and removed request-merge-queue Request a pull request to be added to merge-queue once ready labels Oct 3, 2025
@Constellation Constellation added unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing and removed merge-queue Applied to send a pull request to merge-queue labels Oct 3, 2025
https://bugs.webkit.org/show_bug.cgi?id=298562

Reviewed by Yusuke Suzuki.

Add a new addDurations() operation that TemporalDuration::subtract()
calls, as well as some auxiliary classes and ops:

* PlainYearMonth class (will be elaborated in a future PR)
* balanceISOYearMonth()
* balanceISODate()
* regulateISODate()

Some of the previously-failing tests for Temporal/Duration/prototype/subtract
are now enabled.

* JSTests/stress/temporal-duration.js:
* JSTests/test262/config.yaml:
* JSTests/test262/expectations.yaml:
* Source/JavaScriptCore/runtime/DateConstructor.cpp:
(JSC::makeDate): Deleted.
(JSC::makeTime): Deleted.
(JSC::makeDay): Deleted.
* Source/JavaScriptCore/runtime/DateConstructor.h:
(JSC::makeDay):
(JSC::makeDate):
(JSC::makeTime):
* Source/JavaScriptCore/runtime/ISO8601.cpp:
(JSC::ISO8601::isValidISODate):
(JSC::ISO8601::createISODateRecord):
* Source/JavaScriptCore/runtime/ISO8601.h:
* Source/JavaScriptCore/runtime/TemporalCalendar.cpp:
(JSC::balanceISODateOld):
(JSC::epochTimeToEpochYear):
(JSC::epochTimeToMonthInYear):
(JSC::epochTimeToDate):
(JSC::TemporalCalendar::balanceISODate):
(JSC::TemporalCalendar::isoDateAdd):
(JSC::TemporalCalendar::isoDateDifference):
(JSC::TemporalCalendar::balanceISOYearMonth):
(JSC::balanceISODate): Deleted.
* Source/JavaScriptCore/runtime/TemporalCalendar.h:
* Source/JavaScriptCore/runtime/TemporalDuration.cpp:
(JSC::TemporalDuration::toInternalDurationRecordWith24HourDays):
(JSC::TemporalDuration::regulateISODate):
(JSC::TemporalDuration::add const):
(JSC::TemporalDuration::addDurations const):
(JSC::TemporalDuration::subtract const):
* Source/JavaScriptCore/runtime/TemporalDuration.h:
* Source/JavaScriptCore/runtime/TemporalObject.h:

Canonical link: https://commits.webkit.org/300914@main
@webkit-commit-queue
Copy link
Collaborator

Committed 300914@main (0275bce): https://commits.webkit.org/300914@main

Reviewed commits have been landed. Closing PR #51637 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 0275bce into WebKit:main Oct 3, 2025
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants