Bug 238420

Summary: Use StringView for Yarr / RegularExpression parsing
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: JavaScriptCoreAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cmarcelo, darin, eric.carlson, ews-watchlist, ggaren, glenn, jer.noble, keith_miller, mark.lam, msaboff, philipj, saam, sam, sergio, tzagallo, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Chris Dumez 2022-03-26 16:01:49 PDT
Use StringView for Yarr / RegularExpression parsing, to avoid unnecessary String construction in some cases. It is not uncommon for the pattern to be a string literal.
Comment 1 Chris Dumez 2022-03-26 16:03:51 PDT
Created attachment 455857 [details]
Patch
Comment 2 EWS 2022-03-28 10:26:27 PDT
Committed r291972 (248936@main): <https://commits.webkit.org/248936@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 455857 [details].
Comment 3 Radar WebKit Bug Importer 2022-03-28 10:27:17 PDT
<rdar://problem/90931200>
Comment 4 Darin Adler 2022-03-28 15:08:42 PDT
Comment on attachment 455857 [details]
Patch

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

> Source/JavaScriptCore/yarr/YarrJIT.cpp:4655
> +    StringView m_patternString;

This could be const StringView.
Comment 5 Chris Dumez 2022-03-28 15:24:48 PDT
(In reply to Darin Adler from comment #4)
> Comment on attachment 455857 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=455857&action=review
> 
> > Source/JavaScriptCore/yarr/YarrJIT.cpp:4655
> > +    StringView m_patternString;
> 
> This could be const StringView.

Fixed in <https://commits.webkit.org/r291997>.