[webkit-changes] [WebKit/WebKit] 2a3215: [JSC] Use array-move shift with threshold

Yusuke Suzuki noreply at github.com
Thu Oct 27 18:28:56 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2a3215d9836d1e29a14e5b84add3ae3ce22b65e8
      https://github.com/WebKit/WebKit/commit/2a3215d9836d1e29a14e5b84add3ae3ce22b65e8
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M Source/JavaScriptCore/runtime/JSArray.cpp
    M Source/JavaScriptCore/runtime/JSArray.h

  Log Message:
  -----------
  [JSC] Use array-move shift with threshold
https://bugs.webkit.org/show_bug.cgi?id=247104
rdar://101617332

Reviewed by Mark Lam.

This patch attempts to use array-move shift even in Array#shift case with some threshold (128).
Shift is cheap in ArrayStorage, thus, we have a tradeoff between cheap ArrayStorage shift v.s.
slowdown in the rest of the code. We use 128 threshold to keep small shift using array-move
while large shift uses ArrayStorage instead.

Speedometer2.1/AngularJS-TodoMVC gets 0.93% improvement.
JetStream2/Basic gets 3.85% improvement.

* Source/JavaScriptCore/runtime/ArrayPrototype.cpp:
(JSC::shift):
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/JSArray.cpp:
(JSC::JSArray::shiftCountWithAnyIndexingType):
(JSC::JSArray::unshiftCountWithAnyIndexingType):
* Source/JavaScriptCore/runtime/JSArray.h:
(JSC::JSArray::shiftCount):
(): Deleted.
(JSC::JSArray::shiftCountForShift): Deleted.
(JSC::JSArray::shiftCountForSplice): Deleted.

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




More information about the webkit-changes mailing list