Bug 238420 - Use StringView for Yarr / RegularExpression parsing
Summary: Use StringView for Yarr / RegularExpression parsing
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-03-26 16:01 PDT by Chris Dumez
Modified: 2022-03-28 15:24 PDT (History)
18 users (show)

See Also:


Attachments
Patch (21.39 KB, patch)
2022-03-26 16:03 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>.