[webkit-changes] [WebKit/WebKit] 619232: [JSC] Implement `Array.prototype.fill` in C++

SUZUKI Sosuke noreply at github.com
Mon Dec 2 06:45:15 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 619232f3b3be51ce68b813947cdaf3e414a4d3e6
      https://github.com/WebKit/WebKit/commit/619232f3b3be51ce68b813947cdaf3e414a4d3e6
  Author: Sosuke Suzuki <aosukeke at gmail.com>
  Date:   2024-12-02 (Mon, 02 Dec 2024)

  Changed paths:
    A JSTests/microbenchmarks/array-prototype-fill-contiguous.js
    A JSTests/microbenchmarks/array-prototype-fill-double.js
    A JSTests/microbenchmarks/array-prototype-fill-int32.js
    A JSTests/microbenchmarks/array-prototype-fill-undecided.js
    A JSTests/stress/array-prototype-fill-fast.js
    A JSTests/stress/array-prototype-fill-side-effects.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/JSTypedArrayViewPrototype.cpp

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

Reviewed by Yusuke Suzuki and Keith Miller.

The current implementation of Array#fill is written in simple JavaScript. This patch implements it
in C++.

                                         TipOfTree                  Patched

array-prototype-fill-undecided         5.3186+-0.0609     ^      1.1502+-0.0220        ^ definitely 4.6240x faster
array-prototype-fill-int32             4.0577+-0.4950     ^      1.1149+-0.0158        ^ definitely 3.6395x faster
array-prototype-fill-contiguous        5.6943+-0.3723     ^      1.1534+-0.0211        ^ definitely 4.9368x faster
array-prototype-fill-double            3.6932+-0.1337     ^      1.1045+-0.0155        ^ definitely 3.3438x faster

* JSTests/microbenchmarks/array-prototype-fill-contiguous.js: Added.
(test):
* JSTests/microbenchmarks/array-prototype-fill-double.js: Added.
(test):
* JSTests/microbenchmarks/array-prototype-fill-int32.js: Added.
(test):
* JSTests/microbenchmarks/array-prototype-fill-undecided.js: Added.
(test):
* JSTests/stress/array-prototype-fill-fast.js: Added.
(sameArray):
(throw.new.Error):
* JSTests/stress/array-prototype-fill-side-effects.js: Added.
(shouldBe):
(set value):
* Source/JavaScriptCore/builtins/ArrayPrototype.js:
(fill):
* Source/JavaScriptCore/builtins/BuiltinNames.h:
* Source/JavaScriptCore/bytecode/LinkTimeConstant.h:
* Source/JavaScriptCore/runtime/ArrayPrototype.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/ArrayPrototype.h:
* Source/JavaScriptCore/runtime/JSArray.cpp:
(JSC::JSArray::fillMemcpy):
* Source/JavaScriptCore/runtime/JSArray.h:
* Source/JavaScriptCore/runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):

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