Skip to content

Commit

Permalink
+2% in an http benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarred-Sumner committed Aug 22, 2023
1 parent fd79ce3 commit 48c1316
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/runtime/JSDateMath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ namespace JSDateMathInternal {
static constexpr bool verbose = false;
}

#if PLATFORM(COCOA)
#if PLATFORM(COCOA) || USE(BUN_JSC_ADDITIONS)
std::atomic<uint64_t> lastTimeZoneID { 1 };
#endif

Expand Down
10 changes: 7 additions & 3 deletions Source/JavaScriptCore/runtime/JSDateMath.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class VM;

static constexpr double minECMAScriptTime = -8.64E15;

#if PLATFORM(COCOA)
#if PLATFORM(COCOA) || USE(BUN_JSC_ADDITIONS)
extern JS_EXPORT_PRIVATE std::atomic<uint64_t> lastTimeZoneID;
#endif

Expand Down Expand Up @@ -86,7 +86,7 @@ class DateCache {

bool hasTimeZoneChange()
{
#if PLATFORM(COCOA)
#if PLATFORM(COCOA) || USE(BUN_JSC_ADDITIONS)
return m_cachedTimezoneID != lastTimeZoneID;
#else
return true; // always force a time zone check.
Expand All @@ -95,7 +95,7 @@ class DateCache {

void resetIfNecessary()
{
#if PLATFORM(COCOA)
#if PLATFORM(COCOA) || USE(BUN_JSC_ADDITIONS)
if (LIKELY(!hasTimeZoneChange()))
return;
m_cachedTimezoneID = lastTimeZoneID;
Expand All @@ -114,7 +114,11 @@ class DateCache {
double localTimeToMS(double milliseconds, WTF::TimeType);
JS_EXPORT_PRIVATE double parseDate(JSGlobalObject*, VM&, const WTF::String&);

#if USE(BUN_JSC_ADDITIONS)
static void timeZoneChanged() { ++lastTimeZoneID; }
#else
static void timeZoneChanged();
#endif

private:
class DSTCache {
Expand Down

0 comments on commit 48c1316

Please sign in to comment.