[webkit-changes] [WebKit/WebKit] 4eddf2: [JSC] Make Boolean constructor fast

Yusuke Suzuki noreply at github.com
Fri Feb 24 14:08:36 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4eddf2b84045deaa718c105edce3201d71960cc0
      https://github.com/WebKit/WebKit/commit/4eddf2b84045deaa718c105edce3201d71960cc0
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2023-02-24 (Fri, 24 Feb 2023)

  Changed paths:
    A JSTests/microbenchmarks/boolean-constructor.js
    M Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
    M Source/JavaScriptCore/runtime/BooleanConstructor.cpp
    M Source/JavaScriptCore/runtime/BooleanConstructor.h
    M Source/JavaScriptCore/runtime/Intrinsic.h

  Log Message:
  -----------
  [JSC] Make Boolean constructor fast
https://bugs.webkit.org/show_bug.cgi?id=252889
rdar://105873474

Reviewed by Tadeu Zagallo.

Make Boolean constructor to JSFunction to make call faster. Normally, it does not matter to constructors since allocation is much slower,
but Boolean constructor is used for a normal call to enforce the result to Boolean, and in this case, allocation does not happen.

With disabling DFG,
                                                     ToT                     Patched

        boolean-constructor                    12.7293+-0.1106     ^     11.6629+-0.1843        ^ definitely 1.0914x faster

* JSTests/microbenchmarks/boolean-constructor.js: Added.
(shouldBe):
(test):
* Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleIntrinsicCall):
* Source/JavaScriptCore/runtime/BooleanConstructor.cpp:
(JSC::BooleanConstructor::BooleanConstructor):
(JSC::BooleanConstructor::finishCreation):
(JSC::BooleanConstructor::create):
* Source/JavaScriptCore/runtime/BooleanConstructor.h:
* Source/JavaScriptCore/runtime/Intrinsic.h:

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




More information about the webkit-changes mailing list