Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: aaee2a6f166a1cda4ee3876c665bceb8a7988d3f
      
https://github.com/WebKit/WebKit/commit/aaee2a6f166a1cda4ee3876c665bceb8a7988d3f
  Author: Michael Saboff <[email protected]>
  Date:   2025-04-23 (Wed, 23 Apr 2025)

  Changed paths:
    A JSTests/microbenchmarks/regexp-non-bmp-matching.js
    M Source/JavaScriptCore/assembler/MacroAssemblerARM64.h
    M Source/JavaScriptCore/jit/JITThunks.cpp
    M Source/JavaScriptCore/jit/JITThunks.h
    M Source/JavaScriptCore/yarr/YarrJIT.cpp
    M Source/JavaScriptCore/yarr/YarrJIT.h
    M Source/JavaScriptCore/yarr/YarrJITRegisters.h

  Log Message:
  -----------
  [Yarr] Improve reading of Surrogate Pairs in Unicode Regular Expressions
https://bugs.webkit.org/show_bug.cgi?id=291923
rdar://149811541

Reviewed by Daniel Liu.

Restructured the read possible surrogate pairs helper 
Yarr::tryReadUnicodeCharImpl() to try to read two
characters at once, then check to see if those two characters are well formed 
surrogate pair and then
return the resulting non-BMP codepoint.  If they are a surrogate pair, we 
return either the first single
character or an error if we happened to read in a trailing surrogate that was 
preceded by a leading
surrogate.

Turned the helper into an on demand thunk to reduce the amount of JIT'ed code 
when we have more than one
unicode enabled RegExp's.  Also made the areCanonicallyEquivalentThunk an on 
demand thunk.

Added the set flags variant of the ARM64 AND instruction as it appears that 
setting the flags as part
of the AND operation may be slightly more performant than doing a separate 
compare to zero.

Added a new micro benchmark, regexp-non-bmp-matching.js, to verify the 
performance improvement.
This change improves that benchmark by about 2%.

                                Baseline          TuneReadUnicode

regexp-non-bmp-matching     38.6839+-0.2168   ^   37.9023+-0.1007    ^ 
definitely 1.0206x faster

<geometric>                 38.6839+-0.2168   ^   37.9023+-0.1007    ^ 
definitely 1.0206x faster

* JSTests/microbenchmarks/regexp-non-bmp-matching.js: Added.
(arrayToString):
(objectToString):
(dumpValue):
(compareArray):
(compareGroups):
(testRegExp):
(testRegExpSyntaxError):
* Source/JavaScriptCore/assembler/MacroAssemblerARM64.h:
(JSC::MacroAssemblerARM64::add32AndSetFlags):
(JSC::MacroAssemblerARM64::add64AndSetFlags):
(JSC::MacroAssemblerARM64::and32AndSetFlags):
* Source/JavaScriptCore/jit/JITThunks.cpp:
(JSC::JITThunks::initialize):
* Source/JavaScriptCore/jit/JITThunks.h:
* Source/JavaScriptCore/yarr/YarrJIT.cpp:
(JSC::Yarr::tryReadUnicodeCharImpl):
(JSC::Yarr::tryReadUnicodeCharThunkGenerator):
(JSC::Yarr::tryReadUnicodeCharIncForNonBMPThunkGenerator):
(JSC::Yarr::areCanonicallyEquivalentThunkGenerator):
* Source/JavaScriptCore/yarr/YarrJIT.h:
* Source/JavaScriptCore/yarr/YarrJITRegisters.h:

Canonical link: https://commits.webkit.org/294046@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to