Skip to content

[JSC] Make RegExp Matched Array creation faster - #78209

Open
Constellation wants to merge 1 commit into
WebKit:mainfrom
Constellation:cheap-regexp-match-array
Open

Constellation wants to merge 1 commit into
WebKit:mainfrom
Constellation:cheap-regexp-match-array

Conversation

@Constellation

@Constellation Constellation commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

178b264

[JSC] Make RegExp Matched Array creation faster
https://bugs.webkit.org/show_bug.cgi?id=328828
rdar://190940940

Reviewed by NOBODY (OOPS!).

This patch makes RegExp Matched Array creation faster by
setting necessary fields when creating a butterfly.
This makes a lot of things unnecessary (e.g. write-barrier).

* Source/JavaScriptCore/runtime/JSArray.cpp:
(JSC::JSArray::tryCreateUninitializedRestrictedButterfly):
(JSC::JSArray::tryCreateUninitializedRestricted):
* Source/JavaScriptCore/runtime/JSArray.h:
* Source/JavaScriptCore/runtime/RegExpMatchesArray.cpp:
(JSC::tryCreateUninitializedRegExpMatchesArrayHavingABadTime):
(JSC::createEmptyRegExpMatchesArray):
(JSC::createRegExpMatchesArrayWithGroupsOrIndices):
(JSC::createRegExpMatchesArrayForPlainRegExpHavingABadTime):
* Source/JavaScriptCore/runtime/RegExpMatchesArray.h:
(JSC::initializeRegExpMatchesArrayOutOfLineProperties):
(JSC::tryCreateUninitializedRegExpMatchesArray):
(JSC::createRegExpMatchesArrayForPlainRegExp):

178b264

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win ⏳ 🛠 ios-apple
✅ 🛠 ios-sim ✅ 🛠 mac-cmake-debug ✅ 🧪 wpe-wk2 ✅ 🧪 win-tests ⏳ 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe ⏳ 🛠 vision-apple
✅ 🧪 ios-wk2-wpt ✅ 🧪 api-mac-cmake-debug ✅ 🧪 jsc-wpe
✅ 🧪 jsc-x86-64 ✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk3-gcc
✅ 🛠 🧪 jsc-debug-arm64 ✅ 🛠 ios-safer-cpp ✅ 🧪 mac-cmake-debug-wk2 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-intel-wk2 ✅ 🧪 api-gtk
✅ 🧪 vision-wk2 ✅ 🛠 mac-safer-cpp ✅ 🛠 playstation
✅ 🛠 tv ✅ 🧪 mac-site-isolation
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

https://bugs.webkit.org/show_bug.cgi?id=328828
rdar://190940940

Reviewed by NOBODY (OOPS!).

This patch makes RegExp Matched Array creation faster by
setting necessary fields when creating a butterfly.
This makes a lot of things unnecessary (e.g. write-barrier).

* Source/JavaScriptCore/runtime/JSArray.cpp:
(JSC::JSArray::tryCreateUninitializedRestrictedButterfly):
(JSC::JSArray::tryCreateUninitializedRestricted):
* Source/JavaScriptCore/runtime/JSArray.h:
* Source/JavaScriptCore/runtime/RegExpMatchesArray.cpp:
(JSC::tryCreateUninitializedRegExpMatchesArrayHavingABadTime):
(JSC::createEmptyRegExpMatchesArray):
(JSC::createRegExpMatchesArrayWithGroupsOrIndices):
(JSC::createRegExpMatchesArrayForPlainRegExpHavingABadTime):
* Source/JavaScriptCore/runtime/RegExpMatchesArray.h:
(JSC::initializeRegExpMatchesArrayOutOfLineProperties):
(JSC::tryCreateUninitializedRegExpMatchesArray):
(JSC::createRegExpMatchesArrayForPlainRegExp):
@Constellation
Constellation requested a review from a team as a code owner October 25, 2026 07:41
@Constellation Constellation self-assigned this Oct 25, 2026
@Constellation Constellation added the JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues. label Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants