[JSC] Avoid JSString creation in Intl.Locale#{minimize,maximize}
Created attachment 404088 [details] Patch
Created attachment 404089 [details] Patch
Comment on attachment 404089 [details] Patch Thanks!
Committed r264285: <https://trac.webkit.org/changeset/264285> All reviewed patches have been landed. Closing bug and clearing flags on attachment 404089 [details].
<rdar://problem/65441234>
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?
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.