RESOLVED FIXED 229703
[JSC] Implement Temporal.TimeZone
https://bugs.webkit.org/show_bug.cgi?id=229703
Summary [JSC] Implement Temporal.TimeZone
Yusuke Suzuki
Reported 2021-08-31 02:29:11 PDT
...
Attachments
Patch (66.09 KB, patch)
2021-09-01 21:31 PDT, Yusuke Suzuki
no flags
Patch (85.59 KB, patch)
2021-09-02 00:16 PDT, Yusuke Suzuki
no flags
Patch (89.51 KB, patch)
2021-09-02 01:01 PDT, Yusuke Suzuki
no flags
Patch (89.20 KB, patch)
2021-09-03 01:44 PDT, Yusuke Suzuki
ross.kirsling: review+
Yusuke Suzuki
Comment 1 2021-09-01 21:31:40 PDT
Yusuke Suzuki
Comment 2 2021-09-02 00:16:33 PDT
Yusuke Suzuki
Comment 3 2021-09-02 01:01:40 PDT
Ross Kirsling
Comment 4 2021-09-02 15:24:48 PDT
Comment on attachment 437122 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=437122&action=review > Source/JavaScriptCore/runtime/ISO8601.cpp:42 > +int32_t parseDecimalInt32(const CharType* characters, unsigned length) Nice! You should be able to remove the parseInt.h include too. > Source/JavaScriptCore/runtime/ISO8601.cpp:255 > + // Maximum and minimum values are +-23:59:59.999999999 = +-86399999999999ns, which can be represented by int64_t / double's integer part. nit: Maybe use ± so that it doesn't look like "+-" can occur? > Source/JavaScriptCore/runtime/ISO8601.cpp:256 > + return readCharactersForParsing(string, [](auto buffer) -> std::optional<int64_t> { I feel like it's useful to keep this part in a separate function to avoid having a huge indented lambda, but what do you think? > Source/JavaScriptCore/runtime/ISO8601.cpp:288 > + ASSERT(buffer.hasCharactersRemaining()); This one seems a little excessive, right after checking atEnd(). > Source/JavaScriptCore/runtime/ISO8601.cpp:289 > + bool splittedByColon = false; nit: Technically the participle is still "split", not "splitted". English is weird... > Source/JavaScriptCore/runtime/ISO8601.cpp:313 > + ASSERT(buffer.hasCharactersRemaining()); Ditto (to L288). > Source/JavaScriptCore/runtime/ISO8601.cpp:339 > + ASSERT(buffer.hasCharactersRemaining()); Ditto (to L288). > Source/JavaScriptCore/runtime/ISO8601.cpp:380 > + auto fraction = WTF::numberToStringUnsigned<Vector<LChar, 9>>(nanoseconds); Clever! > Source/JavaScriptCore/runtime/JSGlobalObject.cpp:210 > +#include "TemporalTimeZoneConstructor.h" I don't think you need to include the Constructor header. > Source/JavaScriptCore/runtime/TemporalTimeZone.cpp:65 > +std::optional<TimeZoneID> TemporalTimeZone::isValidTimeZoneName(StringView string) Hmm, this name doesn't make sense given its type. How about something more like "idForTimeZoneName"? > Source/JavaScriptCore/runtime/TemporalTimeZone.cpp:98 > + return jsCast<JSObject*>(timeZoneLike); May as well use timeZoneLikeObject, since you've got it. :) > JSTests/stress/temporal-timezone.js:21 > +let failures = [ "2059:00" might be a good one to add.
Yusuke Suzuki
Comment 5 2021-09-03 01:43:31 PDT
Comment on attachment 437122 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=437122&action=review >> Source/JavaScriptCore/runtime/ISO8601.cpp:42 >> +int32_t parseDecimalInt32(const CharType* characters, unsigned length) > > Nice! You should be able to remove the parseInt.h include too. Ah, still parseDuration etc. is using that. >> Source/JavaScriptCore/runtime/ISO8601.cpp:255 >> + // Maximum and minimum values are +-23:59:59.999999999 = +-86399999999999ns, which can be represented by int64_t / double's integer part. > > nit: Maybe use ± so that it doesn't look like "+-" can occur? Changed. >> Source/JavaScriptCore/runtime/ISO8601.cpp:256 >> + return readCharactersForParsing(string, [](auto buffer) -> std::optional<int64_t> { > > I feel like it's useful to keep this part in a separate function to avoid having a huge indented lambda, but what do you think? Sounds good! Changed. >> Source/JavaScriptCore/runtime/ISO8601.cpp:288 >> + ASSERT(buffer.hasCharactersRemaining()); > > This one seems a little excessive, right after checking atEnd(). Removed. >> Source/JavaScriptCore/runtime/ISO8601.cpp:289 >> + bool splittedByColon = false; > > nit: Technically the participle is still "split", not "splitted". English is weird... Ah! Fixed. >> Source/JavaScriptCore/runtime/ISO8601.cpp:313 >> + ASSERT(buffer.hasCharactersRemaining()); > > Ditto (to L288). Removed. >> Source/JavaScriptCore/runtime/ISO8601.cpp:339 >> + ASSERT(buffer.hasCharactersRemaining()); > > Ditto (to L288). Removed. >> Source/JavaScriptCore/runtime/JSGlobalObject.cpp:210 >> +#include "TemporalTimeZoneConstructor.h" > > I don't think you need to include the Constructor header. Right! Removed. >> Source/JavaScriptCore/runtime/TemporalTimeZone.cpp:65 >> +std::optional<TimeZoneID> TemporalTimeZone::isValidTimeZoneName(StringView string) > > Hmm, this name doesn't make sense given its type. How about something more like "idForTimeZoneName"? Changed >> Source/JavaScriptCore/runtime/TemporalTimeZone.cpp:98 >> + return jsCast<JSObject*>(timeZoneLike); > > May as well use timeZoneLikeObject, since you've got it. :) Right :) Changed. >> JSTests/stress/temporal-timezone.js:21 >> +let failures = [ > > "2059:00" might be a good one to add. Added.
Yusuke Suzuki
Comment 6 2021-09-03 01:44:00 PDT
Ross Kirsling
Comment 7 2021-09-03 10:52:18 PDT
Comment on attachment 437253 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=437253&action=review r=me > Source/JavaScriptCore/runtime/TemporalTimeZone.cpp:36 > +static constexpr bool verbose = false; Seems like you're not actually using this at present. > Source/JavaScriptCore/runtime/TemporalTimeZonePrototype.cpp:31 > +#include "IntlObject.h" Looks like you're already getting this from TemporalTimeZone.h.
Yusuke Suzuki
Comment 8 2021-09-03 13:05:50 PDT
Comment on attachment 437253 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=437253&action=review Thanks! >> Source/JavaScriptCore/runtime/TemporalTimeZone.cpp:36 >> +static constexpr bool verbose = false; > > Seems like you're not actually using this at present. Removed >> Source/JavaScriptCore/runtime/TemporalTimeZonePrototype.cpp:31 >> +#include "IntlObject.h" > > Looks like you're already getting this from TemporalTimeZone.h. Removed
Yusuke Suzuki
Comment 9 2021-09-03 13:23:06 PDT
Radar WebKit Bug Importer
Comment 10 2021-09-03 13:24:22 PDT
Note You need to log in before you can comment on or make changes to this bug.