Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 579b96614b756c61746ae554282b87c7bf7ac3b0
      
https://github.com/WebKit/WebKit/commit/579b96614b756c61746ae554282b87c7bf7ac3b0
  Author: Yusuke Suzuki <[email protected]>
  Date:   2026-01-28 (Wed, 28 Jan 2026)

  Changed paths:
    M Source/JavaScriptCore/assembler/MacroAssemblerARM64.h
    M Source/JavaScriptCore/yarr/YarrJIT.cpp
    M Source/JavaScriptCore/yarr/YarrJITRegisters.h

  Log Message:
  -----------
  [JSC] Add SIMD search path for RegExp fast search
https://bugs.webkit.org/show_bug.cgi?id=306308
rdar://168958736

Reviewed by Yijia Huang.

This patch implements SIMD fast prefix search before entering the RegExp
matching. This is something optimized version compared to BM search in
our RegExp for particular patterns. The idea is derievd from V8's SIMD
search[1]. When there are two alternatives which has 4 characters
preceeding, like /aaaa|bbbb/, then we collect these 4 characters and
create 2 mask. And do a SIMD search to find potential starting index
quickly.

Basic idea of the loop body is,

      if ((input & mask) != chars) {
          // Quick reject - neither pattern can match
          advance by 16
      } else {
          // Check specific patterns
      }

And it is extended for SIMD.

      v1 = load(cursor)
      v2 = load(cursor + 1)
      v3 = load(cursor + 2)
      v4 = load(cursor + 3)

      t1 = (v1 & mask) == chars
      t2 = (v2 & mask) == chars
      t3 = (v3 & mask) == chars
      t4 = (v4 & mask) == chars

      r1 = t1 | t2
      r2 = t3 | t4

      result = tbl2(r1, r2, pattern) // TBL2: extract byte 0 of each 32-bit 
word from {r1, r2}
      if (result) {
          // There is a match
          // Doing a scalar loop.
      }

[1]: https://chromium-review.googlesource.com/c/v8/v8/+/6918972

* Source/JavaScriptCore/assembler/MacroAssemblerARM64.h:
(JSC::MacroAssemblerARM64::move128ToVector):
* Source/JavaScriptCore/yarr/YarrJIT.cpp:
(JSC::Yarr::MaskedAlternativeInfo::computeMaskForCharacterClass):
(JSC::Yarr::MaskedAlternativeInfo::create):
* Source/JavaScriptCore/yarr/YarrJITRegisters.h:

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



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

Reply via email to