Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 55b14a056ad3a98894f23c81dfc09057c836ca65
      
https://github.com/WebKit/WebKit/commit/55b14a056ad3a98894f23c81dfc09057c836ca65
  Author: Yusuke Suzuki <[email protected]>
  Date:   2025-12-29 (Mon, 29 Dec 2025)

  Changed paths:
    A JSTests/stress/regexp-prototype-symbol-replace-basic.js
    A JSTests/stress/regexp-prototype-symbol-replace-capture-groups.js
    A JSTests/stress/regexp-prototype-symbol-replace-edge-cases.js
    A JSTests/stress/regexp-prototype-symbol-replace-functional.js
    A JSTests/stress/regexp-prototype-symbol-replace-named-groups.js
    A JSTests/stress/regexp-prototype-symbol-replace-slow-path.js
    A JSTests/stress/regexp-prototype-symbol-replace-unicode.js
    M Source/JavaScriptCore/builtins/RegExpPrototype.js
    M Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
    M Source/JavaScriptCore/runtime/RegExpObjectInlines.h
    M Source/JavaScriptCore/runtime/RegExpPrototype.cpp

  Log Message:
  -----------
  [JSC] Implement RegExp.prototype[Symbol.replace] in C++
https://bugs.webkit.org/show_bug.cgi?id=304752
rdar://167280055

Reviewed by Sosuke Suzuki.

This patch implements RegExp.prototype[Symbol.replace] in C++ instead of
JS. This is not super important function since String.prototype.replace
and its fast path is mostly called, and this function is rarely called.
Let's just have it in C++ so that we can simplify our builtin
implementations more.
We generate bunch of tests for RegExp.prototype[Symbol.replace] to cover
the cases.

Tests: JSTests/stress/regexp-prototype-symbol-replace-basic.js
       JSTests/stress/regexp-prototype-symbol-replace-capture-groups.js
       JSTests/stress/regexp-prototype-symbol-replace-edge-cases.js
       JSTests/stress/regexp-prototype-symbol-replace-functional.js
       JSTests/stress/regexp-prototype-symbol-replace-named-groups.js
       JSTests/stress/regexp-prototype-symbol-replace-slow-path.js
       JSTests/stress/regexp-prototype-symbol-replace-unicode.js

* JSTests/stress/regexp-prototype-symbol-replace-basic.js: Added.
(shouldBe):
* JSTests/stress/regexp-prototype-symbol-replace-capture-groups.js: Added.
(shouldBe):
* JSTests/stress/regexp-prototype-symbol-replace-edge-cases.js: Added.
(shouldBe):
(shouldThrow):
(toString):
(let.fakeRegExp.exec):
* JSTests/stress/regexp-prototype-symbol-replace-functional.js: Added.
(shouldBe):
(return.toString):
* JSTests/stress/regexp-prototype-symbol-replace-named-groups.js: Added.
(shouldBe):
* JSTests/stress/regexp-prototype-symbol-replace-slow-path.js: Added.
(shouldBe):
(reWithCustomExec.exec):
(customResult.exec):
(customLength.exec):
(modifyingExec.exec):
(nullExec.exec):
(let.plainObject.exec):
(throwingExec.exec):
(i.i.2.0.re.exec):
(funcWithCustomExec.exec):
(slowPathRe.exec):
(namedCapturesExec.exec):
* JSTests/stress/regexp-prototype-symbol-replace-unicode.js: Added.
(shouldBe):
(catch):
* Source/JavaScriptCore/builtins/RegExpPrototype.js:
(linkTimeConstant.getSubstitution): Deleted.
(overriddenName.string_appeared_here.replace): Deleted.
* Source/JavaScriptCore/dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::addStringReplacePrimordialChecks):
* Source/JavaScriptCore/runtime/RegExpObjectInlines.h:
(JSC::advanceStringUnicode):
* Source/JavaScriptCore/runtime/RegExpPrototype.cpp:
(JSC::RegExpPrototype::finishCreation):
(JSC::advanceStringIndex):
(JSC::getSubstitution):
(JSC::JSC_DEFINE_HOST_FUNCTION):

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



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

Reply via email to