[webkit-changes] [WebKit/WebKit] c5df08: [JSC] Cache last YearMonthDay computation results ...

Yusuke Suzuki noreply at github.com
Fri Jun 16 17:02:22 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c5df085fea8f416379d2aca2557a82f77997535e
      https://github.com/WebKit/WebKit/commit/c5df085fea8f416379d2aca2557a82f77997535e
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2023-06-16 (Fri, 16 Jun 2023)

  Changed paths:
    M Source/JavaScriptCore/runtime/JSDateMath.cpp
    M Source/JavaScriptCore/runtime/JSDateMath.h
    M Source/WTF/wtf/GregorianDateTime.cpp
    M Source/WTF/wtf/GregorianDateTime.h

  Log Message:
  -----------
  [JSC] Cache last YearMonthDay computation results in DateCache
https://bugs.webkit.org/show_bug.cgi?id=258224
rdar://110923070

Reviewed by Justin Michaud.

yearMonthDayFromDays is very costly operation, so DateCache should cache the last result based on the days.
This patch adds a cache inspired from V8's cache. We will further extend our DateCache to purge Ref<DateInstanceData> next.

* Source/JavaScriptCore/runtime/JSDateMath.cpp:
(JSC::DateCache::yearMonthDayFromDaysWithCache):
(JSC::DateCache::msToGregorianDateTime):
(JSC::DateCache::resetIfNecessarySlow):
* Source/JavaScriptCore/runtime/JSDateMath.h:
* Source/WTF/wtf/GregorianDateTime.cpp:
(WTF::GregorianDateTime::GregorianDateTime):
* Source/WTF/wtf/GregorianDateTime.h:

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




More information about the webkit-changes mailing list