[webkit-changes] [WebKit/WebKit] b5cc1f: [JSC] Optimize runtime iterations for arguments an...

Yusuke Suzuki noreply at github.com
Thu Oct 20 10:03:21 PDT 2022


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

  Changed paths:
    A JSTests/microbenchmarks/cloned-arguments-varargs.js
    A JSTests/microbenchmarks/spread-string.js
    A JSTests/stress/array-storage-fast-slice-hole.js
    A JSTests/stress/array-storage-slice.js
    A JSTests/stress/cloned-arguments-varargs.js
    A JSTests/stress/spread-arguments-slow.js
    A JSTests/stress/spread-arguments.js
    A JSTests/stress/spread-string.js
    M Source/JavaScriptCore/CMakeLists.txt
    M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
    M Source/JavaScriptCore/dfg/DFGOperations.cpp
    M Source/JavaScriptCore/interpreter/Interpreter.cpp
    M Source/JavaScriptCore/runtime/ArrayPrototype.cpp
    M Source/JavaScriptCore/runtime/ClonedArguments.cpp
    M Source/JavaScriptCore/runtime/ClonedArguments.h
    M Source/JavaScriptCore/runtime/CommonSlowPaths.cpp
    M Source/JavaScriptCore/runtime/CommonSlowPathsInlines.h
    M Source/JavaScriptCore/runtime/DirectArguments.cpp
    M Source/JavaScriptCore/runtime/DirectArguments.h
    M Source/JavaScriptCore/runtime/IntlObject.cpp
    M Source/JavaScriptCore/runtime/JSArray.cpp
    M Source/JavaScriptCore/runtime/JSArrayInlines.h
    M Source/JavaScriptCore/runtime/JSCJSValue.cpp
    M Source/JavaScriptCore/runtime/JSCJSValue.h
    M Source/JavaScriptCore/runtime/JSGlobalObject.h
    M Source/JavaScriptCore/runtime/JSGlobalObjectInlines.h
    M Source/JavaScriptCore/runtime/JSImmutableButterfly.cpp
    M Source/JavaScriptCore/runtime/JSImmutableButterfly.h
    M Source/JavaScriptCore/runtime/JSONObject.cpp
    M Source/JavaScriptCore/runtime/JSObjectInlines.h
    M Source/JavaScriptCore/runtime/JSString.h
    M Source/JavaScriptCore/runtime/MathCommon.h
    M Source/JavaScriptCore/runtime/ScopedArguments.cpp
    M Source/JavaScriptCore/runtime/ScopedArguments.h
    M Source/JavaScriptCore/runtime/StringConstructor.cpp

  Log Message:
  -----------
  [JSC] Optimize runtime iterations for arguments and string
https://bugs.webkit.org/show_bug.cgi?id=246714
rdar://101317088

Reviewed by Alexey Shvayka.

This patch enhances the existing C++ runtime functions to efficiently iterate arguments and strings.
This change improves rollup with babel source code roughtly 8 - 10%.

Before:
    DYLD_FRAMEWORK_PATH=$VM $VM/jsc -m rollup.js  3.00s user 0.13s system 161% cpu 1.936 total
After:
    DYLD_FRAMEWORK_PATH=$VM $VM/jsc -m rollup.js  2.76s user 0.14s system 162% cpu 1.789 total

And some microbenchmarks get faster.

    array-slice-call-cloned-arguments           37.4436+-0.0669     ^     25.3087+-0.1296        ^ definitely 1.4795x faster
    cloned-arguments-varargs                     0.9464+-0.0349     ^      0.8217+-0.0278        ^ definitely 1.1518x faster
    spread-string                                5.5482+-0.0348     ^      3.1329+-0.0258        ^ definitely 1.7709x faster

* Source/JavaScriptCore/dfg/DFGOperations.cpp:
(JSC::DFG::JSC_DEFINE_JIT_OPERATION):
* Source/JavaScriptCore/interpreter/Interpreter.cpp:
(JSC::sizeOfVarargs):
(JSC::loadVarargs):
* Source/JavaScriptCore/runtime/ClonedArguments.cpp:
(JSC::ClonedArguments::copyToArguments):
(JSC::ClonedArguments::isIteratorProtocolFastAndNonObservable):
* Source/JavaScriptCore/runtime/ClonedArguments.h:
* Source/JavaScriptCore/runtime/CommonSlowPaths.cpp:
(JSC::JSC_DEFINE_COMMON_SLOW_PATH):
* Source/JavaScriptCore/runtime/DirectArguments.cpp:
(JSC::DirectArguments::isIteratorProtocolFastAndNonObservable):
* Source/JavaScriptCore/runtime/DirectArguments.h:
* Source/JavaScriptCore/runtime/JSArray.cpp:
(JSC::JSArray::fastSlice):
* Source/JavaScriptCore/runtime/JSArrayInlines.h:
(JSC::toLength):
* Source/JavaScriptCore/runtime/JSCJSValue.cpp:
(JSC::JSValue::toLength const):
* Source/JavaScriptCore/runtime/JSCJSValue.h:
* Source/JavaScriptCore/runtime/JSGlobalObject.h:
* Source/JavaScriptCore/runtime/JSGlobalObjectInlines.h:
(JSC::JSGlobalObject::objectPrototypeChainIsSane):
(JSC::JSGlobalObject::isArgumentsPrototypeIteratorProtocolFastAndNonObservable):
* Source/JavaScriptCore/runtime/JSImmutableButterfly.cpp:
(JSC::JSImmutableButterfly::createFromClonedArguments):
(JSC::createFromNonClonedArguments):
(JSC::JSImmutableButterfly::createFromDirectArguments):
(JSC::JSImmutableButterfly::createFromScopedArguments):
* Source/JavaScriptCore/runtime/JSImmutableButterfly.h:
* Source/JavaScriptCore/runtime/MathCommon.h:
(JSC::maxSafeIntegerAsUInt64):
* Source/JavaScriptCore/runtime/ScopedArguments.cpp:
(JSC::ScopedArguments::unmapArgument):
(JSC::ScopedArguments::isIteratorProtocolFastAndNonObservable):
* Source/JavaScriptCore/runtime/ScopedArguments.h:

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




More information about the webkit-changes mailing list