Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 91036c3fd11247b926d7d43e2b228c2468935c5a
      
https://github.com/WebKit/WebKit/commit/91036c3fd11247b926d7d43e2b228c2468935c5a
  Author: Sosuke Suzuki <[email protected]>
  Date:   2025-12-07 (Sun, 07 Dec 2025)

  Changed paths:
    M JSTests/microbenchmarks/string-prototype-concat-2-args.js
    A JSTests/microbenchmarks/string-prototype-concat-5-args.js
    A JSTests/stress/string-prototype-concat-no-args.js
    A JSTests/stress/string-prototype-concat-this-null.js
    A JSTests/stress/string-prototype-concat-this-undefined.js
    A JSTests/stress/string-prototype-concat.js
    M Source/JavaScriptCore/builtins/StringPrototype.js
    M Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
    M Source/JavaScriptCore/dfg/DFGSafeToExecute.h
    M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
    M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
    M Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp
    M Source/JavaScriptCore/dfg/DFGUseKind.cpp
    M Source/JavaScriptCore/dfg/DFGUseKind.h
    M Source/JavaScriptCore/ftl/FTLCapabilities.cpp
    M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
    M Source/JavaScriptCore/runtime/Intrinsic.h
    M Source/JavaScriptCore/runtime/StringPrototype.cpp

  Log Message:
  -----------
  [JSC] Implement `String.prototype.concat` in C++
https://bugs.webkit.org/show_bug.cgi?id=303680

Reviewed by Yusuke Suzuki.

This patch implements `String.prototype.concat` in C++ with the following 
changes:

- Adds a new use kind `NotOtherUse` to implement the `RequireObjectCoercible`
  abstract operation[1] using a `Check` node.
- Handles `String#concat` in DFG/FTL using the existing `StrCat` DFG node.
  `StrCat` is already used for template literals and well optimized.

[1]: https://tc39.es/ecma262/#sec-requireobjectcoercible

                                        TipOfTree                  Patched

string-prototype-concat-2-args        1.8105+-0.1984     ^      0.3626+-0.0556  
      ^ definitely 4.9929x faster
string-prototype-concat-5-args        2.7280+-0.0825     ^      0.4609+-0.0415  
      ^ definitely 5.9184x faster

* JSTests/microbenchmarks/string-prototype-concat-2-args.js:
* JSTests/microbenchmarks/string-prototype-concat-5-args.js: Added.
* JSTests/stress/string-prototype-concat-no-args.js: Added.
(shouldBe):
(concat):
* JSTests/stress/string-prototype-concat-this-null.js: Added.
(shouldBe):
(concat):
* JSTests/stress/string-prototype-concat-this-undefined.js: Added.
(shouldBe):
(concat):
* JSTests/stress/string-prototype-concat.js: Added.
(shouldBe):
(concat):
* Source/JavaScriptCore/builtins/StringPrototype.js:
(linkTimeConstant.stringConcatSlowPath): Deleted.
(concat): Deleted.
* Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleIntrinsicCall):
* Source/JavaScriptCore/dfg/DFGSafeToExecute.h:
(JSC::DFG::SafeToExecuteEdge::operator()):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h:
* Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp:
* Source/JavaScriptCore/dfg/DFGUseKind.cpp:
(WTF::printInternal):
* Source/JavaScriptCore/dfg/DFGUseKind.h:
(JSC::DFG::typeFilterFor):
(JSC::DFG::checkMayCrashIfInputIsEmpty):
* Source/JavaScriptCore/ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
* Source/JavaScriptCore/runtime/Intrinsic.h:
* Source/JavaScriptCore/runtime/StringPrototype.cpp:
(JSC::StringPrototype::finishCreation):
(JSC::JSC_DEFINE_HOST_FUNCTION):

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



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

Reply via email to