[webkit-changes] [WebKit/WebKit] c6ee90: [JSC] Optimize parseFloat(number)

Yusuke Suzuki noreply at github.com
Thu Jun 15 01:10:47 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c6ee90f3c7461b16db32d57700d1de4a264489a8
      https://github.com/WebKit/WebKit/commit/c6ee90f3c7461b16db32d57700d1de4a264489a8
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2023-06-15 (Thu, 15 Jun 2023)

  Changed paths:
    A JSTests/stress/parse-float-double.js
    A JSTests/stress/parse-int-double-radix-undefined.js
    M Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp

  Log Message:
  -----------
  [JSC] Optimize parseFloat(number)
https://bugs.webkit.org/show_bug.cgi?id=258115
rdar://110822592

Reviewed by Mark Lam.

parseFloat(String(double)) can generate the exact same double *except for -0.0*.
This patch adds a fast path returning double when parseFloat's input is double.
We also extend parseInt optimization in C++ runtime function, which can now accept
radix = 10 cases too (it is already handled in DFG and FTL, but expand it for lower tiers).

* JSTests/stress/parse-float-double.js: Added.
(shouldBe):
(parseFloatDouble):
* JSTests/stress/parse-int-double-radix-undefined.js: Added.
(shouldBe):
(parseIntDouble):
* Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):

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




More information about the webkit-changes mailing list