Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fe7e0f57289e2d77bdd02ee5732bf5c23edf29c1
      
https://github.com/WebKit/WebKit/commit/fe7e0f57289e2d77bdd02ee5732bf5c23edf29c1
  Author: Sosuke Suzuki <[email protected]>
  Date:   2025-12-20 (Sat, 20 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-jit-object-arg.js
    A JSTests/stress/string-prototype-concat-jit-object-this.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/DFGSpeculativeJIT.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 reverts 304551@main to reland 304079@main .

The change from the original patch adds a new Check node to verify that all 
arguments
are StringUse. According to the spec, String#concat accepts all primitive 
values (except symbols),
but we don't currently have the appropriate UseKind. So we use `StringUse` for 
now.

And `NotOtherUse` is no longer used so remove it from the original patch.

------
(original commit message)

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.5717+-0.1456     ^      0.4188+-0.0543  
      ^ definitely 3.7526x faster
string-prototype-concat-5-args        2.4512+-0.0797     ^      0.5042+-0.1257  
      ^ definitely 4.8621x faster

* JSTests/microbenchmarks/string-prototype-concat-2-args.js:
* JSTests/microbenchmarks/string-prototype-concat-5-args.js: Added.
* JSTests/stress/string-prototype-concat-jit-object-arg.js: Added.
(test):
* JSTests/stress/string-prototype-concat-jit-object-this.js: Added.
(test):
* 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/DFGSpeculativeJIT.cpp:
* 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/304820@main



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

Reply via email to