Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 566279d48d565d6de872cf4d624c759879c7ab74
      
https://github.com/WebKit/WebKit/commit/566279d48d565d6de872cf4d624c759879c7ab74
  Author: Yusuke Suzuki <[email protected]>
  Date:   2026-09-08 (Tue, 08 Sep 2026)

  Changed paths:
    A JSTests/stress/to-int32-out-of-int32-range-doubles-no-jit.js
    M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
    M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
    M Source/JavaScriptCore/runtime/MathCommon.cpp
    M Source/JavaScriptCore/runtime/MathCommon.h

  Log Message:
  -----------
  [JSC] C++ code should use truncateDoubleToInt64 for toInt32 too in x64
https://bugs.webkit.org/show_bug.cgi?id=323591
rdar://186836512

Reviewed by Sosuke Suzuki.

320602@main applied optimization in JIT for x64. But the same
optimization can be done in C++ as well. This patch applies it. Also we
clean up the code since sensible-conversion is only enabled on x64. Thus,

1. Remove sensible-conversion flag from toIntImpl.
2. Define specific function, toInt32AfterFailedTruncation
3. Use truncateDoubleToInt64 and toInt32AfterFailedTruncation in toInt32
   implementation in x64.
4. Clean up sensible-conversion code in DFG and FTL.

Test: JSTests/stress/to-int32-out-of-int32-range-doubles-no-jit.js

* JSTests/stress/to-int32-out-of-int32-range-doubles-no-jit.js: Added.
(shouldBe):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::emitDoubleToInt32):
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
* Source/JavaScriptCore/runtime/MathCommon.cpp:
(JSC::JSC_DEFINE_NOEXCEPT_JIT_OPERATION):
* Source/JavaScriptCore/runtime/MathCommon.h:
(JSC::toIntImpl):
(JSC::toInt32AfterFailedTruncation):
(JSC::toInt32):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to