[webkit-changes] [WebKit/WebKit] 243290: [JSC] Improve Object.defineProperties & Object.def...

Yusuke Suzuki noreply at github.com
Tue Dec 12 23:46:34 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2432909f3aecc7641714799b06b4f909322bd6db
      https://github.com/WebKit/WebKit/commit/2432909f3aecc7641714799b06b4f909322bd6db
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2023-12-12 (Tue, 12 Dec 2023)

  Changed paths:
    A JSTests/microbenchmarks/define-properties-all-of-keys.js
    A JSTests/microbenchmarks/define-properties-simple.js
    A JSTests/microbenchmarks/define-property-simple.js
    M Source/JavaScriptCore/runtime/JSGlobalObject.cpp
    M Source/JavaScriptCore/runtime/JSGlobalObject.h
    M Source/JavaScriptCore/runtime/ObjectConstructor.cpp

  Log Message:
  -----------
  [JSC] Improve Object.defineProperties & Object.defineProperty perf via fast iteration in ToPropertyDescriptor
https://bugs.webkit.org/show_bug.cgi?id=248754
rdar://103101281

Reviewed by Alexey Shvayka.

This patch set up "writable" "set" "get" "value" "enumerable" "configurable" watchpoints onto Object.prototype so that
we can quickly extract property descriptor from Object.defineProperty / Object.defineProperties descriptor objects.
We also extract these properties by enumerating all properties instead of doing hash table lookup multiple times since
in almost all cases this is faster because property descriptor object should be small.

It broadly improves Object.defineProperty / Object.defineProperties perf.

                                                      ToT                     Patched

    redefine-property-accessor-dictionary        4.5682+-0.0286     ^      3.5888+-0.0287        ^ definitely 1.2729x faster
    define-properties-all-of-keys               12.0816+-0.0671     ^      8.8536+-0.0794        ^ definitely 1.3646x faster
    redefine-property-previous-attributes       41.2230+-0.5076     ^     29.0349+-0.2499        ^ definitely 1.4198x faster
    redefine-property-data-dictionary            3.8830+-0.0141     ^      2.9631+-0.0237        ^ definitely 1.3104x faster
    define-property-simple                       1.3220+-0.0180     ^      1.1180+-0.0131        ^ definitely 1.1825x faster
    redefine-property-data                       3.4071+-0.0218     ^      2.5390+-0.0303        ^ definitely 1.3419x faster
    redefine-property-accessor                   3.9898+-0.0219     ^      2.9743+-0.0300        ^ definitely 1.3414x faster
    define-properties-simple                     9.9033+-0.0381     ^      6.8733+-0.0296        ^ definitely 1.4408x faster

* JSTests/microbenchmarks/define-properties-all-of-keys.js: Added.
(const.properties.destroyed.set if):
(const.properties.writable.set if):
(test.Hey):
(test.):
(test):
* JSTests/microbenchmarks/define-properties-simple.js: Added.
(const.properties.destroyed.set if):
(const.properties.writable.set if):
(test.):
(test):
* JSTests/microbenchmarks/define-property-simple.js: Added.
(const.properties.destroyed.set if):
(const.properties.writable.set if):
(test.):
* Source/JavaScriptCore/runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::tryInstallPropertyDescriptorFastPathWatchpoint):
* Source/JavaScriptCore/runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::propertyDescriptorFastPathWatchpointSet):
* Source/JavaScriptCore/runtime/JSObject.h:
* Source/JavaScriptCore/runtime/JSObjectInlines.h:
(JSC::JSObject::getOwnPropertyIfPropertyExists):
* Source/JavaScriptCore/runtime/ObjectConstructor.cpp:
(JSC::toPropertyDescriptor):
(JSC::definePropertiesSlow):
(JSC::defineProperties):

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




More information about the webkit-changes mailing list