RESOLVED FIXED 214231
[JSC] Avoid JSString creation in Intl.Locale#{minimize,maximize}
https://bugs.webkit.org/show_bug.cgi?id=214231
Summary [JSC] Avoid JSString creation in Intl.Locale#{minimize,maximize}
Yusuke Suzuki
Reported 2020-07-11 23:51:13 PDT
[JSC] Avoid JSString creation in Intl.Locale#{minimize,maximize}
Attachments
Patch (3.73 KB, patch)
2020-07-11 23:51 PDT, Yusuke Suzuki
no flags
Patch (3.74 KB, patch)
2020-07-12 00:02 PDT, Yusuke Suzuki
no flags
Yusuke Suzuki
Comment 1 2020-07-11 23:51:56 PDT
Yusuke Suzuki
Comment 2 2020-07-12 00:02:19 PDT
Yusuke Suzuki
Comment 3 2020-07-12 13:07:43 PDT
Comment on attachment 404089 [details] Patch Thanks!
EWS
Comment 4 2020-07-12 13:14:04 PDT
Committed r264285: <https://trac.webkit.org/changeset/264285> All reviewed patches have been landed. Closing bug and clearing flags on attachment 404089 [details].
Radar WebKit Bug Importer
Comment 5 2020-07-12 13:15:19 PDT
Darin Adler
Comment 6 2020-07-12 13:21:30 PDT
Comment on attachment 404089 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=404089&action=review > Source/JavaScriptCore/runtime/IntlLocale.cpp:221 > String tag = tagValue.inherits<IntlLocale>(vm) ? jsCast<IntlLocale*>(tagValue)->toString() : tagValue.toWTFString(globalObject); Is calling IntlLocale::toString better than just calling toWTFString on the tag value? Is the special case here important for correctness? Performance?
Yusuke Suzuki
Comment 7 2020-07-12 13:29:05 PDT
Comment on attachment 404089 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=404089&action=review >> Source/JavaScriptCore/runtime/IntlLocale.cpp:221 >> String tag = tagValue.inherits<IntlLocale>(vm) ? jsCast<IntlLocale*>(tagValue)->toString() : tagValue.toWTFString(globalObject); > > Is calling IntlLocale::toString better than just calling toWTFString on the tag value? Is the special case here important for correctness? Performance? This is important for correctness, and also improves the performance. According to the spec, here is special case. https://tc39.es/ecma402/#sec-Intl.Locale 8. If Type(tag) is Object and tag has an [[InitializedLocale]] internal slot, then 8.a Let tag be tag.[[Locale]]. This means that even if the given locale object has its own `toString` user defined method, initializeLocale should ignore calling this function and instead retrieve toString result from Locale's field directly. And it also improves the performance since we do not need to invoke `toString` JS function here.
Note You need to log in before you can comment on or make changes to this bug.