[webkit-changes] [WebKit/WebKit] 9285fb: [JSC] Allow the same array for fast concat

Yusuke Suzuki noreply at github.com
Wed Oct 26 16:31:22 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9285fb4a8ca01205fa4043717926c887b6bc51f1
      https://github.com/WebKit/WebKit/commit/9285fb4a8ca01205fa4043717926c887b6bc51f1
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2022-10-26 (Wed, 26 Oct 2022)

  Changed paths:
    A JSTests/microbenchmarks/same-array-concat.js
    M Source/JavaScriptCore/runtime/ArrayPrototype.cpp
    M Source/JavaScriptCore/runtime/JSArray.cpp
    M Source/JavaScriptCore/runtime/JSArray.h
    M Source/JavaScriptCore/runtime/JSArrayInlines.h

  Log Message:
  -----------
  [JSC] Allow the same array for fast concat
https://bugs.webkit.org/show_bug.cgi?id=247038
rdar://101569531

Reviewed by Alexey Shvayka.

This patch allows the same array used for concat. We added this check in 42bc7339d2e189dae66571273ad8dd84b8801cdd,
but this is necessary only for concat's @appendMemcpy path since it modifies |this|. So we should not prohibit using
the fast code in the concat's fast path (@concatMemcpy) since it creates a new array. We also clean up the holesMustForwardToPrototype
implementation to use already-configured WatchpointSet.

                                  ToT                     Patched

    same-array-concat       15.1125+-0.0547     ^      6.7147+-0.0203        ^ definitely 2.2507x faster

* JSTests/microbenchmarks/same-array-concat.js: Added.
(test):
* Source/JavaScriptCore/runtime/ArrayPrototype.cpp:
(JSC::moveElements):
* Source/JavaScriptCore/runtime/JSArray.cpp:
(JSC::JSArray::appendMemcpy):
(JSC::JSArray::shiftCountWithAnyIndexingType):
* Source/JavaScriptCore/runtime/JSArray.h:
* Source/JavaScriptCore/runtime/JSArrayInlines.h:
(JSC::JSArray::holesMustForwardToPrototype const):
(JSC::JSArray::canFastCopy const):
(JSC::JSArray::canFastAppend const):
(JSC::JSArray::canDoFastIndexedAccess const):
(JSC::JSArray::canFastCopy): Deleted.
(JSC::JSArray::canDoFastIndexedAccess): Deleted.

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




More information about the webkit-changes mailing list