RESOLVED FIXED 205517
Make JSString values from literals in a single consistent style
https://bugs.webkit.org/show_bug.cgi?id=205517
Summary Make JSString values from literals in a single consistent style
Darin Adler
Reported 2019-12-20 13:56:34 PST
Make JSString values from literals in a single consistent style
Attachments
Patch (34.82 KB, patch)
2019-12-20 13:59 PST, Darin Adler
saam: review+
Darin Adler
Comment 1 2019-12-20 13:59:00 PST
Saam Barati
Comment 2 2019-12-20 14:02:50 PST
Comment on attachment 386248 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=386248&action=review > Source/JavaScriptCore/ChangeLog:15 > + jsNontrivialString(vm, "literal") Could we use literal string as template to turn this code into what you did?
Darin Adler
Comment 3 2019-12-20 14:50:54 PST
Comment on attachment 386248 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=386248&action=review >> Source/JavaScriptCore/ChangeLog:15 >> + jsNontrivialString(vm, "literal") > > Could we use literal string as template to turn this code into what you did? Yes and no. The two things we need to know: 1) These characters are immortal, so we can point to them instead of copying. 2) The string is not 1 character long. We can make a function template that takes an array of char. This matches a literal and does not match things like "const char*'. That is what we do in various places like the equalLettersIgnoringASCIICase function template. However, this does not distinguish literals from other arrays of char, nor does it determine that the last character of the array is a NUL. However, if we were OK with that limitation, then we could deduce the length of the string from the length of the array (subtracting one), and emit the appropriate code for that case. I don’t think it’s worth it but it’s something I considered.
Darin Adler
Comment 4 2019-12-20 14:51:42 PST
More accurately: the string is more than 1 character long
Darin Adler
Comment 5 2019-12-21 16:43:09 PST
Radar WebKit Bug Importer
Comment 6 2019-12-21 16:44:23 PST
Note You need to log in before you can comment on or make changes to this bug.