[webkit-changes] [WebKit/WebKit] 053d9a: [JSC] Implement `Array.prototype.toReversed` in C++

SUZUKI Sosuke noreply at github.com
Thu Dec 5 23:26:18 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 053d9a84ec27095cb583274daaf41ef796c80633
      https://github.com/WebKit/WebKit/commit/053d9a84ec27095cb583274daaf41ef796c80633
  Author: Sosuke Suzuki <aosukeke at gmail.com>
  Date:   2024-12-05 (Thu, 05 Dec 2024)

  Changed paths:
    A JSTests/microbenchmarks/array-prototype-toReversed-double.js
    A JSTests/microbenchmarks/array-prototype-toReversed-int32.js
    A JSTests/microbenchmarks/array-prototype-toReversed-object.js
    A JSTests/microbenchmarks/array-prototype-toReversed-storage.js
    A JSTests/microbenchmarks/array-prototype-toReversed-string.js
    A JSTests/stress/array-prototype-toReversed-contiguous.js
    A JSTests/stress/array-prototype-toReversed-double.js
    A JSTests/stress/array-prototype-toReversed-int32.js
    A JSTests/stress/array-prototype-toReversed-storage.js
    M Source/JavaScriptCore/builtins/ArrayPrototype.js
    M Source/JavaScriptCore/runtime/ArrayPrototype.cpp
    M Source/JavaScriptCore/runtime/CommonIdentifiers.h
    M Source/JavaScriptCore/runtime/JSArray.cpp
    M Source/JavaScriptCore/runtime/JSArray.h
    M Source/JavaScriptCore/runtime/JSArrayInlines.h

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

Reviewed by Yusuke Suzuki.

This patch implements `Array.prototype.toReversed` in C++ based on the
implementation of `Array.prototype.reverse` and `Array.prototype.slice`

                                            TipOfTree                  Patched

array-prototype-toReversed-string        14.6644+-0.0761     ^      7.8187+-0.3245        ^ definitely 1.8756x faster
array-prototype-toReversed-int32         11.6161+-0.0813     ^      7.5432+-0.2219        ^ definitely 1.5399x faster
array-prototype-toReversed-storage       13.7082+-0.1773     ^      9.2512+-0.5436        ^ definitely 1.4818x faster
array-prototype-toReversed-double        11.7221+-0.1975     ^      6.4701+-0.4021        ^ definitely 1.8117x faster
array-prototype-toReversed-object        15.2418+-1.2822     ^      7.6469+-0.2071        ^ definitely 1.9932x faster

* JSTests/microbenchmarks/array-prototype-toReversed-double.js: Added.
(test):
* JSTests/microbenchmarks/array-prototype-toReversed-int32.js: Added.
(test):
* JSTests/microbenchmarks/array-prototype-toReversed-object.js: Added.
(test):
* JSTests/microbenchmarks/array-prototype-toReversed-storage.js: Added.
(test):
* JSTests/microbenchmarks/array-prototype-toReversed-string.js: Added.
(test):
* JSTests/stress/array-prototype-toReversed-contiguous.js: Added.
(sameArray):
* JSTests/stress/array-prototype-toReversed-double.js: Added.
(sameArray):
* JSTests/stress/array-prototype-toReversed-int32.js: Added.
(sameArray):
* JSTests/stress/array-prototype-toReversed-storage.js: Added.
(sameArray):
* Source/JavaScriptCore/builtins/ArrayPrototype.js:
(toReversed): Deleted.
* Source/JavaScriptCore/runtime/ArrayPrototype.cpp:
(JSC::ArrayPrototype::finishCreation):
(JSC::JSC_DEFINE_HOST_FUNCTION):
(JSC::holesMustForwardToPrototype): Deleted.
(JSC::isHole): Deleted.
(JSC::containsHole): Deleted.
* Source/JavaScriptCore/runtime/CommonIdentifiers.h:
* Source/JavaScriptCore/runtime/JSArray.cpp:
(JSC::JSArray::fastToReversed):
* Source/JavaScriptCore/runtime/JSArray.h:
* Source/JavaScriptCore/runtime/JSArrayInlines.h:
(JSC::holesMustForwardToPrototype):
(JSC::isHole):
(JSC::containsHole):

Canonical link: https://commits.webkit.org/287431@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