[webkit-changes] [WebKit/WebKit] fafab4: [Yarr] Regex Lookbehinds differs from v8

Michael Saboff noreply at github.com
Thu May 16 08:02:30 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fafab41339000ed0ac0088346670e1af020dcf14
      https://github.com/WebKit/WebKit/commit/fafab41339000ed0ac0088346670e1af020dcf14
  Author: Michael Saboff <msaboff at apple.com>
  Date:   2024-05-16 (Thu, 16 May 2024)

  Changed paths:
    M JSTests/stress/regexp-lookbehind.js
    M Source/JavaScriptCore/yarr/YarrInterpreter.cpp

  Log Message:
  -----------
  [Yarr] Regex Lookbehinds differs from v8
https://bugs.webkit.org/show_bug.cgi?id=273254
rdar://127440248

Reviewed by Yusuke Suzuki.

Updated the checked offset calculation for lookbehinds.  The count of characters we need for a lookbehind should not be
dependent of the count for the surrounding expression.  We now use the minimum checked size selected from either the already
checked characters or the parenthesis checked characters (if they are different).  The prior code would check the already checked
parenthesis count first and then the disjunction's minimum size.  Now we take the lessor of the two minimums to compute the
amount we need to check when trying to match the lookbehind.  We still need to uncheck the appropriate amount based on either
the disjunction minimum or parenthesis when we are done handling the lookbehind.  That is now handled with the new variable,
backwardUncheckAmount.

Deleted some dead code discovered while fixing this issue.

New test added.

* JSTests/stress/regexp-lookbehind.js:
* Source/JavaScriptCore/yarr/YarrInterpreter.cpp:
(JSC::Yarr::ByteCompiler::emitDisjunction):

Canonical link: https://commits.webkit.org/278863@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