[Webkit-unassigned] [Bug 229826] [JSC] Implement Temporal.Instant

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Sep 23 19:22:52 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=229826

--- Comment #11 from Yusuke Suzuki <ysuzuki at apple.com> ---
Comment on attachment 439114
  --> https://bugs.webkit.org/attachment.cgi?id=439114
Patch for preliminary review

View in context: https://bugs.webkit.org/attachment.cgi?id=439114&action=review

Nice, some quick comments.

> Source/JavaScriptCore/runtime/ISO8601.h:185
> +    static constexpr Int128 DAY_RANGE_S {86400'00000000}; // 1e8 days
> +    static constexpr Int128 NS_PER_MICROS {1000};
> +    static constexpr Int128 NS_PER_MS {1'000'000};
> +    static constexpr Int128 NS_PER_S {1'000'000'000};
> +    static constexpr Int128 NS_PER_MINUTE = NS_PER_S * 60;
> +    static constexpr Int128 NS_PER_HOUR = NS_PER_MINUTE * 60;
> +    static constexpr Int128 MIN_VALUE = -DAY_RANGE_S * NS_PER_S;
> +    static constexpr Int128 MAX_VALUE = DAY_RANGE_S * NS_PER_S;

We do not use capital constants. Rename them like, dayRangeSeconds etc.

> Source/JavaScriptCore/runtime/JSBigInt.cpp:251
> +    if ((unsignedValue & 0xffff'ffff'ffff'ffff) == unsignedValue)

unsignedValue <= UINT64_MAX would be simpler.

> Source/JavaScriptCore/runtime/JSBigInt.cpp:254
> +    if (sizeof(Digit) == 8) {

Use `if constexpr`.

> Source/JavaScriptCore/runtime/JSBigInt.cpp:259
> +        Digit lowBits = static_cast<Digit>(unsignedValue & 0xffff'ffff'ffff'ffff);
> +        Digit highBits = static_cast<Digit>((unsignedValue >> 64) & 0xffff'ffff'ffff'ffff);

I think we do not need these &. Just casting is suffice.

> Source/JavaScriptCore/runtime/JSBigInt.cpp:274
> +    Digit digit0 = static_cast<Digit>(unsignedValue & 0xffff'ffff);
> +    Digit digit1 = static_cast<Digit>((unsignedValue >> 32) & 0xffff'ffff);
> +    Digit digit2 = static_cast<Digit>((unsignedValue >> 64) & 0xffff'ffff);
> +    Digit digit3 = static_cast<Digit>((unsignedValue >> 96) & 0xffff'ffff);

Ditto.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210924/3adb7d90/attachment-0001.htm>


More information about the webkit-unassigned mailing list