[webkit-changes] [WebKit/WebKit] 184275: [JSC] Implement Array#concat in C++

Yusuke Suzuki noreply at github.com
Tue Oct 8 14:43:17 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 184275291379e0cb2d6a9f87e11c0c3a623418a3
      https://github.com/WebKit/WebKit/commit/184275291379e0cb2d6a9f87e11c0c3a623418a3
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2024-10-08 (Tue, 08 Oct 2024)

  Changed paths:
    M Source/JavaScriptCore/builtins/ArrayPrototype.js
    M Source/JavaScriptCore/builtins/BuiltinNames.h
    M Source/JavaScriptCore/bytecode/LinkTimeConstant.h
    M Source/JavaScriptCore/runtime/ArrayPrototype.cpp
    M Source/JavaScriptCore/runtime/ArrayPrototype.h
    M Source/JavaScriptCore/runtime/ArrayPrototypeInlines.h
    M Source/JavaScriptCore/runtime/JSGlobalObject.cpp
    M Source/JavaScriptCore/runtime/JSGlobalObject.h

  Log Message:
  -----------
  [JSC] Implement Array#concat in C++
https://bugs.webkit.org/show_bug.cgi?id=280957
rdar://137404542

Reviewed by Yijia Huang.

Let's move isConcatSpreadable check from tryGetById based on in JS to
watchpoint basis. As a result, we can efficiently implement entire
Array#concat in C++. This is great since we can keep it really fast even
for Baseline level execution (FTL JS is so fast, but Baseline is not.
And we would like to make builtin functions fast even if it is not
executed enough yet).

We remove JS concat and concatSlowPath, and C++ concatMemcpy. And move
everything to C++ Array#concat.

                                                         ToT                     Patched

    array-prototype-concat-copy-double-and-int32
                                                    1.3390+-0.0116     ^      0.8628+-0.0153        ^ definitely 1.5519x faster
    array-prototype-concat-copy-int32               1.0441+-0.0092     ^      0.6616+-0.0088        ^ definitely 1.5780x faster
    array-prototype-concat-copy-obj                 1.0724+-0.0132     ^      0.6849+-0.0085        ^ definitely 1.5657x faster
    array-concat-int32-and-double                   0.9596+-0.0107     ^      0.9139+-0.0128        ^ definitely 1.0500x faster
    array-concat-double-and-int32                   0.9622+-0.0111     ^      0.9141+-0.0142        ^ definitely 1.0527x faster
    array-prototype-concat-copy-double              1.0813+-0.0111     ^      0.6855+-0.0102        ^ definitely 1.5774x faster
    concat-append-one                               2.5387+-0.0189     ^      2.4526+-0.0242        ^ definitely 1.0351x faster

* Source/JavaScriptCore/builtins/ArrayPrototype.js:
(linkTimeConstant.concatSlowPath): Deleted.
(concat): Deleted.
* Source/JavaScriptCore/builtins/BuiltinNames.h:
* Source/JavaScriptCore/bytecode/LinkTimeConstant.h:
* Source/JavaScriptCore/runtime/ArrayPrototype.cpp:
(JSC::ArrayPrototype::finishCreation):
(JSC::concatAppendOne):
(JSC::concatAppendArray):
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/ArrayPrototype.h:
* Source/JavaScriptCore/runtime/ArrayPrototypeInlines.h:
(JSC::arrayMissingIsConcatSpreadable):
* Source/JavaScriptCore/runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
* Source/JavaScriptCore/runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::arrayIsConcatSpreadableWatchpointSet):

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



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


More information about the webkit-changes mailing list