Bug 223783 - [JSC] Use new Apple ICU APIs to avoid C++ ICU API usage
Summary: [JSC] Use new Apple ICU APIs to avoid C++ ICU API usage
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords: InRadar
: 222160 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-03-25 23:11 PDT by Yusuke Suzuki
Modified: 2021-04-18 02:33 PDT (History)
10 users (show)

See Also:


Attachments
Patch (11.54 KB, patch)
2021-03-25 23:12 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (10.39 KB, patch)
2021-03-25 23:17 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (11.34 KB, patch)
2021-03-26 02:40 PDT, Yusuke Suzuki
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (10.78 KB, patch)
2021-03-26 02:51 PDT, Yusuke Suzuki
mark.lam: review+
ews-feeder: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2021-03-25 23:11:13 PDT
[JSC] Use new Apple ICU APIs to avoid C++ ICU API usage
Comment 1 Yusuke Suzuki 2021-03-25 23:12:41 PDT
Created attachment 424320 [details]
Patch
Comment 2 Yusuke Suzuki 2021-03-25 23:12:44 PDT
<rdar://problem/75060240>
Comment 3 Yusuke Suzuki 2021-03-25 23:17:11 PDT
Created attachment 424321 [details]
Patch
Comment 4 Mark Lam 2021-03-26 02:09:17 PDT
Comment on attachment 424321 [details]
Patch

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

> Source/JavaScriptCore/runtime/JSDateMath.cpp:107
> +#endif

Why not just have an #else
    using OpaqueICUTimeZone = icu::Timezone;
here and avoid all the bitwise_cast, as well as remove some of the #if HAVE(ICU_C_TIMEZONE_API) below?
Comment 5 Yusuke Suzuki 2021-03-26 02:38:25 PDT
Comment on attachment 424321 [details]
Patch

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

>> Source/JavaScriptCore/runtime/JSDateMath.cpp:107
>> +#endif
> 
> Why not just have an #else
>     using OpaqueICUTimeZone = icu::Timezone;
> here and avoid all the bitwise_cast, as well as remove some of the #if HAVE(ICU_C_TIMEZONE_API) below?

That sounds nice. Changed.
Comment 6 Yusuke Suzuki 2021-03-26 02:40:35 PDT
Created attachment 424337 [details]
Patch
Comment 7 Yusuke Suzuki 2021-03-26 02:50:07 PDT
Comment on attachment 424321 [details]
Patch

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

>>> Source/JavaScriptCore/runtime/JSDateMath.cpp:107
>>> +#endif
>> 
>> Why not just have an #else
>>     using OpaqueICUTimeZone = icu::Timezone;
>> here and avoid all the bitwise_cast, as well as remove some of the #if HAVE(ICU_C_TIMEZONE_API) below?
> 
> That sounds nice. Changed.

Ah, this does not work. using (typedef) and class forward declaration are different.
Comment 8 Yusuke Suzuki 2021-03-26 02:51:37 PDT
Created attachment 424339 [details]
Patch
Comment 9 Mark Lam 2021-03-26 08:55:37 PDT
Comment on attachment 424339 [details]
Patch

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

r=me.  Please make sure that the mac-AS-debug-wk2 bot failure is not real.

> Source/JavaScriptCore/runtime/JSDateMath.cpp:133
> +    // The above can fail if input date is invalid: NaN etc.
> +    // We can return any values in this case since later we fail when computing non timezone offset part anyway.
> +    constexpr LocalTimeOffset failed { false, 0 };

"The above" sounds wrong since there's no code that has any effect above.  How about changing it to "This function"?

This failed return value also seem to contradict the comment above the function which states that "If this function is called with NaN it returns NaN."  Maybe remove the comment above the function?
Comment 10 Yusuke Suzuki 2021-03-26 13:04:52 PDT
Comment on attachment 424339 [details]
Patch

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

Thanks. And AS fail is media/media-fragments/TC0051.html, which is known flaky these days.

>> Source/JavaScriptCore/runtime/JSDateMath.cpp:133
>> +    constexpr LocalTimeOffset failed { false, 0 };
> 
> "The above" sounds wrong since there's no code that has any effect above.  How about changing it to "This function"?
> 
> This failed return value also seem to contradict the comment above the function which states that "If this function is called with NaN it returns NaN."  Maybe remove the comment above the function?

Yes, I've changed them.
Comment 11 Yusuke Suzuki 2021-03-26 13:07:45 PDT
Committed r275109 (235817@main): <https://commits.webkit.org/235817@main>
Comment 12 Yusuke Suzuki 2021-04-18 02:33:41 PDT
*** Bug 222160 has been marked as a duplicate of this bug. ***