⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 199638 in webkit


Ignore:
Timestamp:
Apr 16, 2016, 8:44:52 PM (10 years ago)
Author:
commit-queue@webkit.org
Message:

[JSC] FRound/Negate can produce an impure NaN out of a pure NaN
https://bugs.webkit.org/show_bug.cgi?id=156528

Patch by Benjamin Poulain <bpoulain@apple.com> on 2016-04-16
Reviewed by Filip Pizlo.

If you fround a double with the bits 0xfff7000000000000
you get 0xfffe000000000000. The first is a pure NaN, the second isn't.

This is without test because I could not find a way to create a 0xfff7000000000000
while convincing DFG that its pure.
When we purify NaNs from typed array, we use a specific value of NaN if the input
is any NaN, making testing tricky.

  • bytecode/SpeculatedType.cpp:

(JSC::typeOfDoubleNegation):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r199636 r199638  
     12016-04-16  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        [JSC] FRound/Negate can produce an impure NaN out of a pure NaN
     4        https://bugs.webkit.org/show_bug.cgi?id=156528
     5
     6        Reviewed by Filip Pizlo.
     7
     8        If you fround a double with the bits 0xfff7000000000000
     9        you get 0xfffe000000000000. The first is a pure NaN, the second isn't.
     10
     11        This is without test because I could not find a way to create a 0xfff7000000000000
     12        while convincing DFG that its pure.
     13        When we purify NaNs from typed array, we use a specific value of NaN if the input
     14        is any NaN, making testing tricky.
     15
     16        * bytecode/SpeculatedType.cpp:
     17        (JSC::typeOfDoubleNegation):
     18
    1192016-04-16  Konstantin Tokarev  <annulen@yandex.ru>
    220
  • trunk/Source/JavaScriptCore/bytecode/SpeculatedType.cpp

    r197408 r199638  
    523523SpeculatedType typeOfDoubleNegation(SpeculatedType value)
    524524{
    525     // Impure NaN could become pure NaN because bits might get cleared.
    526     if (value & SpecDoubleImpureNaN)
    527         value |= SpecDoublePureNaN;
     525    // Changing bits can make pure NaN impure and vice versa:
     526    // 0xefff000000000000 (pure) - 0xffff000000000000 (impure)
     527    if (value & SpecDoubleNaN)
     528        value |= SpecDoubleNaN;
    528529    // We could get negative zero, which mixes SpecInt52AsDouble and SpecNotIntAsDouble.
    529530    // We could also overflow a large negative int into something that is no longer
     
    541542SpeculatedType typeOfDoubleRounding(SpeculatedType value)
    542543{
    543     // We might lose bits, which leads to a NaN being purified.
    544     if (value & SpecDoubleImpureNaN)
    545         value |= SpecDoublePureNaN;
     544    // Double Pure NaN can becomes impure when converted back from Float.
     545    // and vice versa.
     546    if (value & SpecDoubleNaN)
     547        value |= SpecDoubleNaN;
    546548    // We might lose bits, which leads to a value becoming integer-representable.
    547549    if (value & SpecNonIntAsDouble)
Note: See TracChangeset for help on using the changeset viewer.