Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 31e38187aad27b9765d73c5053c702ae36682832
      
https://github.com/WebKit/WebKit/commit/31e38187aad27b9765d73c5053c702ae36682832
  Author: Yusuke Suzuki <[email protected]>
  Date:   2026-05-31 (Sun, 31 May 2026)

  Changed paths:
    A JSTests/microbenchmarks/regexp-matchall-digit-cached.js
    A JSTests/microbenchmarks/regexp-matchall-digit-literal.js
    A JSTests/microbenchmarks/string-matchall-digit-short.js
    A JSTests/microbenchmarks/string-matchall-letter-short.js
    A JSTests/stress/string-prototype-matchall-edge-cases.js
    A JSTests/stress/string-prototype-matchall-tostring-once.js
    A JSTests/stress/string-prototype-matchall-tostring-recompiles-regexp.js
    A JSTests/stress/string-prototype-matchall-watchpoint-invalidation.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/BuiltinNames.h
    R Source/JavaScriptCore/builtins/StringPrototype.js
    M Source/JavaScriptCore/bytecode/LinkTimeConstant.h
    M Source/JavaScriptCore/runtime/JSGlobalObject.cpp
    M Source/JavaScriptCore/runtime/JSGlobalObject.h
    M Source/JavaScriptCore/runtime/RegExpConstructor.cpp
    M Source/JavaScriptCore/runtime/RegExpConstructor.h
    M Source/JavaScriptCore/runtime/RegExpObject.h
    M Source/JavaScriptCore/runtime/RegExpObjectInlines.h
    M Source/JavaScriptCore/runtime/RegExpPrototype.cpp
    M Source/JavaScriptCore/runtime/RegExpPrototypeInlines.h
    M Source/JavaScriptCore/runtime/StringPrototype.cpp
    M Source/JavaScriptCore/runtime/StringPrototype.h

  Log Message:
  -----------
  [JSC] Move String#matchAll to C++
https://bugs.webkit.org/show_bug.cgi?id=315928
rdar://178336909

Reviewed by Sosuke Suzuki.

Similar to String#match, this patch moves String#matchAll to C++.
Mostly mirroing to String#match C++ implementation, while a bit of
changes because of spec difference: use isRegExp for checking in
the slow path. This is one difference between String#match and
String#matchAll in the spec. Also we make regExpCreate enhanced, and
returned type is narrowed to RegExpObject*, which makes some of
unnecessary checks removed.

                                              ToT                     Patched

    string-matchall-digit-short         57.7440+-2.4738           
55.5660+-1.0538          might be 1.0392x faster
    regexp-matchall-digit-cached        88.1466+-1.0955     ^     
41.4295+-0.7122        ^ definitely 2.1276x faster
    string-matchall-letter-short        60.5322+-1.2545           
59.1487+-1.3422          might be 1.0234x faster
    matchall-bench                      18.5488+-0.3794     ^      
3.1128+-0.0712        ^ definitely 5.9589x faster
    regexp-matchall-digit-literal       87.6238+-1.6079     ^     
42.5726+-0.7074        ^ definitely 2.0582x faster

    <geometric>                         54.9410+-0.7027     ^     
28.2648+-0.1543        ^ definitely 1.9438x faster

Tests: JSTests/stress/string-prototype-matchall-edge-cases.js
       JSTests/stress/string-prototype-matchall-tostring-once.js
       JSTests/stress/string-prototype-matchall-watchpoint-invalidation.js

* JSTests/microbenchmarks/regexp-matchall-digit-cached.js: Added.
(matchAll):
* JSTests/microbenchmarks/regexp-matchall-digit-literal.js: Added.
(matchAll):
* JSTests/microbenchmarks/string-matchall-digit-short.js: Added.
(matchAll):
* JSTests/microbenchmarks/string-matchall-letter-short.js: Added.
(matchAll):
* JSTests/stress/string-prototype-matchall-edge-cases.js: Added.
(shouldBe):
(shouldThrow):
(arrFromIter):
(shouldBe.arrFromIter.String.prototype.matchAll.call.toString):
(shouldBe.arrFromIter.string_appeared_here.matchAll):
(shouldBe.re.Symbol.matchAll):
(shouldThrow.obj3.get Symbol):
(shouldBe.fakeRegExp.get flags):
(shouldBe.fakeNonGlobal.get flags):
(shouldBe.MyRegExp2.prototype.Symbol.matchAll):
(shouldBe.MyRegExp2):
* JSTests/stress/string-prototype-matchall-tostring-once.js: Added.
(shouldBe):
(throw.new.Error):
(shouldBe.RegExp.prototype.Symbol.matchAll):
* JSTests/stress/string-prototype-matchall-watchpoint-invalidation.js: Added.
(shouldBe):
(matchAll):
(re.Symbol.matchAll):
(str_matchAll_via_get):
(RegExp.prototype.Symbol.matchAll):
(RegExp.prototype.exec):
(value):
(re.lastIndex.valueOf):
(Symbol.matchAll):
(get flags):
(receiver.toString):
(receiver.toString.RegExp.prototype.exec):
(receiver.toString.RegExp.prototype.Symbol.matchAll):
* Source/JavaScriptCore/builtins/BuiltinNames.h:
* Source/JavaScriptCore/builtins/StringPrototype.js:
(matchAll): Deleted.
* Source/JavaScriptCore/bytecode/LinkTimeConstant.h:
* Source/JavaScriptCore/runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
* Source/JavaScriptCore/runtime/JSGlobalObject.h:
* Source/JavaScriptCore/runtime/RegExpConstructor.cpp:
(JSC::regExpCreate):
* Source/JavaScriptCore/runtime/RegExpConstructor.h:
* Source/JavaScriptCore/runtime/RegExpObject.h:
* Source/JavaScriptCore/runtime/RegExpObjectInlines.h:
(JSC::RegExpObject::isSymbolMatchAllFastAndNonObservable):
* Source/JavaScriptCore/runtime/RegExpPrototype.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/RegExpPrototypeInlines.h:
(JSC::regExpMatchAllWathpointIsValid): Deleted.
* Source/JavaScriptCore/runtime/StringPrototype.cpp:
(JSC::StringPrototype::finishCreation):
(JSC::stringMatchSlow):
(JSC::stringMatchAllSlow):
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/StringPrototype.h:

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



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

Reply via email to