Changeset 280060 in webkit


Ignore:
Timestamp:
Jul 19, 2021 5:48:54 PM (3 years ago)
Author:
mark.lam@apple.com
Message:

DFG's parseIntResult() should check for negative zero.
https://bugs.webkit.org/show_bug.cgi?id=228068
rdar://80788603

Reviewed by Yusuke Suzuki.

JSTests:

  • stress/dfg-parseIntResult-should-check-for-negative-zero.js: Added.

Source/JavaScriptCore:

We have to check for negative zero explicitly because C++ evaluates 0.0 == -0.0
as true.

  • dfg/DFGOperations.cpp:

(JSC::DFG::parseIntResult):

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r280050 r280060  
     12021-07-19  Mark Lam  <mark.lam@apple.com>
     2
     3        DFG's parseIntResult() should check for negative zero.
     4        https://bugs.webkit.org/show_bug.cgi?id=228068
     5        rdar://80788603
     6
     7        Reviewed by Yusuke Suzuki.
     8
     9        * stress/dfg-parseIntResult-should-check-for-negative-zero.js: Added.
     10
    1112021-07-19  Yusuke Suzuki  <ysuzuki@apple.com>
    212
  • trunk/Source/JavaScriptCore/ChangeLog

    r280050 r280060  
     12021-07-19  Mark Lam  <mark.lam@apple.com>
     2
     3        DFG's parseIntResult() should check for negative zero.
     4        https://bugs.webkit.org/show_bug.cgi?id=228068
     5        rdar://80788603
     6
     7        Reviewed by Yusuke Suzuki.
     8
     9        We have to check for negative zero explicitly because C++ evaluates 0.0 == -0.0
     10        as true.
     11
     12        * dfg/DFGOperations.cpp:
     13        (JSC::DFG::parseIntResult):
     14
    1152021-07-19  Yusuke Suzuki  <ysuzuki@apple.com>
    216
  • trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp

    r279910 r280060  
    203203{
    204204    int asInt = static_cast<int>(input);
    205     if (static_cast<double>(asInt) == input)
     205    if (LIKELY(static_cast<double>(asInt) == input && (asInt || !std::signbit(input))))
    206206        return JSValue::encode(jsNumber(asInt));
    207207    return JSValue::encode(jsNumber(input));
Note: See TracChangeset for help on using the changeset viewer.