Title: [291972] trunk/Source
Revision
291972
Author
cdu...@apple.com
Date
2022-03-28 10:25:14 -0700 (Mon, 28 Mar 2022)

Log Message

Use StringView for Yarr / RegularExpression parsing
https://bugs.webkit.org/show_bug.cgi?id=238420

Reviewed by Sam Weinig.

Source/_javascript_Core:

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.

* yarr/RegularExpression.cpp:
(JSC::Yarr::RegularExpression::Private::create):
(JSC::Yarr::RegularExpression::Private::Private):
(JSC::Yarr::RegularExpression::Private::compile):
(JSC::Yarr::RegularExpression::RegularExpression):
(JSC::Yarr::RegularExpression::match const):
(JSC::Yarr::RegularExpression::searchRev const):
(JSC::Yarr::replace):
* yarr/RegularExpression.h:
* yarr/YarrInterpreter.cpp:
(JSC::Yarr::interpret):
* yarr/YarrInterpreter.h:
* yarr/YarrJIT.cpp:
(JSC::Yarr::jitCompile):
(JSC::Yarr::jitCompileInlinedTest):
* yarr/YarrJIT.h:
* yarr/YarrParser.h:
(JSC::Yarr::Parser::Parser):
(JSC::Yarr::parse):
* yarr/YarrPattern.cpp:
(JSC::Yarr::YarrPattern::compile):
(JSC::Yarr::YarrPattern::YarrPattern):
(JSC::Yarr::YarrPattern::dumpPatternString):
(JSC::Yarr::YarrPattern::dumpPattern):
* yarr/YarrPattern.h:
* yarr/YarrSyntaxChecker.cpp:
(JSC::Yarr::checkSyntax):
* yarr/YarrSyntaxChecker.h:

Source/WebCore:

* platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
(WebCore::CDMPrivateMediaSourceAVFObjC::parseKeySystem):

Source/WTF:

Add convenience characters() templated function to StringView, to match String and StringImpl.

* wtf/text/StringView.h:
(WTF::StringView::characters<LChar> const):
(WTF::StringView::characters<UChar> const):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (291971 => 291972)


--- trunk/Source/_javascript_Core/ChangeLog	2022-03-28 17:25:08 UTC (rev 291971)
+++ trunk/Source/_javascript_Core/ChangeLog	2022-03-28 17:25:14 UTC (rev 291972)
@@ -1,3 +1,42 @@
+2022-03-28  Chris Dumez  <cdu...@apple.com>
+
+        Use StringView for Yarr / RegularExpression parsing
+        https://bugs.webkit.org/show_bug.cgi?id=238420
+
+        Reviewed by Sam Weinig.
+
+        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.
+
+        * yarr/RegularExpression.cpp:
+        (JSC::Yarr::RegularExpression::Private::create):
+        (JSC::Yarr::RegularExpression::Private::Private):
+        (JSC::Yarr::RegularExpression::Private::compile):
+        (JSC::Yarr::RegularExpression::RegularExpression):
+        (JSC::Yarr::RegularExpression::match const):
+        (JSC::Yarr::RegularExpression::searchRev const):
+        (JSC::Yarr::replace):
+        * yarr/RegularExpression.h:
+        * yarr/YarrInterpreter.cpp:
+        (JSC::Yarr::interpret):
+        * yarr/YarrInterpreter.h:
+        * yarr/YarrJIT.cpp:
+        (JSC::Yarr::jitCompile):
+        (JSC::Yarr::jitCompileInlinedTest):
+        * yarr/YarrJIT.h:
+        * yarr/YarrParser.h:
+        (JSC::Yarr::Parser::Parser):
+        (JSC::Yarr::parse):
+        * yarr/YarrPattern.cpp:
+        (JSC::Yarr::YarrPattern::compile):
+        (JSC::Yarr::YarrPattern::YarrPattern):
+        (JSC::Yarr::YarrPattern::dumpPatternString):
+        (JSC::Yarr::YarrPattern::dumpPattern):
+        * yarr/YarrPattern.h:
+        * yarr/YarrSyntaxChecker.cpp:
+        (JSC::Yarr::checkSyntax):
+        * yarr/YarrSyntaxChecker.h:
+
 2022-03-27  Lauro Moura  <lmo...@igalia.com>
 
         Unreviewed, non-unified buildfix

Modified: trunk/Source/_javascript_Core/yarr/RegularExpression.cpp (291971 => 291972)


--- trunk/Source/_javascript_Core/yarr/RegularExpression.cpp	2022-03-28 17:25:08 UTC (rev 291971)
+++ trunk/Source/_javascript_Core/yarr/RegularExpression.cpp	2022-03-28 17:25:14 UTC (rev 291972)
@@ -38,18 +38,18 @@
 
 class RegularExpression::Private : public RefCounted<RegularExpression::Private> {
 public:
-    static Ref<Private> create(const String& pattern, TextCaseSensitivity caseSensitivity, MultilineMode multilineMode, UnicodeMode unicodeMode)
+    static Ref<Private> create(StringView pattern, TextCaseSensitivity caseSensitivity, MultilineMode multilineMode, UnicodeMode unicodeMode)
     {
         return adoptRef(*new Private(pattern, caseSensitivity, multilineMode, unicodeMode));
     }
 
 private:
-    Private(const String& pattern, TextCaseSensitivity caseSensitivity, MultilineMode multilineMode, UnicodeMode unicodeMode)
+    Private(StringView pattern, TextCaseSensitivity caseSensitivity, MultilineMode multilineMode, UnicodeMode unicodeMode)
         : m_regExpByteCode(compile(pattern, caseSensitivity, multilineMode, unicodeMode))
     {
     }
 
-    std::unique_ptr<JSC::Yarr::BytecodePattern> compile(const String& patternString, TextCaseSensitivity caseSensitivity, MultilineMode multilineMode, UnicodeMode unicodeMode)
+    std::unique_ptr<JSC::Yarr::BytecodePattern> compile(StringView patternString, TextCaseSensitivity caseSensitivity, MultilineMode multilineMode, UnicodeMode unicodeMode)
     {
         OptionSet<JSC::Yarr::Flags> flags;
 
@@ -82,7 +82,7 @@
     std::unique_ptr<JSC::Yarr::BytecodePattern> m_regExpByteCode;
 };
 
-RegularExpression::RegularExpression(const String& pattern, TextCaseSensitivity caseSensitivity, MultilineMode multilineMode, UnicodeMode unicodeMode)
+RegularExpression::RegularExpression(StringView pattern, TextCaseSensitivity caseSensitivity, MultilineMode multilineMode, UnicodeMode unicodeMode)
     : d(Private::create(pattern, caseSensitivity, multilineMode, unicodeMode))
 {
 }
@@ -102,7 +102,7 @@
     return *this;
 }
 
-int RegularExpression::match(const String& str, int startFrom, int* matchLength) const
+int RegularExpression::match(StringView str, int startFrom, int* matchLength) const
 {
     if (!d->m_regExpByteCode)
         return -1;
@@ -142,7 +142,7 @@
     return offsetVector[0];
 }
 
-int RegularExpression::searchRev(const String& str) const
+int RegularExpression::searchRev(StringView str) const
 {
     // FIXME: This could be faster if it actually searched backwards.
     // Instead, it just searches forwards, multiple times until it finds the last match.
@@ -172,7 +172,7 @@
     return d->lastMatchLength;
 }
 
-void replace(String& string, const RegularExpression& target, const String& replacement)
+void replace(String& string, const RegularExpression& target, StringView replacement)
 {
     int index = 0;
     while (index < static_cast<int>(string.length())) {

Modified: trunk/Source/_javascript_Core/yarr/RegularExpression.h (291971 => 291972)


--- trunk/Source/_javascript_Core/yarr/RegularExpression.h	2022-03-28 17:25:08 UTC (rev 291971)
+++ trunk/Source/_javascript_Core/yarr/RegularExpression.h	2022-03-28 17:25:14 UTC (rev 291972)
@@ -36,14 +36,14 @@
 class JS_EXPORT_PRIVATE RegularExpression {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    explicit RegularExpression(const String&, TextCaseSensitivity = TextCaseSensitive, MultilineMode = MultilineDisabled, UnicodeMode = UnicodeUnawareMode);
+    explicit RegularExpression(StringView, TextCaseSensitivity = TextCaseSensitive, MultilineMode = MultilineDisabled, UnicodeMode = UnicodeUnawareMode);
     ~RegularExpression();
 
     RegularExpression(const RegularExpression&);
     RegularExpression& operator=(const RegularExpression&);
 
-    int match(const String&, int startFrom = 0, int* matchLength = nullptr) const;
-    int searchRev(const String&) const;
+    int match(StringView, int startFrom = 0, int* matchLength = nullptr) const;
+    int searchRev(StringView) const;
 
     int matchedLength() const;
     bool isValid() const;
@@ -53,6 +53,6 @@
     RefPtr<Private> d;
 };
 
-void JS_EXPORT_PRIVATE replace(String&, const RegularExpression&, const String&);
+void JS_EXPORT_PRIVATE replace(String&, const RegularExpression&, StringView);
 
 } } // namespace JSC::Yarr

Modified: trunk/Source/_javascript_Core/yarr/YarrInterpreter.cpp (291971 => 291972)


--- trunk/Source/_javascript_Core/yarr/YarrInterpreter.cpp	2022-03-28 17:25:08 UTC (rev 291971)
+++ trunk/Source/_javascript_Core/yarr/YarrInterpreter.cpp	2022-03-28 17:25:14 UTC (rev 291972)
@@ -2456,7 +2456,7 @@
     return ByteCompiler(pattern).compile(allocator, lock, errorCode);
 }
 
-unsigned interpret(BytecodePattern* bytecode, const String& input, unsigned start, unsigned* output)
+unsigned interpret(BytecodePattern* bytecode, StringView input, unsigned start, unsigned* output)
 {
     SuperSamplerScope superSamplerScope(false);
     if (input.is8Bit())

Modified: trunk/Source/_javascript_Core/yarr/YarrInterpreter.h (291971 => 291972)


--- trunk/Source/_javascript_Core/yarr/YarrInterpreter.h	2022-03-28 17:25:08 UTC (rev 291971)
+++ trunk/Source/_javascript_Core/yarr/YarrInterpreter.h	2022-03-28 17:25:14 UTC (rev 291972)
@@ -393,7 +393,7 @@
 };
 
 JS_EXPORT_PRIVATE std::unique_ptr<BytecodePattern> byteCompile(YarrPattern&, BumpPointerAllocator*, ErrorCode&, ConcurrentJSLock* = nullptr);
-JS_EXPORT_PRIVATE unsigned interpret(BytecodePattern*, const String& input, unsigned start, unsigned* output);
+JS_EXPORT_PRIVATE unsigned interpret(BytecodePattern*, StringView input, unsigned start, unsigned* output);
 unsigned interpret(BytecodePattern*, const LChar* input, unsigned length, unsigned start, unsigned* output);
 unsigned interpret(BytecodePattern*, const UChar* input, unsigned length, unsigned start, unsigned* output);
 

Modified: trunk/Source/_javascript_Core/yarr/YarrJIT.cpp (291971 => 291972)


--- trunk/Source/_javascript_Core/yarr/YarrJIT.cpp	2022-03-28 17:25:08 UTC (rev 291971)
+++ trunk/Source/_javascript_Core/yarr/YarrJIT.cpp	2022-03-28 17:25:14 UTC (rev 291972)
@@ -4093,7 +4093,7 @@
     }
 
 public:
-    YarrGenerator(CCallHelpers& jit, const VM* vm, YarrCodeBlock* codeBlock, const YarrJITRegs& regs, YarrPattern& pattern, const String& patternString, CharSize charSize, JITCompileMode compileMode)
+    YarrGenerator(CCallHelpers& jit, const VM* vm, YarrCodeBlock* codeBlock, const YarrJITRegs& regs, YarrPattern& pattern, StringView patternString, CharSize charSize, JITCompileMode compileMode)
         : m_jit(jit)
         , m_vm(vm)
         , m_codeBlock(codeBlock)
@@ -4112,7 +4112,7 @@
         m_boyerMooreData = static_cast<YarrBoyerMoyerData*>(m_codeBlock);
     }
 
-    YarrGenerator(CCallHelpers& jit, const VM* vm, YarrBoyerMoyerData* yarrBMData, const YarrJITRegs& regs, YarrPattern& pattern, const String& patternString, CharSize charSize, JITCompileMode compileMode)
+    YarrGenerator(CCallHelpers& jit, const VM* vm, YarrBoyerMoyerData* yarrBMData, const YarrJITRegs& regs, YarrPattern& pattern, StringView patternString, CharSize charSize, JITCompileMode compileMode)
         : m_jit(jit)
         , m_vm(vm)
         , m_codeBlock(nullptr)
@@ -4652,7 +4652,7 @@
 
     StackCheck* m_compilationThreadStackChecker { nullptr };
     YarrPattern& m_pattern;
-    const String& m_patternString;
+    StringView m_patternString;
 
     CharSize m_charSize;
     JITCompileMode m_compileMode;
@@ -4724,7 +4724,7 @@
     }
 }
 
-void jitCompile(YarrPattern& pattern, String& patternString, CharSize charSize, VM* vm, YarrCodeBlock& codeBlock, JITCompileMode mode)
+void jitCompile(YarrPattern& pattern, StringView patternString, CharSize charSize, VM* vm, YarrCodeBlock& codeBlock, JITCompileMode mode)
 {
     CCallHelpers masm;
 
@@ -4747,7 +4747,7 @@
 #error "No support for inlined JIT'ing of RegExp.test for this CPU / OS combination."
 #endif
 
-void jitCompileInlinedTest(StackCheck* m_compilationThreadStackChecker, const String& patternString, OptionSet<Yarr::Flags> flags, CharSize charSize, const VM* vm, YarrBoyerMoyerData& boyerMooreData, CCallHelpers& jit, YarrJITRegisters& jitRegisters)
+void jitCompileInlinedTest(StackCheck* m_compilationThreadStackChecker, StringView patternString, OptionSet<Yarr::Flags> flags, CharSize charSize, const VM* vm, YarrBoyerMoyerData& boyerMooreData, CCallHelpers& jit, YarrJITRegisters& jitRegisters)
 {
     Yarr::ErrorCode errorCode;
     Yarr::YarrPattern pattern(patternString, flags, errorCode);

Modified: trunk/Source/_javascript_Core/yarr/YarrJIT.h (291971 => 291972)


--- trunk/Source/_javascript_Core/yarr/YarrJIT.h	2022-03-28 17:25:08 UTC (rev 291971)
+++ trunk/Source/_javascript_Core/yarr/YarrJIT.h	2022-03-28 17:25:14 UTC (rev 291972)
@@ -433,7 +433,7 @@
     IncludeSubpatterns,
     InlineTest
 };
-void jitCompile(YarrPattern&, String& patternString, CharSize, VM*, YarrCodeBlock& jitObject, JITCompileMode);
+void jitCompile(YarrPattern&, StringView patternString, CharSize, VM*, YarrCodeBlock& jitObject, JITCompileMode);
 
 #if ENABLE(YARR_JIT_REGEXP_TEST_INLINE)
 
@@ -440,7 +440,7 @@
 
 class YarrJITRegisters;
 
-void jitCompileInlinedTest(StackCheck*, const String&, OptionSet<Yarr::Flags>, CharSize, const VM*, YarrBoyerMoyerData&, CCallHelpers&, YarrJITRegisters&);
+void jitCompileInlinedTest(StackCheck*, StringView, OptionSet<Yarr::Flags>, CharSize, const VM*, YarrBoyerMoyerData&, CCallHelpers&, YarrJITRegisters&);
 #endif
 
 } } // namespace JSC::Yarr

Modified: trunk/Source/_javascript_Core/yarr/YarrParser.h (291971 => 291972)


--- trunk/Source/_javascript_Core/yarr/YarrParser.h	2022-03-28 17:25:08 UTC (rev 291971)
+++ trunk/Source/_javascript_Core/yarr/YarrParser.h	2022-03-28 17:25:14 UTC (rev 291972)
@@ -41,7 +41,7 @@
 class Parser {
 private:
     template<class FriendDelegate>
-    friend ErrorCode parse(FriendDelegate&, const String& pattern, bool isUnicode, unsigned backReferenceLimit, bool isNamedForwardReferenceAllowed);
+    friend ErrorCode parse(FriendDelegate&, StringView pattern, bool isUnicode, unsigned backReferenceLimit, bool isNamedForwardReferenceAllowed);
 
     enum class UnicodeParseContext : uint8_t { PatternCodePoint, GroupName };
 
@@ -219,7 +219,7 @@
         UChar32 m_character;
     };
 
-    Parser(Delegate& delegate, const String& pattern, bool isUnicode, unsigned backReferenceLimit, bool isNamedForwardReferenceAllowed)
+    Parser(Delegate& delegate, StringView pattern, bool isUnicode, unsigned backReferenceLimit, bool isNamedForwardReferenceAllowed)
         : m_delegate(delegate)
         , m_data(pattern.characters<CharType>())
         , m_size(pattern.length())
@@ -1287,7 +1287,7 @@
  */
 
 template<class Delegate>
-ErrorCode parse(Delegate& delegate, const String& pattern, bool isUnicode, unsigned backReferenceLimit = quantifyInfinite, bool isNamedForwardReferenceAllowed = true)
+ErrorCode parse(Delegate& delegate, const StringView pattern, bool isUnicode, unsigned backReferenceLimit = quantifyInfinite, bool isNamedForwardReferenceAllowed = true)
 {
     if (pattern.is8Bit())
         return Parser<Delegate, LChar>(delegate, pattern, isUnicode, backReferenceLimit, isNamedForwardReferenceAllowed).parse();

Modified: trunk/Source/_javascript_Core/yarr/YarrPattern.cpp (291971 => 291972)


--- trunk/Source/_javascript_Core/yarr/YarrPattern.cpp	2022-03-28 17:25:08 UTC (rev 291971)
+++ trunk/Source/_javascript_Core/yarr/YarrPattern.cpp	2022-03-28 17:25:14 UTC (rev 291972)
@@ -1108,7 +1108,7 @@
     bool m_invertParentheticalAssertion { false };
 };
 
-ErrorCode YarrPattern::compile(const String& patternString)
+ErrorCode YarrPattern::compile(StringView patternString)
 {
     YarrPatternConstructor constructor(*this);
 
@@ -1137,7 +1137,7 @@
     return ErrorCode::NoError;
 }
 
-YarrPattern::YarrPattern(const String& pattern, OptionSet<Flags> flags, ErrorCode& error)
+YarrPattern::YarrPattern(StringView pattern, OptionSet<Flags> flags, ErrorCode& error)
     : m_containsBackreferences(false)
     , m_containsBOL(false)
     , m_containsUnsignedLengthPattern(false)
@@ -1381,7 +1381,7 @@
     }
 }
 
-void YarrPattern::dumpPatternString(PrintStream& out, const String& patternString)
+void YarrPattern::dumpPatternString(PrintStream& out, StringView patternString)
 {
     out.print("/", patternString, "/");
 
@@ -1397,12 +1397,12 @@
         out.print("y");
 }
 
-void YarrPattern::dumpPattern(const String& patternString)
+void YarrPattern::dumpPattern(StringView patternString)
 {
     dumpPattern(WTF::dataFile(), patternString);
 }
 
-void YarrPattern::dumpPattern(PrintStream& out, const String& patternString)
+void YarrPattern::dumpPattern(PrintStream& out, StringView patternString)
 {
     out.print("RegExp pattern for ");
     dumpPatternString(out, patternString);

Modified: trunk/Source/_javascript_Core/yarr/YarrPattern.h (291971 => 291972)


--- trunk/Source/_javascript_Core/yarr/YarrPattern.h	2022-03-28 17:25:08 UTC (rev 291971)
+++ trunk/Source/_javascript_Core/yarr/YarrPattern.h	2022-03-28 17:25:14 UTC (rev 291972)
@@ -387,7 +387,7 @@
 
 
 struct YarrPattern {
-    JS_EXPORT_PRIVATE YarrPattern(const String& pattern, OptionSet<Flags>, ErrorCode&);
+    JS_EXPORT_PRIVATE YarrPattern(StringView pattern, OptionSet<Flags>, ErrorCode&);
 
     void resetForReparsing()
     {
@@ -518,9 +518,9 @@
         return unicodePropertiesCached.get(classID);
     }
 
-    void dumpPatternString(PrintStream& out, const String& patternString);
-    void dumpPattern(const String& pattern);
-    void dumpPattern(PrintStream& out, const String& pattern);
+    void dumpPatternString(PrintStream& out, StringView patternString);
+    void dumpPattern(StringView pattern);
+    void dumpPattern(PrintStream& out, StringView pattern);
 
     bool global() const { return m_flags.contains(Flags::Global); }
     bool ignoreCase() const { return m_flags.contains(Flags::IgnoreCase); }
@@ -545,7 +545,7 @@
     HashMap<String, unsigned> m_namedGroupToParenIndex;
 
 private:
-    ErrorCode compile(const String& patternString);
+    ErrorCode compile(StringView patternString);
 
     CharacterClass* anycharCached { nullptr };
     CharacterClass* newlineCached { nullptr };

Modified: trunk/Source/_javascript_Core/yarr/YarrSyntaxChecker.cpp (291971 => 291972)


--- trunk/Source/_javascript_Core/yarr/YarrSyntaxChecker.cpp	2022-03-28 17:25:08 UTC (rev 291971)
+++ trunk/Source/_javascript_Core/yarr/YarrSyntaxChecker.cpp	2022-03-28 17:25:14 UTC (rev 291972)
@@ -54,7 +54,7 @@
     void resetForReparsing() { }
 };
 
-ErrorCode checkSyntax(const String& pattern, const String& flags)
+ErrorCode checkSyntax(StringView pattern, StringView flags)
 {
     SyntaxChecker syntaxChecker;
 

Modified: trunk/Source/_javascript_Core/yarr/YarrSyntaxChecker.h (291971 => 291972)


--- trunk/Source/_javascript_Core/yarr/YarrSyntaxChecker.h	2022-03-28 17:25:08 UTC (rev 291971)
+++ trunk/Source/_javascript_Core/yarr/YarrSyntaxChecker.h	2022-03-28 17:25:14 UTC (rev 291972)
@@ -30,6 +30,6 @@
 
 namespace JSC { namespace Yarr {
 
-ErrorCode checkSyntax(const String& pattern, const String& flags);
+ErrorCode checkSyntax(StringView pattern, StringView flags);
 
 }} // JSC::Yarr

Modified: trunk/Source/WTF/ChangeLog (291971 => 291972)


--- trunk/Source/WTF/ChangeLog	2022-03-28 17:25:08 UTC (rev 291971)
+++ trunk/Source/WTF/ChangeLog	2022-03-28 17:25:14 UTC (rev 291972)
@@ -1,3 +1,16 @@
+2022-03-28  Chris Dumez  <cdu...@apple.com>
+
+        Use StringView for Yarr / RegularExpression parsing
+        https://bugs.webkit.org/show_bug.cgi?id=238420
+
+        Reviewed by Sam Weinig.
+
+        Add convenience characters() templated function to StringView, to match String and StringImpl.
+
+        * wtf/text/StringView.h:
+        (WTF::StringView::characters<LChar> const):
+        (WTF::StringView::characters<UChar> const):
+
 2022-03-27  Alexander Mikhaylenko  <al...@gnome.org>
 
         [GTK][WPE] Support CSS accent-color

Modified: trunk/Source/WTF/wtf/text/StringView.h (291971 => 291972)


--- trunk/Source/WTF/wtf/text/StringView.h	2022-03-28 17:25:08 UTC (rev 291971)
+++ trunk/Source/WTF/wtf/text/StringView.h	2022-03-28 17:25:14 UTC (rev 291972)
@@ -94,6 +94,9 @@
     const LChar* characters8() const;
     const UChar* characters16() const;
 
+    // Return characters8() or characters16() depending on CharacterType.
+    template<typename CharacterType> const CharacterType* characters() const;
+
     bool isAllASCII() const;
 
     String toString() const;
@@ -428,6 +431,16 @@
     return static_cast<const UChar*>(m_characters);
 }
 
+template<> ALWAYS_INLINE const LChar* StringView::characters<LChar>() const
+{
+    return characters8();
+}
+
+template<> ALWAYS_INLINE const UChar* StringView::characters<UChar>() const
+{
+    return characters16();
+}
+
 inline bool StringView::isAllASCII() const
 {
     if (is8Bit())

Modified: trunk/Source/WebCore/ChangeLog (291971 => 291972)


--- trunk/Source/WebCore/ChangeLog	2022-03-28 17:25:08 UTC (rev 291971)
+++ trunk/Source/WebCore/ChangeLog	2022-03-28 17:25:14 UTC (rev 291972)
@@ -1,3 +1,13 @@
+2022-03-28  Chris Dumez  <cdu...@apple.com>
+
+        Use StringView for Yarr / RegularExpression parsing
+        https://bugs.webkit.org/show_bug.cgi?id=238420
+
+        Reviewed by Sam Weinig.
+
+        * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
+        (WebCore::CDMPrivateMediaSourceAVFObjC::parseKeySystem):
+
 2022-03-28  Diego Pino Garcia  <dp...@igalia.com>
 
         [GLIB] Fix build error 'not match operator !=' in Ubuntu LTS after r291696

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm (291971 => 291972)


--- trunk/Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm	2022-03-28 17:25:08 UTC (rev 291971)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm	2022-03-28 17:25:14 UTC (rev 291972)
@@ -46,7 +46,7 @@
 
 auto CDMPrivateMediaSourceAVFObjC::parseKeySystem(const String& keySystem) -> std::optional<KeySystemParameters>
 {
-    static NeverDestroyed<RegularExpression> keySystemRE("^com\\.apple\\.fps\\.[23]_\\d+(?:,\\d+)*$"_s, JSC::Yarr::TextCaseInsensitive);
+    static NeverDestroyed<RegularExpression> keySystemRE("^com\\.apple\\.fps\\.[23]_\\d+(?:,\\d+)*$", JSC::Yarr::TextCaseInsensitive);
 
     if (keySystemRE.get().match(keySystem) < 0)
         return std::nullopt;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to