Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7636f61497084c5b86ae9a6e2d6157bca4f3f7ee
      
https://github.com/WebKit/WebKit/commit/7636f61497084c5b86ae9a6e2d6157bca4f3f7ee
  Author: Yijia Huang <[email protected]>
  Date:   2026-06-10 (Wed, 10 Jun 2026)

  Changed paths:
    M Source/JavaScriptCore/runtime/temporal/core/CalendarICUBridge.cpp

  Log Message:
  -----------
  [JSC][Temporal] Cache ICU UCalendar per CalendarID in CalendarICUBridge
https://bugs.webkit.org/show_bug.cgi?id=316569
rdar://179036919

Reviewed by Yusuke Suzuki.

Previously every CalendarICUBridge call (calendarYear, calendarMonth,
calendarDay, etc.) called ucal_open/ucal_close, allocating and freeing
an ICU calendar object on each invocation.

This patch caches one UCalendar template per CalendarID in a static
per-process Vector. Access is controlled by a per-entry WTF::Lock and
a double-checked atomic initialized flag (acquire/release ordering).

The withCalendar(calendarId, lambda) helper acquires the entry lock,
runs the lambda with the cached UCalendar*, and releases immediately,
keeping lock scope minimal. For operations that need an independent
calendar state (calendarDateUntil month loop, calendarDateFromFields
countCal), the template is cloned via ucal_clone inside the lock.

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



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

Reply via email to