Changeset 201678 in webkit


Ignore:
Timestamp:
Jun 3, 2016 8:28:57 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

Eager FTL failure for strict comparison of NaN with number check
https://bugs.webkit.org/show_bug.cgi?id=158368

Patch by Benjamin Poulain <bpoulain@apple.com> on 2016-06-03
Reviewed by Darin Adler.

DoupleRep with a RealNumberUse starts by handling double
then falls back to Int32 if the unboxed double is NaN.

Before handling integers, the code is checking if the input
is indeed an int32. The problem was that this check failed
to account for NaN as an original input of the DoubleRep.

The call to isNotInt32() filter the doubles checks because
that was handled by the previous block.
The problem is the previous block handles any double except NaN.
If the original input was NaN, the masking by "~SpecFullDouble"
filter that possibility and isNotInt32() fails to test that case.

This patch fixes the issue by changing the filter to SpecDoubleReal.
The type SpecDoubleReal does not include the NaN types.

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::compileDoubleRep):

  • tests/stress/double-rep-real-number-use-on-nan.js: Added.

To ensure the isNotInt32() does not test anything, we want
proven numbers as input. The (+value) are there to enforce
a ToNumber() which in turn give us a proven Number type.

Location:
trunk/Source/JavaScriptCore
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r201674 r201678  
     12016-06-03  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        Eager FTL failure for strict comparison of NaN with number check
     4        https://bugs.webkit.org/show_bug.cgi?id=158368
     5
     6        Reviewed by Darin Adler.
     7
     8        DoupleRep with a RealNumberUse starts by handling double
     9        then falls back to Int32 if the unboxed double is NaN.
     10
     11        Before handling integers, the code is checking if the input
     12        is indeed an int32. The problem was that this check failed
     13        to account for NaN as an original input of the DoubleRep.
     14
     15        The call to isNotInt32() filter the doubles checks because
     16        that was handled by the previous block.
     17        The problem is the previous block handles any double except NaN.
     18        If the original input was NaN, the masking by "~SpecFullDouble"
     19        filter that possibility and isNotInt32() fails to test that case.
     20
     21        This patch fixes the issue by changing the filter to SpecDoubleReal.
     22        The type SpecDoubleReal does not include the NaN types.
     23
     24        * ftl/FTLLowerDFGToB3.cpp:
     25        (JSC::FTL::DFG::LowerDFGToB3::compileDoubleRep):
     26        * tests/stress/double-rep-real-number-use-on-nan.js: Added.
     27        To ensure the isNotInt32() does not test anything, we want
     28        proven numbers as input. The (+value) are there to enforce
     29        a ToNumber() which in turn give us a proven Number type.
     30
    1312016-06-03  Benjamin Poulain  <bpoulain@apple.com>
    232
  • trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

    r201668 r201678  
    11391139           
    11401140            LBasicBlock lastNext = m_out.appendTo(intCase, continuation);
    1141            
     1141
    11421142            FTL_TYPE_CHECK(
    11431143                jsValueValue(value), m_node->child1(), SpecBytecodeRealNumber,
    1144                 isNotInt32(value, provenType(m_node->child1()) & ~SpecFullDouble));
     1144                isNotInt32(value, provenType(m_node->child1()) & ~SpecDoubleReal));
    11451145            ValueFromBlock slowResult = m_out.anchor(m_out.intToDouble(unboxInt32(value)));
    11461146            m_out.jump(continuation);
Note: See TracChangeset for help on using the changeset viewer.