Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2b37638c2082b7c545b0dc8a0474d49398538062
      
https://github.com/WebKit/WebKit/commit/2b37638c2082b7c545b0dc8a0474d49398538062
  Author: Yusuke Suzuki <[email protected]>
  Date:   2025-12-26 (Fri, 26 Dec 2025)

  Changed paths:
    M Source/JavaScriptCore/builtins/BuiltinNames.h
    M Source/JavaScriptCore/builtins/StringPrototype.js
    M Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
    M Source/JavaScriptCore/runtime/Intrinsic.h
    M Source/JavaScriptCore/runtime/RegExpObject.h
    M Source/JavaScriptCore/runtime/RegExpObjectInlines.h
    M Source/JavaScriptCore/runtime/StringPrototype.cpp

  Log Message:
  -----------
  [JSC] Implement String.prototype.replace / String.prototype.replaceAll in C++
https://bugs.webkit.org/show_bug.cgi?id=304713
rdar://167219298

Reviewed by Sosuke Suzuki.

This patch moves String.prototype.replace and
String.prototype.replaceAll implementations from JS to C++. We use
watchpoint to monitor RegExp getter changes.

                                                     ToT                     
Patched

string-replace-generic                         14.8738+-0.0330     ^     
14.7730+-0.0546        ^ definitely 1.0068x faster
string-replace                                  1.2715+-0.0153     ^      
1.0564+-0.0147        ^ definitely 1.2037x faster
string-replace-one-char-long-string-string-string
                                                0.2625+-0.0044     ^      
0.2526+-0.0042        ^ definitely 1.0394x faster
string-replace-one-char-short-string-string-string
                                                0.5615+-0.0046     ^      
0.5423+-0.0047        ^ definitely 1.0355x faster
string-replace-benchmark                       54.2826+-0.2489           
54.0185+-0.3693
string-replace-string                         227.2664+-3.6705     ^    
218.6221+-2.8812        ^ definitely 1.0395x faster
string-replace-empty                            5.1744+-0.0219     ^      
4.8294+-0.0189        ^ definitely 1.0714x faster

Disabling DFG and FTL.
                                                     ToT                     
Patched

string-replace-generic                         30.7351+-0.0993     ^     
16.3372+-0.1908        ^ definitely 1.8813x faster
string-replace                                 31.0990+-0.2213     ^     
15.9298+-0.1032        ^ definitely 1.9523x faster
string-replace-one-char-long-string-string-string
                                                0.2481+-0.0041            
0.2458+-0.0038
string-replace-one-char-short-string-string-string
                                                0.6327+-0.0042     ^      
0.5588+-0.0050        ^ definitely 1.1323x faster
string-replace-benchmark                       72.3342+-0.4864     ^     
66.6822+-0.4705        ^ definitely 1.0848x faster
string-replace-string                         349.1991+-3.1613     ^    
289.9050+-4.1124        ^ definitely 1.2045x faster
string-replace-empty                           23.2936+-0.0631     ^      
7.7031+-0.0961        ^ definitely 3.0239x faster

* Source/JavaScriptCore/builtins/BuiltinNames.h:
* Source/JavaScriptCore/builtins/StringPrototype.js:
(linkTimeConstant.hasObservableSideEffectsForStringReplace): Deleted.
(intrinsic.StringPrototypeReplaceIntrinsic.replace): Deleted.
(intrinsic.StringPrototypeReplaceAllIntrinsic.replaceAll): Deleted.
* Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleIntrinsicCall):
* Source/JavaScriptCore/runtime/Intrinsic.h:
* Source/JavaScriptCore/runtime/RegExpObject.h:
* Source/JavaScriptCore/runtime/RegExpObjectInlines.h:
(JSC::RegExpObject::isSymbolReplaceFastAndNonObservable):
* Source/JavaScriptCore/runtime/StringPrototype.cpp:
(JSC::StringPrototype::finishCreation):
(JSC::JSC_DEFINE_HOST_FUNCTION):

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



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

Reply via email to