[JSC] Implement String#split in C++#64204
Merged
webkit-commit-queue merged 1 commit intoMay 8, 2026
Merged
Conversation
Collaborator
|
EWS run on previous version of this PR (hash 2509a17) Details |
Collaborator
iOS Safer C++ Build #18112 (2509a17)❌ Found 1 failing file with 2 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming. |
Collaborator
macOS Safer C++ Build #99775 (2509a17)❌ Found 1 failing file with 2 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming. |
2509a17 to
ec8b532
Compare
Collaborator
|
EWS run on previous version of this PR (hash ec8b532) Details |
ec8b532 to
885a6ec
Compare
Collaborator
|
EWS run on current version of this PR (hash 885a6ec) Details |
Constellation
approved these changes
May 8, 2026
https://bugs.webkit.org/show_bug.cgi?id=314009 Reviewed by Yusuke Suzuki. Move String.prototype.split from a JS builtin to a C++ host function and add a StringSplit DFG node. The node does not inline anything itself; it just dispatches to operationStringSplit (string separator) or operationStringSplitRegExp (primordial RegExp separator). To make the RegExp fast path safe, splitSymbol is added to regExpPrimordialPropertiesWatchpointSet, m_stringSymbolSplitWatchpointSet is introduced (mirroring the replace counterpart), and m_regExpSpeciesWatchpointSet is added so an override of RegExp[Symbol.species] invalidates the shortcut. Per-instance @@split overrides are caught by the existing structure check in isSymbolSplitFastAndNonObservable. TipOfTree Patched regexp-split-digit-literal 83.6760+-2.5457 ^ 74.9740+-1.7527 ^ definitely 1.1161x faster regexp-split-digit-cached 86.0425+-1.5091 ^ 76.5833+-1.9675 ^ definitely 1.1235x faster string-split-slash-short 93.2927+-3.7145 ^ 76.8576+-0.6003 ^ definitely 1.2138x faster string-split-comma-short 96.1436+-6.8025 ^ 77.8741+-1.0157 ^ definitely 1.2346x faster Tests: JSTests/microbenchmarks/regexp-split-digit-cached.js JSTests/microbenchmarks/regexp-split-digit-literal.js JSTests/microbenchmarks/string-split-comma-short.js JSTests/microbenchmarks/string-split-slash-short.js * JSTests/microbenchmarks/regexp-split-digit-cached.js: Added. (split): * JSTests/microbenchmarks/regexp-split-digit-literal.js: Added. (split): * JSTests/microbenchmarks/string-split-comma-short.js: Added. (split): * JSTests/microbenchmarks/string-split-slash-short.js: Added. (split): * Source/JavaScriptCore/builtins/BuiltinNames.h: * Source/JavaScriptCore/builtins/StringPrototype.js: (split): Deleted. * Source/JavaScriptCore/bytecode/LinkTimeConstant.h: * Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * Source/JavaScriptCore/dfg/DFGBackwardsPropagationPhase.cpp: (JSC::DFG::BackwardsPropagationPhase::propagate): * Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleIntrinsicCall): * Source/JavaScriptCore/dfg/DFGClobberize.h: (JSC::DFG::clobberize): * Source/JavaScriptCore/dfg/DFGCloneHelper.h: * Source/JavaScriptCore/dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * Source/JavaScriptCore/dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * Source/JavaScriptCore/dfg/DFGGraph.h: * Source/JavaScriptCore/dfg/DFGJITCode.cpp: (JSC::DFG::JITData::JITData): (JSC::DFG::JITData::tryInitialize): * Source/JavaScriptCore/dfg/DFGJITCode.h: * Source/JavaScriptCore/dfg/DFGNodeType.h: * Source/JavaScriptCore/dfg/DFGOperations.cpp: (JSC::DFG::JSC_DEFINE_JIT_OPERATION): * Source/JavaScriptCore/dfg/DFGOperations.h: * Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp: * Source/JavaScriptCore/dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp: * Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h: * Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * Source/JavaScriptCore/ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): (JSC::FTL::DFG::LowerDFGToB3::compileStringSplit): * Source/JavaScriptCore/runtime/Intrinsic.h: * Source/JavaScriptCore/runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): * Source/JavaScriptCore/runtime/JSGlobalObject.h: * Source/JavaScriptCore/runtime/RegExpObject.h: * Source/JavaScriptCore/runtime/RegExpObjectInlines.h: (JSC::RegExpObject::isSymbolReplaceFastAndNonObservable): (JSC::RegExpObject::isSymbolSplitFastAndNonObservable): * Source/JavaScriptCore/runtime/RegExpPrototype.cpp: (JSC::regExpSplitFast): (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/RegExpPrototype.h: * Source/JavaScriptCore/runtime/StringPrototype.cpp: (JSC::StringPrototype::finishCreation): (JSC::stringSplitFast): (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/StringPrototype.h: Canonical link: https://commits.webkit.org/312843@main
885a6ec to
1a01603
Compare
Collaborator
|
Committed 312843@main (1a01603): https://commits.webkit.org/312843@main Reviewed commits have been landed. Closing PR #64204 and removing active labels. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🧪 wpe-wk2
1a01603
885a6ec
🛠 win🧪 win-tests