Skip to content

Part 4: Refactor implementation of TemporalPlainDate/prototype/add#49776

Merged
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
ptomato:balance-precision-part-4
Sep 2, 2025
Merged

Part 4: Refactor implementation of TemporalPlainDate/prototype/add#49776
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
ptomato:balance-precision-part-4

Conversation

@ptomato

@ptomato ptomato commented Aug 22, 2025

Copy link
Copy Markdown
Contributor

707926f

Part 4: Refactor implementation of TemporalPlainDate/prototype/add
https://bugs.webkit.org/show_bug.cgi?id=223166

Reviewed by Sosuke Suzuki.

Add a new operation from the spec, TemporalCalendar::addDurationToDate(),
and use it in the implementation of `add`.

This is a refactoring and shouldn't change anything.

(For reference, modifications by Philip Chimento to address review
comments:)

* Remove ISO8601::isValidISODate() and ISO8601::createISODateRecord()
  since they are not used yet in this PR.
* Expose JSC::checkedCastDoubleToInt128 in ISO8601.h header.
* Replace C-style double-to-Int128 casts with checked casts.
* Assert that TemporalDuration::timeDurationFromComponents and
  add24HourDaysToTimeDuration do not overflow. (The limits on individual
  Duration components should ensure that.)

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

0bd083b

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
✅ 🛠 tv ✅ 🛠 mac-safer-cpp ✅ 🛠 jsc-armv7
✅ 🛠 tv-sim ❌ 🧪 jsc-armv7-tests
✅ 🛠 watch
✅ 🛠 watch-sim

@ptomato ptomato requested a review from a team as a code owner August 22, 2025 17:20
@ptomato ptomato self-assigned this Aug 22, 2025
@ptomato ptomato changed the title fixup: Use static_cast instead of C-style casts Refactor implementation of TemporalPlainDate/prototype/add Aug 22, 2025
@ptomato

ptomato commented Aug 22, 2025

Copy link
Copy Markdown
Contributor Author

@catamorphism is out today, so here's my attempt to move the Temporal implementation forward on his behalf - note that he wrote all the code here! The only change I made is to fix up the cast style as per #45603 (comment).

Comment thread Source/JavaScriptCore/runtime/TemporalDuration.cpp Outdated
Comment thread Source/JavaScriptCore/runtime/TemporalDuration.cpp Outdated
Comment thread Source/JavaScriptCore/runtime/ISO8601.h Outdated
@sosukesuzuki

Copy link
Copy Markdown
Contributor

Can you make the commits and PRs follow the WebKit style? There should be one commit per PR.

@ptomato

ptomato commented Aug 26, 2025

Copy link
Copy Markdown
Contributor Author

Can you make the commits and PRs follow the WebKit style? There should be one commit per PR.

Sure. I initially left it separate so it was clear what changes I made to Tim's code.

@ptomato ptomato changed the title Refactor implementation of TemporalPlainDate/prototype/add Part 4: Refactor implementation of TemporalPlainDate/prototype/add Aug 26, 2025
@ptomato ptomato force-pushed the balance-precision-part-4 branch from 5ca9835 to a791524 Compare August 26, 2025 01:37
@ptomato ptomato requested a review from sosukesuzuki August 26, 2025 01:39
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Aug 26, 2025
@ptomato ptomato removed the merging-blocked Applied to prevent a change from being merged label Aug 27, 2025
@ptomato ptomato force-pushed the balance-precision-part-4 branch from a791524 to 432b163 Compare August 27, 2025 18:01
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Aug 28, 2025
@ptomato ptomato removed the merging-blocked Applied to prevent a change from being merged label Aug 28, 2025
@ptomato ptomato force-pushed the balance-precision-part-4 branch from 432b163 to 193ec95 Compare August 29, 2025 15:08
@ptomato

ptomato commented Aug 30, 2025

Copy link
Copy Markdown
Contributor Author

@sosukesuzuki I think I've addressed all the comments and the tests are now green. (the jsc-armv7-tests is an unrelated failure and I understand it is being looked into)

@ptomato ptomato added the request-merge-queue Request a pull request to be added to merge-queue once ready label Aug 30, 2025
Comment thread Source/JavaScriptCore/runtime/TemporalDuration.cpp Outdated
@ptomato ptomato force-pushed the balance-precision-part-4 branch from 193ec95 to 3a58783 Compare September 1, 2025 17:12
@ptomato ptomato requested a review from sosukesuzuki September 1, 2025 17:13
@webkit-ews-buildbot webkit-ews-buildbot added merging-blocked Applied to prevent a change from being merged and removed request-merge-queue Request a pull request to be added to merge-queue once ready labels Sep 1, 2025
@ptomato ptomato 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 Sep 2, 2025

@sosukesuzuki sosukesuzuki left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

r=me

@Ahmad-S792

Copy link
Copy Markdown
Contributor

@ptomato - can you raise bugzilla bug and add it to commit message, it makes it easy in case, if we ned to revert and track (caused by) bugs?

@ptomato ptomato force-pushed the balance-precision-part-4 branch from 3a58783 to 0bd083b Compare September 2, 2025 15:12
@ptomato ptomato added the JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues. label Sep 2, 2025
@ptomato

ptomato commented Sep 2, 2025

Copy link
Copy Markdown
Contributor Author

Done.

@csaavedra csaavedra 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 Sep 2, 2025
https://bugs.webkit.org/show_bug.cgi?id=223166

Reviewed by Sosuke Suzuki.

Add a new operation from the spec, TemporalCalendar::addDurationToDate(),
and use it in the implementation of `add`.

This is a refactoring and shouldn't change anything.

(For reference, modifications by Philip Chimento to address review
comments:)

* Remove ISO8601::isValidISODate() and ISO8601::createISODateRecord()
  since they are not used yet in this PR.
* Expose JSC::checkedCastDoubleToInt128 in ISO8601.h header.
* Replace C-style double-to-Int128 casts with checked casts.
* Assert that TemporalDuration::timeDurationFromComponents and
  add24HourDaysToTimeDuration do not overflow. (The limits on individual
  Duration components should ensure that.)

Canonical link: https://commits.webkit.org/299436@main
@webkit-commit-queue

Copy link
Copy Markdown
Collaborator

Committed 299436@main (707926f): https://commits.webkit.org/299436@main

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

@webkit-commit-queue webkit-commit-queue merged commit 707926f into WebKit:main Sep 2, 2025
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Sep 2, 2025
@ptomato ptomato deleted the balance-precision-part-4 branch September 2, 2025 16:37
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.

8 participants