Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 73e4c589c1e6f099ef31cab839174494da20d909
https://github.com/WebKit/WebKit/commit/73e4c589c1e6f099ef31cab839174494da20d909
Author: Yusuke Suzuki <[email protected]>
Date: 2026-07-29 (Wed, 29 Jul 2026)
Changed paths:
A JSTests/stress/regexp-split-cache-regexp-statics.js
M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
M Source/JavaScriptCore/SaferCPPExpectations/ForwardDeclCheckerExpectations
M Source/JavaScriptCore/Sources.txt
M Source/JavaScriptCore/heap/Heap.cpp
M Source/JavaScriptCore/runtime/RegExpPrototype.cpp
M Source/JavaScriptCore/runtime/StringPrototype.cpp
M Source/JavaScriptCore/runtime/StringPrototypeInlines.h
A Source/JavaScriptCore/runtime/StringSplitCache.cpp
M Source/JavaScriptCore/runtime/StringSplitCache.h
M Source/JavaScriptCore/runtime/StringSplitCacheInlines.h
M Source/JavaScriptCore/runtime/VM.cpp
M Source/JavaScriptCore/runtime/VM.h
Log Message:
-----------
[JSC] Extend StringSplitCache for RegExp
https://bugs.webkit.org/show_bug.cgi?id=320591
rdar://183565424
Reviewed by Yijia Huang.
This patch extends existing StringSplitCache to have RegExp splitting
version as it is also common in practice. We basically follow to the
same conditions used for string split caching. We record extracted range
into a Vector, and materialize it to JSCellButterfly when necessary.
One critical point is that because it is using RegExp for splitting, it
can have a side-effect of updating RegExp cache information (e.g.
RegExp.$1), to achieve that, we record MatchResult as well in the cache
for RegExp case.
Test: JSTests/stress/regexp-split-cache-regexp-statics.js
* JSTests/stress/regexp-split-cache-regexp-statics.js: Added.
(shouldBe):
(statics):
(clobberStatics):
(split):
(regexp):
(check):
* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/JavaScriptCore/SaferCPPExpectations/ForwardDeclCheckerExpectations:
* Source/JavaScriptCore/Sources.txt:
* Source/JavaScriptCore/heap/Heap.cpp:
(JSC::Heap::clearConcurrentRetainedDataIfPossible):
* Source/JavaScriptCore/runtime/RegExpPrototype.cpp:
(JSC::genericSplit):
(JSC::recordSplitSpan):
(JSC::splitSpanCount):
(JSC::createArrayFromSplitSpans):
(JSC::tryAddToRegExpSplitCache):
(JSC::regExpSplitFast):
* Source/JavaScriptCore/runtime/StringPrototype.cpp:
(JSC::stringSplitFast):
(JSC::isASCIIIdentifierStart): Deleted.
* Source/JavaScriptCore/runtime/StringPrototypeInlines.h:
(JSC::isASCIIIdentifierStart):
* Source/JavaScriptCore/runtime/StringSplitCache.cpp: Copied from
Source/JavaScriptCore/runtime/StringSplitCache.h.
* Source/JavaScriptCore/runtime/StringSplitCache.h:
(JSC::StringSplitCache::clear):
(JSC::StringSplitCache::regExpEntryIndex const):
* Source/JavaScriptCore/runtime/StringSplitCacheInlines.h:
(JSC::StringSplitCache::getForString):
(JSC::StringSplitCache::setForString):
(JSC::StringSplitCache::getForRegExp):
(JSC::StringSplitCache::setForRegExp):
(JSC::StringSplitCache::get): Deleted.
(JSC::StringSplitCache::set): Deleted.
* Source/JavaScriptCore/runtime/VM.cpp:
(JSC::VM::VM):
* Source/JavaScriptCore/runtime/VM.h:
(JSC::VM::stringSplitCache):
(JSC::VM::ensureStringSplitCache):
Canonical link: https://commits.webkit.org/318212@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications