Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e9964c3c018a061aa17b6fb60f9b8ffbbfbcbabf
      
https://github.com/WebKit/WebKit/commit/e9964c3c018a061aa17b6fb60f9b8ffbbfbcbabf
  Author: Yusuke Suzuki <[email protected]>
  Date:   2026-02-03 (Tue, 03 Feb 2026)

  Changed paths:
    M Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp
    M Source/JavaScriptCore/runtime/RegExp.cpp
    M Source/JavaScriptCore/runtime/RegExp.h
    M Source/JavaScriptCore/runtime/RegExpGlobalData.h
    M Source/JavaScriptCore/runtime/RegExpGlobalDataInlines.h
    M Source/JavaScriptCore/runtime/RegExpInlines.h
    M Source/JavaScriptCore/runtime/RegExpMatchesArray.h
    M Source/JavaScriptCore/runtime/StringPrototypeInlines.h
    M Source/JavaScriptCore/runtime/StringReplaceCache.h
    M Source/JavaScriptCore/runtime/StringReplaceCacheInlines.h

  Log Message:
  -----------
  [JSC] RegExp should have offset vector for common use
https://bugs.webkit.org/show_bug.cgi?id=306925
rdar://169589861

Reviewed by Sosuke Suzuki.

Since RegExp can determine how large the offset vector is, we can just
hold Vector<int> in RegExp object and use it for normal matching. This
is efficient compared to allocating Vector frequently for each matching.

This accepts std::span<int> as offset output, and from the main thread,
we pass regExp->ovectorSpan(). But for concurrent execution (e.g.
execution from the JIT compiler), caller set up Vector<int> and passing
mutableSpan to this matching function.

We also remove m_ovector in RegExpGlobalData. It is actually not used in
a meaningful way.

* Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp:
(JSC::DFG::StrengthReductionPhase::handleNode):
* Source/JavaScriptCore/runtime/RegExp.cpp:
(JSC::RegExp::finishCreation):
(JSC::RegExp::estimatedSize):
(JSC::RegExp::match):
(JSC::RegExp::matchConcurrently):
* Source/JavaScriptCore/runtime/RegExp.h:
* Source/JavaScriptCore/runtime/RegExpGlobalData.h:
(JSC::RegExpGlobalData::ovector const): Deleted.
* Source/JavaScriptCore/runtime/RegExpGlobalDataInlines.h:
(JSC::RegExpGlobalData::performMatch):
(JSC::RegExpGlobalData::resetResultFromCache):
* Source/JavaScriptCore/runtime/RegExpInlines.h:
(JSC::RegExp::matchInline):
* Source/JavaScriptCore/runtime/RegExpMatchesArray.h:
(JSC::createRegExpMatchesArray):
* Source/JavaScriptCore/runtime/StringPrototypeInlines.h:
(JSC::addToRegExpSearchCache):
* Source/JavaScriptCore/runtime/StringReplaceCache.h:
* Source/JavaScriptCore/runtime/StringReplaceCacheInlines.h:
(JSC::StringReplaceCache::set):

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



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

Reply via email to