diff options
Diffstat (limited to 'deps/v8/src/base/platform/time.h')
-rw-r--r-- | deps/v8/src/base/platform/time.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/deps/v8/src/base/platform/time.h b/deps/v8/src/base/platform/time.h index 0820c6f108..9a41d49b2c 100644 --- a/deps/v8/src/base/platform/time.h +++ b/deps/v8/src/base/platform/time.h @@ -91,10 +91,10 @@ class V8_BASE_EXPORT TimeDelta final { return TimeDelta(nanoseconds / TimeConstants::kNanosecondsPerMicrosecond); } - static TimeDelta FromSecondsD(double seconds) { + static constexpr TimeDelta FromSecondsD(double seconds) { return FromDouble(seconds * TimeConstants::kMicrosecondsPerSecond); } - static TimeDelta FromMillisecondsD(double milliseconds) { + static constexpr TimeDelta FromMillisecondsD(double milliseconds) { return FromDouble(milliseconds * TimeConstants::kMicrosecondsPerMillisecond); } @@ -210,8 +210,7 @@ class V8_BASE_EXPORT TimeDelta final { } private: - // TODO(v8:10620): constexpr requires constexpr saturated_cast. - static inline TimeDelta FromDouble(double value); + static constexpr inline TimeDelta FromDouble(double value); template<class TimeClass> friend class time_internal::TimeBase; // Constructs a delta given the duration in microseconds. This is private @@ -224,7 +223,7 @@ class V8_BASE_EXPORT TimeDelta final { }; // static -TimeDelta TimeDelta::FromDouble(double value) { +constexpr TimeDelta TimeDelta::FromDouble(double value) { return TimeDelta(saturated_cast<int64_t>(value)); } @@ -494,9 +493,15 @@ class V8_BASE_EXPORT ThreadTicks final explicit constexpr ThreadTicks(int64_t ticks) : TimeBase(ticks) {} #if V8_OS_WIN +#if V8_HOST_ARCH_ARM64 + // TSCTicksPerSecond is not supported on Windows on Arm systems because the + // cycle-counting methods use the actual CPU cycle count, and not a consistent + // incrementing counter. +#else // Returns the frequency of the TSC in ticks per second, or 0 if it hasn't // been measured yet. Needs to be guarded with a call to IsSupported(). static double TSCTicksPerSecond(); +#endif static bool IsSupportedWin(); static void WaitUntilInitializedWin(); #endif |