Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1452a43959523449099b2616793fd2c5b6a6487e
      
https://github.com/WebKit/WebKit/commit/1452a43959523449099b2616793fd2c5b6a6487e
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-06-21 (Sun, 21 Jun 2026)

  Changed paths:
    A JSTests/microbenchmarks/regexp-string-iterator-next.js
    A JSTests/stress/regexp-string-iterator-next-adversarial.js
    A JSTests/stress/regexp-string-iterator-next-cpp-migration.js
    A JSTests/stress/regexp-string-iterator-next-intrinsic-observability.js
    M Source/JavaScriptCore/CMakeLists.txt
    M Source/JavaScriptCore/DerivedSources-input.xcfilelist
    M Source/JavaScriptCore/DerivedSources.make
    M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
    M Source/JavaScriptCore/builtins/GlobalOperations.js
    R Source/JavaScriptCore/builtins/RegExpStringIteratorPrototype.js
    M Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.cpp
    M Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.h
    M Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
    M Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
    M Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
    M Source/JavaScriptCore/dfg/DFGClobberize.h
    M Source/JavaScriptCore/dfg/DFGDoesGC.cpp
    M Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
    M Source/JavaScriptCore/dfg/DFGNode.h
    M Source/JavaScriptCore/dfg/DFGNodeType.h
    M Source/JavaScriptCore/dfg/DFGOperations.cpp
    M Source/JavaScriptCore/dfg/DFGOperations.h
    M Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp
    M Source/JavaScriptCore/dfg/DFGSafeToExecute.h
    M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
    M Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
    M Source/JavaScriptCore/ftl/FTLCapabilities.cpp
    M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
    M Source/JavaScriptCore/runtime/Intrinsic.h
    M Source/JavaScriptCore/runtime/IteratorOperations.h
    M Source/JavaScriptCore/runtime/JSRegExpStringIterator.cpp
    M Source/JavaScriptCore/runtime/JSRegExpStringIterator.h
    M Source/JavaScriptCore/runtime/JSRegExpStringIteratorInlines.h
    M Source/JavaScriptCore/runtime/RegExpObject.h
    M Source/JavaScriptCore/runtime/RegExpObjectInlines.h
    M Source/JavaScriptCore/runtime/RegExpPrototype.cpp
    M Source/JavaScriptCore/runtime/RegExpPrototype.h
    M Source/JavaScriptCore/runtime/RegExpStringIteratorPrototype.cpp

  Log Message:
  -----------
  [JSC] Implement `%RegExpStringIteratorPrototype%.next` in C++
https://bugs.webkit.org/show_bug.cgi?id=317106

Reviewed by Yusuke Suzuki.

Implement %RegExpStringIteratorPrototype%.next, previously a JS builtin,
in C++.

Add a new RegExpStringIteratorNext DFG node and compile it inline in the
DFG and FTL. When the iterated RegExp still has the primordial exec, the
fast path calls RegExpObject::execInline directly instead of going
through the generic RegExpExec.

string-matchall-digit-short         62.7148+-6.8214           59.5233+-2.1918   
       might be 1.0536x faster
regexp-string-iterator-next         80.1890+-3.3694     ^     71.2452+-2.7385   
     ^ definitely 1.1255x faster
regexp-matchall-digit-cached        45.7500+-2.4959     ^     42.3630+-0.2357   
     ^ definitely 1.0800x faster
string-matchall-letter-short        65.9278+-3.2727           63.1933+-1.8308   
       might be 1.0433x faster
matchall-bench                       3.4217+-0.0672     ^      2.8757+-0.1334   
     ^ definitely 1.1899x faster
regexp-matchall-digit-literal       45.7338+-1.5032           43.3273+-1.7259   
       might be 1.0555x faster

Tests: JSTests/microbenchmarks/regexp-string-iterator-next.js
       JSTests/stress/regexp-string-iterator-next-adversarial.js
       JSTests/stress/regexp-string-iterator-next-cpp-migration.js
       JSTests/stress/regexp-string-iterator-next-intrinsic-observability.js

* JSTests/microbenchmarks/regexp-string-iterator-next.js: Added.
(forOfMatchAll):
(manualNext):
* JSTests/stress/regexp-string-iterator-next-adversarial.js: Added.
(shouldBe):
(shouldThrow):
(Species.get Symbol):
(Species):
(matchAllCapturing):
(drain):
(matcher.exec):
(shouldBe.pull):
(shouldBe.):
(shouldThrow.assertResultShape):
* JSTests/stress/regexp-string-iterator-next-cpp-migration.js: Added.
(shouldBe):
(shouldThrow):
(shouldThrow.next.call.Symbol.iterator):
(shouldBe.TraceExec.prototype.exec):
(shouldBe.TraceExec):
(shouldBe.BadExec.prototype.exec):
(shouldBe.BadExec):
(shouldThrow.prototype.exec):
(shouldBe.FakeExec.prototype.exec):
(shouldBe.FakeExec):
(EmptySpecies.get Symbol.species.matcher.exec):
(EmptySpecies.get Symbol):
(EmptySpecies):
(shouldBe.get const):
(shouldBe.EmptySpecies.get Symbol.species.matcher.exec):
(shouldBe.EmptySpecies.get Symbol):
(shouldBe.EmptySpecies):
(shouldBe.get Symbol):
* JSTests/stress/regexp-string-iterator-next-intrinsic-observability.js: Added.
(shouldBe):
(shouldThrow):
(drain):
(i.shouldBe.drain.string_appeared_here.matchAll.TraceExec.prototype.exec):
(i.shouldBe.drain.string_appeared_here.matchAll.TraceExec):
(i.shouldBe.drain.string_appeared_here.matchAll):
(shouldBe.EmptySpecies.get Symbol.species.matcher.exec):
(shouldBe.EmptySpecies.get Symbol):
(shouldBe.EmptySpecies):
(shouldBe.callNext):
* Source/JavaScriptCore/CMakeLists.txt:
* Source/JavaScriptCore/DerivedSources-input.xcfilelist:
* Source/JavaScriptCore/DerivedSources.make:
* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/JavaScriptCore/builtins/RegExpStringIteratorPrototype.js: Removed.
* Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.cpp:
(JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry):
* Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.h:
* Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:
(JSC::regExpStringIteratorInternalFieldIndex): Deleted.
(JSC::BytecodeIntrinsicNode::emit_intrinsic_getRegExpStringIteratorInternalField):
 Deleted.
(JSC::BytecodeIntrinsicNode::emit_intrinsic_putRegExpStringIteratorInternalField):
 Deleted.
* Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleIntrinsicCall):
* Source/JavaScriptCore/dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* Source/JavaScriptCore/dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):
* Source/JavaScriptCore/dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* Source/JavaScriptCore/dfg/DFGNode.h:
(JSC::DFG::Node::hasHeapPrediction):
(JSC::DFG::Node::hasStructure):
* 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.h:
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compileRegExpStringIteratorNext):
(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::compileCompareStrictEq):
* Source/JavaScriptCore/runtime/Intrinsic.h:
* Source/JavaScriptCore/runtime/IteratorOperations.cpp:
(JSC::createIteratorResultObjectStructure):
(JSC::createIteratorResultObject):
* Source/JavaScriptCore/runtime/IteratorOperations.h:
* Source/JavaScriptCore/runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::iteratorResultObjectStructureConcurrently const):
* Source/JavaScriptCore/runtime/JSRegExpStringIterator.cpp:
(JSC::JSRegExpStringIterator::nextImpl):
(JSC::JSRegExpStringIterator::next):
* Source/JavaScriptCore/runtime/JSRegExpStringIterator.h:
* Source/JavaScriptCore/runtime/JSRegExpStringIteratorInlines.h:
(JSC::JSRegExpStringIterator::regExp const):
(JSC::JSRegExpStringIterator::iteratedString const):
* Source/JavaScriptCore/runtime/RegExpObject.h:
* Source/JavaScriptCore/runtime/RegExpObjectInlines.h:
(JSC::RegExpObject::execInline):
(JSC::advanceStringIndex):
* Source/JavaScriptCore/runtime/RegExpPrototype.cpp:
(JSC::regExpExec):
(JSC::advanceStringIndex): Deleted.
* Source/JavaScriptCore/runtime/RegExpPrototype.h:
* Source/JavaScriptCore/runtime/RegExpStringIteratorPrototype.cpp:
(JSC::RegExpStringIteratorPrototype::finishCreation):
(JSC::JSC_DEFINE_HOST_FUNCTION):

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



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

Reply via email to