[webkit-changes] [WebKit/WebKit] c7e68e: [Yarr] Fix and re-add non-BMP advancement by two f...

Michael Saboff noreply at github.com
Sun Dec 1 20:15:08 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c7e68e9901f10990504069f86ac36e8d329b776c
      https://github.com/WebKit/WebKit/commit/c7e68e9901f10990504069f86ac36e8d329b776c
  Author: Michael Saboff <msaboff at apple.com>
  Date:   2024-12-01 (Sun, 01 Dec 2024)

  Changed paths:
    A JSTests/stress/regexp-advance-2-non-bmp.js
    M Source/JavaScriptCore/yarr/YarrJIT.cpp
    M Source/JavaScriptCore/yarr/YarrJITRegisters.h
    M Source/WTF/wtf/PlatformEnable.h

  Log Message:
  -----------
  [Yarr] Fix and re-add non-BMP advancement by two from 276031 at main
https://bugs.webkit.org/show_bug.cgi?id=283840
rdar://140709290

Reviewed by Yusuke Suzuki.

When we read a non-BMB code point, consisting of two surrogate code units, and we fail to match any atom in the
body of a RegExp, we were incrementing the subject string index by 1 and going back to the top of the loop to
start matching the pattern again.  Now we dedicate a register to hold either 0 or 1 depending on the width of
the first character read for that loop iteration.  When advancing the index for the next iteration, we add the
value of that register to the updated index.  This eliminates one iteration through the matching loop for each
non-BMP surrogate code point that doesn't match.

When we try to match multiple characters, we always increment by 1, since the multi character optimization
is based on all characters checked at once must be BMP characters.

* JSTests/stress/regexp-advance-2-non-bmp.js: Added.
(arrayToString):
(objectToString):
(dumpValue):
(compareArray):
(compareGroups):
(testRegExp):
(testRegExpSyntaxError):
* Source/JavaScriptCore/yarr/YarrJIT.cpp:
* Source/JavaScriptCore/yarr/YarrJITRegisters.h:
* Source/WTF/wtf/PlatformEnable.h:

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list