Changeset 258063 in webkit


Ignore:
Timestamp:
Mar 6, 2020, 10:28:57 PM (5 years ago)
Author:
mark.lam@apple.com
Message:

Add "AndOrdered" to the names of ordered DoubleConditions.
https://bugs.webkit.org/show_bug.cgi?id=208736

Reviewed by Keith Miller.

Renamed the following:

DoubleEqual ==> DoubleEqualAndOrdered
DoubleNotEqual ==> DoubleNotEqualAndOrdered
DoubleGreaterThan ==> DoubleGreaterThanAndOrdered
DoubleGreaterThanOrEqual ==> DoubleGreaterThanOrEqualAndOrdered
DoubleLessThan ==> DoubleLessThanAndOrdered
DoubleLessThanOrEqual ==> DoubleLessThanOrEqualAndOrdered

The comment for these enums in MacroAssemblerARM64.h says:

These conditions will only evaluate to true if the comparison is ordered - i.e. neither operand is NaN.

Adding "AndOrdered" to their names makes this property explicit.

From reading the original names, one might intuitively think that these conditions
map directly to the C++ double comparisons. This intuition is incorrect.
Consider the DoubleNotEqual case: let's compare 2 doubles, a and b:

result = (a != b);

For C++, if either a or b are NaNs, then a != b will actually return true.
This is contrary to the behavior documented in the MacroAssemblerARM64.h comment
above about how DoubleNotEqual should behave. In our code, DoubleNotEqual actually
means DoubleNotEqualAndOrdered. The C++ != behavior actually matches our
DoubleNotEqualOrUnordered condition instead.

The tendency to want to associate DoubleNotEqual with the behavior of the C++
!= operator is precisely why we should give these conditions better names.
Adding the "AndOperand" name make the expected behavior explicit in the name, and
leave no room for confusion with C++ double comparison semantics.

  • assembler/MacroAssembler.cpp:

(WTF::printInternal):

  • assembler/MacroAssembler.h:

(JSC::MacroAssembler::invert):

  • assembler/MacroAssemblerARM64.h:

(JSC::MacroAssemblerARM64::moveConditionallyAfterFloatingPointCompare):
(JSC::MacroAssemblerARM64::moveDoubleConditionallyAfterFloatingPointCompare):
(JSC::MacroAssemblerARM64::jumpAfterFloatingPointCompare):
(JSC::MacroAssemblerARM64::floatingPointCompare):

  • assembler/MacroAssemblerARMv7.h:

(JSC::MacroAssemblerARMv7::branchDouble):

  • assembler/MacroAssemblerMIPS.h:

(JSC::MacroAssemblerMIPS::branchDouble):
(JSC::MacroAssemblerMIPS::branchDoubleNonZero):

  • assembler/MacroAssemblerX86Common.h:

(JSC::MacroAssemblerX86Common::branchDoubleNonZero):
(JSC::MacroAssemblerX86Common::moveConditionallyDouble):
(JSC::MacroAssemblerX86Common::invert):
(JSC::MacroAssemblerX86Common::floatingPointCompare):
(JSC::MacroAssemblerX86Common::jumpAfterFloatingPointCompare):
(JSC::MacroAssemblerX86Common::moveConditionallyAfterFloatingPointCompare):

  • assembler/MacroAssemblerX86_64.h:

(JSC::MacroAssemblerX86_64::truncateDoubleToUint64):
(JSC::MacroAssemblerX86_64::truncateFloatToUint64):

  • assembler/testmasm.cpp:

(JSC::testCompareDouble):
(JSC::testCompareDoubleSameArg):
(JSC::testMoveConditionallyFloatingPoint):
(JSC::testMoveDoubleConditionallyDouble):
(JSC::testMoveDoubleConditionallyDoubleDestSameAsThenCase):
(JSC::testMoveDoubleConditionallyDoubleDestSameAsElseCase):
(JSC::testMoveDoubleConditionallyFloat):
(JSC::testMoveDoubleConditionallyFloatDestSameAsThenCase):
(JSC::testMoveDoubleConditionallyFloatDestSameAsElseCase):
(JSC::testMoveConditionallyFloatingPointSameArg):
(JSC::run):

  • b3/B3LowerToAir.cpp:
  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::compileClampDoubleToByte):
(JSC::DFG::SpeculativeJIT::compileArithRounding):
(JSC::DFG::SpeculativeJIT::compileArithMinMax):
(JSC::DFG::SpeculativeJIT::compileArithPow):
(JSC::DFG::SpeculativeJIT::compileStrictEq):
(JSC::DFG::SpeculativeJIT::compileArrayIndexOf):
(JSC::DFG::SpeculativeJIT::compileNormalizeMapKey):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::compileNumberIsInteger):

  • jit/AssemblyHelpers.h:

(JSC::AssemblyHelpers::branchIfNotNaN):

  • jit/JITArithmetic.cpp:

(JSC::JIT::emitSlow_op_jless):
(JSC::JIT::emitSlow_op_jlesseq):
(JSC::JIT::emitSlow_op_jgreater):
(JSC::JIT::emitSlow_op_jgreatereq):

  • jit/JITArithmetic32_64.cpp:

(JSC::JIT::emitBinaryDoubleOp):

  • jit/ThunkGenerators.cpp:

(JSC::floorThunkGenerator):
(JSC::roundThunkGenerator):

  • wasm/WasmAirIRGenerator.cpp:

(JSC::Wasm::AirIRGenerator::addOp<OpType::F64Le>):
(JSC::Wasm::AirIRGenerator::addOp<OpType::F64Lt>):
(JSC::Wasm::AirIRGenerator::addFloatingPointMinOrMax):
(JSC::Wasm::AirIRGenerator::addOp<OpType::F64Gt>):
(JSC::Wasm::AirIRGenerator::addOp<OpType::F64Ge>):
(JSC::Wasm::AirIRGenerator::addOp<OpType::F32Lt>):
(JSC::Wasm::AirIRGenerator::addOp<OpType::F64Eq>):
(JSC::Wasm::AirIRGenerator::addOp<OpType::F32Le>):
(JSC::Wasm::AirIRGenerator::addOp<OpType::F32Ge>):
(JSC::Wasm::AirIRGenerator::addOp<OpType::F32Eq>):
(JSC::Wasm::AirIRGenerator::addOp<OpType::F32Gt>):

Location:
trunk/Source/JavaScriptCore
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r258062 r258063  
     12020-03-06  Mark Lam  <mark.lam@apple.com>
     2
     3        Add "AndOrdered" to the names of ordered DoubleConditions.
     4        https://bugs.webkit.org/show_bug.cgi?id=208736
     5
     6        Reviewed by Keith Miller.
     7
     8        Renamed the following:
     9            DoubleEqual ==> DoubleEqualAndOrdered
     10            DoubleNotEqual ==> DoubleNotEqualAndOrdered
     11            DoubleGreaterThan ==> DoubleGreaterThanAndOrdered
     12            DoubleGreaterThanOrEqual ==> DoubleGreaterThanOrEqualAndOrdered
     13            DoubleLessThan ==> DoubleLessThanAndOrdered
     14            DoubleLessThanOrEqual ==> DoubleLessThanOrEqualAndOrdered
     15
     16        The comment for these enums in MacroAssemblerARM64.h says:
     17            // These conditions will only evaluate to true if the comparison is ordered - i.e. neither operand is NaN.
     18
     19        Adding "AndOrdered" to their names makes this property explicit.
     20
     21        From reading the original names, one might intuitively think that these conditions
     22        map directly to the C++ double comparisons.  This intuition is incorrect.
     23        Consider the DoubleNotEqual case: let's compare 2 doubles, a and b:
     24
     25            result = (a != b);
     26
     27        For C++, if either a or b are NaNs, then a != b will actually return true.
     28        This is contrary to the behavior documented in the MacroAssemblerARM64.h comment
     29        above about how DoubleNotEqual should behave.  In our code, DoubleNotEqual actually
     30        means DoubleNotEqualAndOrdered.  The C++ != behavior actually matches our
     31        DoubleNotEqualOrUnordered condition instead.
     32
     33        The tendency to want to associate DoubleNotEqual with the behavior of the C++
     34        != operator is precisely why we should give these conditions better names.
     35        Adding the "AndOperand" name make the expected behavior explicit in the name, and
     36        leave no room for confusion with C++ double comparison semantics.
     37
     38        * assembler/MacroAssembler.cpp:
     39        (WTF::printInternal):
     40        * assembler/MacroAssembler.h:
     41        (JSC::MacroAssembler::invert):
     42        * assembler/MacroAssemblerARM64.h:
     43        (JSC::MacroAssemblerARM64::moveConditionallyAfterFloatingPointCompare):
     44        (JSC::MacroAssemblerARM64::moveDoubleConditionallyAfterFloatingPointCompare):
     45        (JSC::MacroAssemblerARM64::jumpAfterFloatingPointCompare):
     46        (JSC::MacroAssemblerARM64::floatingPointCompare):
     47        * assembler/MacroAssemblerARMv7.h:
     48        (JSC::MacroAssemblerARMv7::branchDouble):
     49        * assembler/MacroAssemblerMIPS.h:
     50        (JSC::MacroAssemblerMIPS::branchDouble):
     51        (JSC::MacroAssemblerMIPS::branchDoubleNonZero):
     52        * assembler/MacroAssemblerX86Common.h:
     53        (JSC::MacroAssemblerX86Common::branchDoubleNonZero):
     54        (JSC::MacroAssemblerX86Common::moveConditionallyDouble):
     55        (JSC::MacroAssemblerX86Common::invert):
     56        (JSC::MacroAssemblerX86Common::floatingPointCompare):
     57        (JSC::MacroAssemblerX86Common::jumpAfterFloatingPointCompare):
     58        (JSC::MacroAssemblerX86Common::moveConditionallyAfterFloatingPointCompare):
     59        * assembler/MacroAssemblerX86_64.h:
     60        (JSC::MacroAssemblerX86_64::truncateDoubleToUint64):
     61        (JSC::MacroAssemblerX86_64::truncateFloatToUint64):
     62        * assembler/testmasm.cpp:
     63        (JSC::testCompareDouble):
     64        (JSC::testCompareDoubleSameArg):
     65        (JSC::testMoveConditionallyFloatingPoint):
     66        (JSC::testMoveDoubleConditionallyDouble):
     67        (JSC::testMoveDoubleConditionallyDoubleDestSameAsThenCase):
     68        (JSC::testMoveDoubleConditionallyDoubleDestSameAsElseCase):
     69        (JSC::testMoveDoubleConditionallyFloat):
     70        (JSC::testMoveDoubleConditionallyFloatDestSameAsThenCase):
     71        (JSC::testMoveDoubleConditionallyFloatDestSameAsElseCase):
     72        (JSC::testMoveConditionallyFloatingPointSameArg):
     73        (JSC::run):
     74        * b3/B3LowerToAir.cpp:
     75        * dfg/DFGSpeculativeJIT.cpp:
     76        (JSC::DFG::compileClampDoubleToByte):
     77        (JSC::DFG::SpeculativeJIT::compileArithRounding):
     78        (JSC::DFG::SpeculativeJIT::compileArithMinMax):
     79        (JSC::DFG::SpeculativeJIT::compileArithPow):
     80        (JSC::DFG::SpeculativeJIT::compileStrictEq):
     81        (JSC::DFG::SpeculativeJIT::compileArrayIndexOf):
     82        (JSC::DFG::SpeculativeJIT::compileNormalizeMapKey):
     83        * dfg/DFGSpeculativeJIT32_64.cpp:
     84        (JSC::DFG::SpeculativeJIT::compile):
     85        * dfg/DFGSpeculativeJIT64.cpp:
     86        (JSC::DFG::SpeculativeJIT::compile):
     87        * ftl/FTLLowerDFGToB3.cpp:
     88        (JSC::FTL::DFG::LowerDFGToB3::compileNumberIsInteger):
     89        * jit/AssemblyHelpers.h:
     90        (JSC::AssemblyHelpers::branchIfNotNaN):
     91        * jit/JITArithmetic.cpp:
     92        (JSC::JIT::emitSlow_op_jless):
     93        (JSC::JIT::emitSlow_op_jlesseq):
     94        (JSC::JIT::emitSlow_op_jgreater):
     95        (JSC::JIT::emitSlow_op_jgreatereq):
     96        * jit/JITArithmetic32_64.cpp:
     97        (JSC::JIT::emitBinaryDoubleOp):
     98        * jit/ThunkGenerators.cpp:
     99        (JSC::floorThunkGenerator):
     100        (JSC::roundThunkGenerator):
     101        * wasm/WasmAirIRGenerator.cpp:
     102        (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Le>):
     103        (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Lt>):
     104        (JSC::Wasm::AirIRGenerator::addFloatingPointMinOrMax):
     105        (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Gt>):
     106        (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Ge>):
     107        (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Lt>):
     108        (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Eq>):
     109        (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Le>):
     110        (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Ge>):
     111        (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Eq>):
     112        (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Gt>):
     113
    11142020-03-06  David Kilzer  <ddkilzer@apple.com>
    2115
  • trunk/Source/JavaScriptCore/assembler/MacroAssembler.cpp

    r243254 r258063  
    128128{
    129129    switch (cond) {
    130     case MacroAssembler::DoubleEqual:
    131         out.print("DoubleEqual");
     130    case MacroAssembler::DoubleEqualAndOrdered:
     131        out.print("DoubleEqualAndOrdered");
    132132        return;
    133     case MacroAssembler::DoubleNotEqual:
    134         out.print("DoubleNotEqual");
     133    case MacroAssembler::DoubleNotEqualAndOrdered:
     134        out.print("DoubleNotEqualAndOrdered");
    135135        return;
    136     case MacroAssembler::DoubleGreaterThan:
    137         out.print("DoubleGreaterThan");
     136    case MacroAssembler::DoubleGreaterThanAndOrdered:
     137        out.print("DoubleGreaterThanAndOrdered");
    138138        return;
    139     case MacroAssembler::DoubleGreaterThanOrEqual:
    140         out.print("DoubleGreaterThanOrEqual");
     139    case MacroAssembler::DoubleGreaterThanOrEqualAndOrdered:
     140        out.print("DoubleGreaterThanOrEqualAndOrdered");
    141141        return;
    142     case MacroAssembler::DoubleLessThan:
    143         out.print("DoubleLessThan");
     142    case MacroAssembler::DoubleLessThanAndOrdered:
     143        out.print("DoubleLessThanAndOrdered");
    144144        return;
    145     case MacroAssembler::DoubleLessThanOrEqual:
    146         out.print("DoubleLessThanOrEqual");
     145    case MacroAssembler::DoubleLessThanOrEqualAndOrdered:
     146        out.print("DoubleLessThanOrEqualAndOrdered");
    147147        return;
    148148    case MacroAssembler::DoubleEqualOrUnordered:
  • trunk/Source/JavaScriptCore/assembler/MacroAssembler.h

    r250005 r258063  
    165165    {
    166166        switch (cond) {
    167         case DoubleEqual:
     167        case DoubleEqualAndOrdered:
    168168            return DoubleNotEqualOrUnordered;
    169         case DoubleNotEqual:
     169        case DoubleNotEqualAndOrdered:
    170170            return DoubleEqualOrUnordered;
    171         case DoubleGreaterThan:
     171        case DoubleGreaterThanAndOrdered:
    172172            return DoubleLessThanOrEqualOrUnordered;
    173         case DoubleGreaterThanOrEqual:
     173        case DoubleGreaterThanOrEqualAndOrdered:
    174174            return DoubleLessThanOrUnordered;
    175         case DoubleLessThan:
     175        case DoubleLessThanAndOrdered:
    176176            return DoubleGreaterThanOrEqualOrUnordered;
    177         case DoubleLessThanOrEqual:
     177        case DoubleLessThanOrEqualAndOrdered:
    178178            return DoubleGreaterThanOrUnordered;
    179179        case DoubleEqualOrUnordered:
    180             return DoubleNotEqual;
     180            return DoubleNotEqualAndOrdered;
    181181        case DoubleNotEqualOrUnordered:
    182             return DoubleEqual;
     182            return DoubleEqualAndOrdered;
    183183        case DoubleGreaterThanOrUnordered:
    184             return DoubleLessThanOrEqual;
     184            return DoubleLessThanOrEqualAndOrdered;
    185185        case DoubleGreaterThanOrEqualOrUnordered:
    186             return DoubleLessThan;
     186            return DoubleLessThanAndOrdered;
    187187        case DoubleLessThanOrUnordered:
    188             return DoubleGreaterThanOrEqual;
     188            return DoubleGreaterThanOrEqualAndOrdered;
    189189        case DoubleLessThanOrEqualOrUnordered:
    190             return DoubleGreaterThan;
     190            return DoubleGreaterThanAndOrdered;
    191191        }
    192192        RELEASE_ASSERT_NOT_REACHED();
    193         return DoubleEqual; // make compiler happy
     193        return DoubleEqualAndOrdered; // make compiler happy
    194194    }
    195195   
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h

    r258038 r258063  
    124124    enum DoubleCondition {
    125125        // These conditions will only evaluate to true if the comparison is ordered - i.e. neither operand is NaN.
    126         DoubleEqual = Assembler::ConditionEQ,
    127         DoubleNotEqual = Assembler::ConditionVC, // Not the right flag! check for this & handle differently.
    128         DoubleGreaterThan = Assembler::ConditionGT,
    129         DoubleGreaterThanOrEqual = Assembler::ConditionGE,
    130         DoubleLessThan = Assembler::ConditionLO,
    131         DoubleLessThanOrEqual = Assembler::ConditionLS,
     126        DoubleEqualAndOrdered = Assembler::ConditionEQ,
     127        DoubleNotEqualAndOrdered = Assembler::ConditionVC, // Not the right flag! check for this & handle differently.
     128        DoubleGreaterThanAndOrdered = Assembler::ConditionGT,
     129        DoubleGreaterThanOrEqualAndOrdered = Assembler::ConditionGE,
     130        DoubleLessThanAndOrdered = Assembler::ConditionLO,
     131        DoubleLessThanOrEqualAndOrdered = Assembler::ConditionLS,
    132132        // If either operand is NaN, these conditions always evaluate to true.
    133133        DoubleEqualOrUnordered = Assembler::ConditionVS, // Not the right flag! check for this & handle differently.
     
    20072007    void moveConditionallyAfterFloatingPointCompare(DoubleCondition cond, RegisterID src, RegisterID dest)
    20082008    {
    2009         if (cond == DoubleNotEqual) {
     2009        if (cond == DoubleNotEqualAndOrdered) {
    20102010            Jump unordered = makeBranch(Assembler::ConditionVS);
    20112011            m_assembler.csel<datasize>(dest, src, dest, Assembler::ConditionNE);
     
    20282028    void moveConditionallyAfterFloatingPointCompare(DoubleCondition cond, RegisterID thenCase, RegisterID elseCase, RegisterID dest)
    20292029    {
    2030         if (cond == DoubleNotEqual) {
     2030        if (cond == DoubleNotEqualAndOrdered) {
    20312031            if (dest == thenCase) {
    20322032                // If the compare is unordered, elseCase is copied to thenCase and the
     
    20662066    void moveDoubleConditionallyAfterFloatingPointCompare(DoubleCondition cond, FPRegisterID thenCase, FPRegisterID elseCase, FPRegisterID dest)
    20672067    {
    2068         if (cond == DoubleNotEqual) {
     2068        if (cond == DoubleNotEqualAndOrdered) {
    20692069            if (dest == thenCase) {
    20702070                // If the compare is unordered, elseCase is copied to thenCase and the
     
    46184618    Jump jumpAfterFloatingPointCompare(DoubleCondition cond)
    46194619    {
    4620         if (cond == DoubleNotEqual) {
     4620        if (cond == DoubleNotEqualAndOrdered) {
    46214621            // ConditionNE jumps if NotEqual *or* unordered - force the unordered cases not to jump.
    46224622            Jump unordered = makeBranch(Assembler::ConditionVS);
     
    46404640    void floatingPointCompare(DoubleCondition cond, FPRegisterID left, FPRegisterID right, RegisterID dest, Function compare)
    46414641    {
    4642         if (cond == DoubleNotEqual) {
     4642        if (cond == DoubleNotEqualAndOrdered) {
    46434643            // ConditionNE sets 1 if NotEqual *or* unordered - force the unordered cases not to set 1.
    46444644            move(TrustedImm32(0), dest);
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h

    r252463 r258063  
    129129    enum DoubleCondition {
    130130        // These conditions will only evaluate to true if the comparison is ordered - i.e. neither operand is NaN.
    131         DoubleEqual = ARMv7Assembler::ConditionEQ,
    132         DoubleNotEqual = ARMv7Assembler::ConditionVC, // Not the right flag! check for this & handle differently.
    133         DoubleGreaterThan = ARMv7Assembler::ConditionGT,
    134         DoubleGreaterThanOrEqual = ARMv7Assembler::ConditionGE,
    135         DoubleLessThan = ARMv7Assembler::ConditionLO,
    136         DoubleLessThanOrEqual = ARMv7Assembler::ConditionLS,
     131        DoubleEqualAndOrdered = ARMv7Assembler::ConditionEQ,
     132        DoubleNotEqualAndOrdered = ARMv7Assembler::ConditionVC, // Not the right flag! check for this & handle differently.
     133        DoubleGreaterThanAndOrdered = ARMv7Assembler::ConditionGT,
     134        DoubleGreaterThanOrEqualAndOrdered = ARMv7Assembler::ConditionGE,
     135        DoubleLessThanAndOrdered = ARMv7Assembler::ConditionLO,
     136        DoubleLessThanOrEqualAndOrdered = ARMv7Assembler::ConditionLS,
    137137        // If either operand is NaN, these conditions always evaluate to true.
    138138        DoubleEqualOrUnordered = ARMv7Assembler::ConditionVS, // Not the right flag! check for this & handle differently.
     
    12191219        m_assembler.vmrs();
    12201220
    1221         if (cond == DoubleNotEqual) {
     1221        if (cond == DoubleNotEqualAndOrdered) {
    12221222            // ConditionNE jumps if NotEqual *or* unordered - force the unordered cases not to jump.
    12231223            Jump unordered = makeBranch(ARMv7Assembler::ConditionVS);
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h

    r252463 r258063  
    100100
    101101    enum DoubleCondition {
    102         DoubleEqual,
    103         DoubleNotEqual,
    104         DoubleGreaterThan,
    105         DoubleGreaterThanOrEqual,
    106         DoubleLessThan,
    107         DoubleLessThanOrEqual,
     102        DoubleEqualAndOrdered,
     103        DoubleNotEqualAndOrdered,
     104        DoubleGreaterThanAndOrdered,
     105        DoubleGreaterThanOrEqualAndOrdered,
     106        DoubleLessThanAndOrdered,
     107        DoubleLessThanOrEqualAndOrdered,
    108108        DoubleEqualOrUnordered,
    109109        DoubleNotEqualOrUnordered,
     
    32053205    Jump branchDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right)
    32063206    {
    3207         if (cond == DoubleEqual) {
     3207        if (cond == DoubleEqualAndOrdered) {
    32083208            m_assembler.ceqd(left, right);
    32093209            return branchTrue();
    32103210        }
    3211         if (cond == DoubleNotEqual) {
     3211        if (cond == DoubleNotEqualAndOrdered) {
    32123212            m_assembler.cueqd(left, right);
    32133213            return branchFalse(); // false
    32143214        }
    3215         if (cond == DoubleGreaterThan) {
     3215        if (cond == DoubleGreaterThanAndOrdered) {
    32163216            m_assembler.cngtd(left, right);
    32173217            return branchFalse(); // false
    32183218        }
    3219         if (cond == DoubleGreaterThanOrEqual) {
     3219        if (cond == DoubleGreaterThanOrEqualAndOrdered) {
    32203220            m_assembler.cnged(left, right);
    32213221            return branchFalse(); // false
    32223222        }
    3223         if (cond == DoubleLessThan) {
     3223        if (cond == DoubleLessThanAndOrdered) {
    32243224            m_assembler.cltd(left, right);
    32253225            return branchTrue();
    32263226        }
    3227         if (cond == DoubleLessThanOrEqual) {
     3227        if (cond == DoubleLessThanOrEqualAndOrdered) {
    32283228            m_assembler.cled(left, right);
    32293229            return branchTrue();
     
    33063306    {
    33073307        m_assembler.vmov(scratch, MIPSRegisters::zero, MIPSRegisters::zero);
    3308         return branchDouble(DoubleNotEqual, reg, scratch);
     3308        return branchDouble(DoubleNotEqualAndOrdered, reg, scratch);
    33093309    }
    33103310
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h

    r250005 r258063  
    8989    enum DoubleCondition {
    9090        // These conditions will only evaluate to true if the comparison is ordered - i.e. neither operand is NaN.
    91         DoubleEqual = X86Assembler::ConditionE | DoubleConditionBitSpecial,
    92         DoubleNotEqual = X86Assembler::ConditionNE,
    93         DoubleGreaterThan = X86Assembler::ConditionA,
    94         DoubleGreaterThanOrEqual = X86Assembler::ConditionAE,
    95         DoubleLessThan = X86Assembler::ConditionA | DoubleConditionBitInvert,
    96         DoubleLessThanOrEqual = X86Assembler::ConditionAE | DoubleConditionBitInvert,
     91        DoubleEqualAndOrdered = X86Assembler::ConditionE | DoubleConditionBitSpecial,
     92        DoubleNotEqualAndOrdered = X86Assembler::ConditionNE,
     93        DoubleGreaterThanAndOrdered = X86Assembler::ConditionA,
     94        DoubleGreaterThanOrEqualAndOrdered = X86Assembler::ConditionAE,
     95        DoubleLessThanAndOrdered = X86Assembler::ConditionA | DoubleConditionBitInvert,
     96        DoubleLessThanOrEqualAndOrdered = X86Assembler::ConditionAE | DoubleConditionBitInvert,
    9797        // If either operand is NaN, these conditions always evaluate to true.
    9898        DoubleEqualOrUnordered = X86Assembler::ConditionE,
     
    20812081    {
    20822082        m_assembler.xorpd_rr(scratch, scratch);
    2083         return branchDouble(DoubleNotEqual, reg, scratch);
     2083        return branchDouble(DoubleNotEqualAndOrdered, reg, scratch);
    20842084    }
    20852085
     
    23252325            m_assembler.ucomisd_rr(right, left);
    23262326
    2327         if (cond == DoubleEqual) {
     2327        if (cond == DoubleEqualAndOrdered) {
    23282328            if (left == right) {
    23292329                m_assembler.cmovnpl_rr(src, dest);
     
    30383038    {
    30393039        switch (cond) {
    3040         case DoubleEqual:
     3040        case DoubleEqualAndOrdered:
    30413041            return DoubleNotEqualOrUnordered;
    3042         case DoubleNotEqual:
     3042        case DoubleNotEqualAndOrdered:
    30433043            return DoubleEqualOrUnordered;
    3044         case DoubleGreaterThan:
     3044        case DoubleGreaterThanAndOrdered:
    30453045            return DoubleLessThanOrEqualOrUnordered;
    3046         case DoubleGreaterThanOrEqual:
     3046        case DoubleGreaterThanOrEqualAndOrdered:
    30473047            return DoubleLessThanOrUnordered;
    3048         case DoubleLessThan:
     3048        case DoubleLessThanAndOrdered:
    30493049            return DoubleGreaterThanOrEqualOrUnordered;
    3050         case DoubleLessThanOrEqual:
     3050        case DoubleLessThanOrEqualAndOrdered:
    30513051            return DoubleGreaterThanOrUnordered;
    30523052        case DoubleEqualOrUnordered:
    3053             return DoubleNotEqual;
     3053            return DoubleNotEqualAndOrdered;
    30543054        case DoubleNotEqualOrUnordered:
    3055             return DoubleEqual;
     3055            return DoubleEqualAndOrdered;
    30563056        case DoubleGreaterThanOrUnordered:
    3057             return DoubleLessThanOrEqual;
     3057            return DoubleLessThanOrEqualAndOrdered;
    30583058        case DoubleGreaterThanOrEqualOrUnordered:
    3059             return DoubleLessThan;
     3059            return DoubleLessThanAndOrdered;
    30603060        case DoubleLessThanOrUnordered:
    3061             return DoubleGreaterThanOrEqual;
     3061            return DoubleGreaterThanOrEqualAndOrdered;
    30623062        case DoubleLessThanOrEqualOrUnordered:
    3063             return DoubleGreaterThan;
     3063            return DoubleGreaterThanAndOrdered;
    30643064        }
    30653065        RELEASE_ASSERT_NOT_REACHED();
    3066         return DoubleEqual; // make compiler happy
     3066        return DoubleEqualAndOrdered; // make compiler happy
    30673067    }
    30683068
     
    41234123        if (cond & DoubleConditionBitSpecial) {
    41244124            ASSERT(!(cond & DoubleConditionBitInvert));
    4125             if (cond == DoubleEqual) {
     4125            if (cond == DoubleEqualAndOrdered) {
    41264126                if (left == right) {
    41274127                    compare(right, left);
     
    41654165    Jump jumpAfterFloatingPointCompare(DoubleCondition cond, FPRegisterID left, FPRegisterID right)
    41664166    {
    4167         if (cond == DoubleEqual) {
     4167        if (cond == DoubleEqualAndOrdered) {
    41684168            if (left == right)
    41694169                return Jump(m_assembler.jnp());
     
    42004200    void moveConditionallyAfterFloatingPointCompare(DoubleCondition cond, FPRegisterID left, FPRegisterID right, RegisterID src, RegisterID dest)
    42014201    {
    4202         if (cond == DoubleEqual) {
     4202        if (cond == DoubleEqualAndOrdered) {
    42034203            if (left == right) {
    42044204                m_assembler.cmovnpq_rr(src, dest);
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h

    r252422 r258063  
    17841784        // uint64_t; then add back int64_t::min() in the destination gpr.
    17851785
    1786         Jump large = branchDouble(DoubleGreaterThanOrEqual, src, int64Min);
     1786        Jump large = branchDouble(DoubleGreaterThanOrEqualAndOrdered, src, int64Min);
    17871787        m_assembler.cvttsd2siq_rr(src, dest);
    17881788        Jump done = jump();
     
    18171817        // uint64_t; then add back int64_t::min() in the destination gpr.
    18181818
    1819         Jump large = branchFloat(DoubleGreaterThanOrEqual, src, int64Min);
     1819        Jump large = branchFloat(DoubleGreaterThanOrEqualAndOrdered, src, int64Min);
    18201820        m_assembler.cvttss2siq_rr(src, dest);
    18211821        Jump done = jump();
  • trunk/Source/JavaScriptCore/assembler/testmasm.cpp

    r258062 r258063  
    505505        };
    506506        switch (condition) {
    507         case MacroAssembler::DoubleEqual:
     507        case MacroAssembler::DoubleEqualAndOrdered:
    508508            return !isUnordered(a) && !isUnordered(b) && (a == b);
    509         case MacroAssembler::DoubleNotEqual:
     509        case MacroAssembler::DoubleNotEqualAndOrdered:
    510510            return !isUnordered(a) && !isUnordered(b) && (a != b);
    511         case MacroAssembler::DoubleGreaterThan:
     511        case MacroAssembler::DoubleGreaterThanAndOrdered:
    512512            return !isUnordered(a) && !isUnordered(b) && (a > b);
    513         case MacroAssembler::DoubleGreaterThanOrEqual:
     513        case MacroAssembler::DoubleGreaterThanOrEqualAndOrdered:
    514514            return !isUnordered(a) && !isUnordered(b) && (a >= b);
    515         case MacroAssembler::DoubleLessThan:
     515        case MacroAssembler::DoubleLessThanAndOrdered:
    516516            return !isUnordered(a) && !isUnordered(b) && (a < b);
    517         case MacroAssembler::DoubleLessThanOrEqual:
     517        case MacroAssembler::DoubleLessThanOrEqualAndOrdered:
    518518            return !isUnordered(a) && !isUnordered(b) && (a <= b);
    519519        case MacroAssembler::DoubleEqualOrUnordered:
     
    577577        };
    578578        switch (condition) {
    579         case MacroAssembler::DoubleEqual:
     579        case MacroAssembler::DoubleEqualAndOrdered:
    580580            return !isUnordered(a) && (a == a);
    581         case MacroAssembler::DoubleNotEqual:
     581        case MacroAssembler::DoubleNotEqualAndOrdered:
    582582            return !isUnordered(a) && (a != a);
    583         case MacroAssembler::DoubleGreaterThan:
     583        case MacroAssembler::DoubleGreaterThanAndOrdered:
    584584            return !isUnordered(a) && (a > a);
    585         case MacroAssembler::DoubleGreaterThanOrEqual:
     585        case MacroAssembler::DoubleGreaterThanOrEqualAndOrdered:
    586586            return !isUnordered(a) && (a >= a);
    587         case MacroAssembler::DoubleLessThan:
     587        case MacroAssembler::DoubleLessThanAndOrdered:
    588588            return !isUnordered(a) && (a < a);
    589         case MacroAssembler::DoubleLessThanOrEqual:
     589        case MacroAssembler::DoubleLessThanOrEqualAndOrdered:
    590590            return !isUnordered(a) && (a <= a);
    591591        case MacroAssembler::DoubleEqualOrUnordered:
     
    702702        };
    703703        switch (condition) {
    704         case MacroAssembler::DoubleEqual:
     704        case MacroAssembler::DoubleEqualAndOrdered:
    705705            return !isUnordered(a) && !isUnordered(b) && (a == b) ? selectionA : selectionB;
    706         case MacroAssembler::DoubleNotEqual:
     706        case MacroAssembler::DoubleNotEqualAndOrdered:
    707707            return !isUnordered(a) && !isUnordered(b) && (a != b) ? selectionA : selectionB;
    708         case MacroAssembler::DoubleGreaterThan:
     708        case MacroAssembler::DoubleGreaterThanAndOrdered:
    709709            return !isUnordered(a) && !isUnordered(b) && (a > b) ? selectionA : selectionB;
    710         case MacroAssembler::DoubleGreaterThanOrEqual:
     710        case MacroAssembler::DoubleGreaterThanOrEqualAndOrdered:
    711711            return !isUnordered(a) && !isUnordered(b) && (a >= b) ? selectionA : selectionB;
    712         case MacroAssembler::DoubleLessThan:
     712        case MacroAssembler::DoubleLessThanAndOrdered:
    713713            return !isUnordered(a) && !isUnordered(b) && (a < b) ? selectionA : selectionB;
    714         case MacroAssembler::DoubleLessThanOrEqual:
     714        case MacroAssembler::DoubleLessThanOrEqualAndOrdered:
    715715            return !isUnordered(a) && !isUnordered(b) && (a <= b) ? selectionA : selectionB;
    716716        case MacroAssembler::DoubleEqualOrUnordered:
     
    10401040        FPRReg tempFPR = FPRInfo::fpRegT5;
    10411041        jit.loadDouble(CCallHelpers::TrustedImmPtr(&selectionA), tempFPR);
    1042         auto aIsUnchanged = jit.branchDouble(CCallHelpers::DoubleEqual, selectionAFPR, tempFPR);
     1042        auto aIsUnchanged = jit.branchDouble(CCallHelpers::DoubleEqualAndOrdered, selectionAFPR, tempFPR);
    10431043        jit.loadDouble(CCallHelpers::TrustedImmPtr(&corruptedSelectionA), destFPR);
    10441044        aIsUnchanged.link(&jit);
    10451045
    10461046        jit.loadDouble(CCallHelpers::TrustedImmPtr(&selectionB), tempFPR);
    1047         auto bIsUnchanged = jit.branchDouble(CCallHelpers::DoubleEqual, selectionBFPR, tempFPR);
     1047        auto bIsUnchanged = jit.branchDouble(CCallHelpers::DoubleEqualAndOrdered, selectionBFPR, tempFPR);
    10481048        jit.loadDouble(CCallHelpers::TrustedImmPtr(&corruptedSelectionB), destFPR);
    10491049        bIsUnchanged.link(&jit);
     
    10861086        FPRReg tempFPR = FPRInfo::fpRegT5;
    10871087        jit.loadDouble(CCallHelpers::TrustedImmPtr(&selectionB), tempFPR);
    1088         auto bIsUnchanged = jit.branchDouble(CCallHelpers::DoubleEqual, selectionBFPR, tempFPR);
     1088        auto bIsUnchanged = jit.branchDouble(CCallHelpers::DoubleEqualAndOrdered, selectionBFPR, tempFPR);
    10891089        jit.loadDouble(CCallHelpers::TrustedImmPtr(&corruptedSelectionB), destFPR);
    10901090        bIsUnchanged.link(&jit);
     
    11271127        FPRReg tempFPR = FPRInfo::fpRegT5;
    11281128        jit.loadDouble(CCallHelpers::TrustedImmPtr(&selectionA), tempFPR);
    1129         auto aIsUnchanged = jit.branchDouble(CCallHelpers::DoubleEqual, selectionAFPR, tempFPR);
     1129        auto aIsUnchanged = jit.branchDouble(CCallHelpers::DoubleEqualAndOrdered, selectionAFPR, tempFPR);
    11301130        jit.loadDouble(CCallHelpers::TrustedImmPtr(&corruptedSelectionA), destFPR);
    11311131        aIsUnchanged.link(&jit);
     
    11691169        FPRReg tempFPR = FPRInfo::fpRegT5;
    11701170        jit.loadDouble(CCallHelpers::TrustedImmPtr(&selectionA), tempFPR);
    1171         auto aIsUnchanged = jit.branchDouble(CCallHelpers::DoubleEqual, selectionAFPR, tempFPR);
     1171        auto aIsUnchanged = jit.branchDouble(CCallHelpers::DoubleEqualAndOrdered, selectionAFPR, tempFPR);
    11721172        jit.loadDouble(CCallHelpers::TrustedImmPtr(&corruptedSelectionA), destFPR);
    11731173        aIsUnchanged.link(&jit);
    11741174
    11751175        jit.loadDouble(CCallHelpers::TrustedImmPtr(&selectionB), tempFPR);
    1176         auto bIsUnchanged = jit.branchDouble(CCallHelpers::DoubleEqual, selectionBFPR, tempFPR);
     1176        auto bIsUnchanged = jit.branchDouble(CCallHelpers::DoubleEqualAndOrdered, selectionBFPR, tempFPR);
    11771177        jit.loadDouble(CCallHelpers::TrustedImmPtr(&corruptedSelectionB), destFPR);
    11781178        bIsUnchanged.link(&jit);
     
    12151215        FPRReg tempFPR = FPRInfo::fpRegT5;
    12161216        jit.loadDouble(CCallHelpers::TrustedImmPtr(&selectionB), tempFPR);
    1217         auto bIsUnchanged = jit.branchDouble(CCallHelpers::DoubleEqual, selectionBFPR, tempFPR);
     1217        auto bIsUnchanged = jit.branchDouble(CCallHelpers::DoubleEqualAndOrdered, selectionBFPR, tempFPR);
    12181218        jit.loadDouble(CCallHelpers::TrustedImmPtr(&corruptedSelectionB), destFPR);
    12191219        bIsUnchanged.link(&jit);
     
    12561256        FPRReg tempFPR = FPRInfo::fpRegT5;
    12571257        jit.loadDouble(CCallHelpers::TrustedImmPtr(&selectionA), tempFPR);
    1258         auto aIsUnchanged = jit.branchDouble(CCallHelpers::DoubleEqual, selectionAFPR, tempFPR);
     1258        auto aIsUnchanged = jit.branchDouble(CCallHelpers::DoubleEqualAndOrdered, selectionAFPR, tempFPR);
    12591259        jit.loadDouble(CCallHelpers::TrustedImmPtr(&corruptedSelectionA), destFPR);
    12601260        aIsUnchanged.link(&jit);
     
    12751275        };
    12761276        switch (condition) {
    1277         case MacroAssembler::DoubleEqual:
     1277        case MacroAssembler::DoubleEqualAndOrdered:
    12781278            return !isUnordered(a) && (a == a) ? selectionA : selectionB;
    1279         case MacroAssembler::DoubleNotEqual:
     1279        case MacroAssembler::DoubleNotEqualAndOrdered:
    12801280            return !isUnordered(a) && (a != a) ? selectionA : selectionB;
    1281         case MacroAssembler::DoubleGreaterThan:
     1281        case MacroAssembler::DoubleGreaterThanAndOrdered:
    12821282            return !isUnordered(a) && (a > a) ? selectionA : selectionB;
    1283         case MacroAssembler::DoubleGreaterThanOrEqual:
     1283        case MacroAssembler::DoubleGreaterThanOrEqualAndOrdered:
    12841284            return !isUnordered(a) && (a >= a) ? selectionA : selectionB;
    1285         case MacroAssembler::DoubleLessThan:
     1285        case MacroAssembler::DoubleLessThanAndOrdered:
    12861286            return !isUnordered(a) && (a < a) ? selectionA : selectionB;
    1287         case MacroAssembler::DoubleLessThanOrEqual:
     1287        case MacroAssembler::DoubleLessThanOrEqualAndOrdered:
    12881288            return !isUnordered(a) && (a <= a) ? selectionA : selectionB;
    12891289        case MacroAssembler::DoubleEqualOrUnordered:
     
    22062206#define FOR_EACH_DOUBLE_CONDITION_RUN(__test) \
    22072207    do { \
    2208         RUN(__test(MacroAssembler::DoubleEqual)); \
    2209         RUN(__test(MacroAssembler::DoubleNotEqual)); \
    2210         RUN(__test(MacroAssembler::DoubleGreaterThan)); \
    2211         RUN(__test(MacroAssembler::DoubleGreaterThanOrEqual)); \
    2212         RUN(__test(MacroAssembler::DoubleLessThan)); \
    2213         RUN(__test(MacroAssembler::DoubleLessThanOrEqual)); \
     2208        RUN(__test(MacroAssembler::DoubleEqualAndOrdered)); \
     2209        RUN(__test(MacroAssembler::DoubleNotEqualAndOrdered)); \
     2210        RUN(__test(MacroAssembler::DoubleGreaterThanAndOrdered)); \
     2211        RUN(__test(MacroAssembler::DoubleGreaterThanOrEqualAndOrdered)); \
     2212        RUN(__test(MacroAssembler::DoubleLessThanAndOrdered)); \
     2213        RUN(__test(MacroAssembler::DoubleLessThanOrEqualAndOrdered)); \
    22142214        RUN(__test(MacroAssembler::DoubleEqualOrUnordered)); \
    22152215        RUN(__test(MacroAssembler::DoubleNotEqualOrUnordered)); \
  • trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp

    r254500 r258063  
    15931593                return createRelCond(MacroAssembler::NotEqual, MacroAssembler::DoubleNotEqualOrUnordered);
    15941594            case Equal:
    1595                 return createRelCond(MacroAssembler::Equal, MacroAssembler::DoubleEqual);
     1595                return createRelCond(MacroAssembler::Equal, MacroAssembler::DoubleEqualAndOrdered);
    15961596            case LessThan:
    1597                 return createRelCond(MacroAssembler::LessThan, MacroAssembler::DoubleLessThan);
     1597                return createRelCond(MacroAssembler::LessThan, MacroAssembler::DoubleLessThanAndOrdered);
    15981598            case GreaterThan:
    1599                 return createRelCond(MacroAssembler::GreaterThan, MacroAssembler::DoubleGreaterThan);
     1599                return createRelCond(MacroAssembler::GreaterThan, MacroAssembler::DoubleGreaterThanAndOrdered);
    16001600            case LessEqual:
    1601                 return createRelCond(MacroAssembler::LessThanOrEqual, MacroAssembler::DoubleLessThanOrEqual);
     1601                return createRelCond(MacroAssembler::LessThanOrEqual, MacroAssembler::DoubleLessThanOrEqualAndOrdered);
    16021602            case GreaterEqual:
    1603                 return createRelCond(MacroAssembler::GreaterThanOrEqual, MacroAssembler::DoubleGreaterThanOrEqual);
     1603                return createRelCond(MacroAssembler::GreaterThanOrEqual, MacroAssembler::DoubleGreaterThanOrEqualAndOrdered);
    16041604            case EqualOrUnordered:
    16051605                // The integer condition is never used in this case.
     
    16081608                // We use a bogus double condition because these integer comparisons won't got down that
    16091609                // path anyway.
    1610                 return createRelCond(MacroAssembler::Above, MacroAssembler::DoubleEqual);
     1610                return createRelCond(MacroAssembler::Above, MacroAssembler::DoubleEqualAndOrdered);
    16111611            case Below:
    1612                 return createRelCond(MacroAssembler::Below, MacroAssembler::DoubleEqual);
     1612                return createRelCond(MacroAssembler::Below, MacroAssembler::DoubleEqualAndOrdered);
    16131613            case AboveEqual:
    1614                 return createRelCond(MacroAssembler::AboveOrEqual, MacroAssembler::DoubleEqual);
     1614                return createRelCond(MacroAssembler::AboveOrEqual, MacroAssembler::DoubleEqualAndOrdered);
    16151615            case BelowEqual:
    1616                 return createRelCond(MacroAssembler::BelowOrEqual, MacroAssembler::DoubleEqual);
     1616                return createRelCond(MacroAssembler::BelowOrEqual, MacroAssembler::DoubleEqualAndOrdered);
    16171617            case BitAnd: {
    16181618                Value* left = value->child(0);
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r257399 r258063  
    28072807    MacroAssembler::Jump tooSmall = jit.branchDouble(MacroAssembler::DoubleLessThanOrEqualOrUnordered, source, scratch);
    28082808    jit.loadDouble(JITCompiler::TrustedImmPtr(&byteMax), scratch);
    2809     MacroAssembler::Jump tooBig = jit.branchDouble(MacroAssembler::DoubleGreaterThan, source, scratch);
     2809    MacroAssembler::Jump tooBig = jit.branchDouble(MacroAssembler::DoubleGreaterThanAndOrdered, source, scratch);
    28102810   
    28112811    jit.loadDouble(JITCompiler::TrustedImmPtr(&half), scratch);
     
    56475647                    m_jit.addDouble(resultFPR, scratchFPR);
    56485648
    5649                     JITCompiler::Jump shouldUseCeiled = m_jit.branchDouble(JITCompiler::DoubleLessThanOrEqual, scratchFPR, valueFPR);
     5649                    JITCompiler::Jump shouldUseCeiled = m_jit.branchDouble(JITCompiler::DoubleLessThanOrEqualAndOrdered, scratchFPR, valueFPR);
    56505650                    static constexpr double oneConstant = -1.0;
    56515651                    m_jit.loadDouble(TrustedImmPtr(&oneConstant), scratchFPR);
     
    57985798        MacroAssembler::JumpList done;
    57995799
    5800         MacroAssembler::Jump op1Less = m_jit.branchDouble(node->op() == ArithMin ? MacroAssembler::DoubleLessThan : MacroAssembler::DoubleGreaterThan, op1FPR, op2FPR);
     5800        MacroAssembler::Jump op1Less = m_jit.branchDouble(node->op() == ArithMin ? MacroAssembler::DoubleLessThanAndOrdered : MacroAssembler::DoubleGreaterThanAndOrdered, op1FPR, op2FPR);
    58015801
    58025802        // op2 is eather the lesser one or one of then is NaN
    5803         MacroAssembler::Jump op2Less = m_jit.branchDouble(node->op() == ArithMin ? MacroAssembler::DoubleGreaterThanOrEqual : MacroAssembler::DoubleLessThanOrEqual, op1FPR, op2FPR);
     5803        MacroAssembler::Jump op2Less = m_jit.branchDouble(node->op() == ArithMin ? MacroAssembler::DoubleGreaterThanOrEqualAndOrdered : MacroAssembler::DoubleLessThanOrEqualAndOrdered, op1FPR, op2FPR);
    58045804
    58055805        // Unordered case. We don't know which of op1, op2 is NaN. Manufacture NaN by adding
     
    59385938
    59395939            m_jit.moveZeroToDouble(resultFpr);
    5940             MacroAssembler::Jump xIsZeroOrNegativeZero = m_jit.branchDouble(MacroAssembler::DoubleEqual, xOperandFpr, resultFpr);
     5940            MacroAssembler::Jump xIsZeroOrNegativeZero = m_jit.branchDouble(MacroAssembler::DoubleEqualAndOrdered, xOperandFpr, resultFpr);
    59415941
    59425942            m_jit.loadDouble(TrustedImmPtr(&minusInfinityConstant), resultFpr);
    5943             MacroAssembler::Jump xIsMinusInfinity = m_jit.branchDouble(MacroAssembler::DoubleEqual, xOperandFpr, resultFpr);
     5943            MacroAssembler::Jump xIsMinusInfinity = m_jit.branchDouble(MacroAssembler::DoubleEqualAndOrdered, xOperandFpr, resultFpr);
    59445944            m_jit.sqrtDouble(xOperandFpr, resultFpr);
    59455945            MacroAssembler::Jump doneWithSqrt = m_jit.jump();
     
    59655965
    59665966            m_jit.moveZeroToDouble(resultFpr);
    5967             MacroAssembler::Jump xIsZeroOrNegativeZero = m_jit.branchDouble(MacroAssembler::DoubleEqual, xOperandFpr, resultFpr);
     5967            MacroAssembler::Jump xIsZeroOrNegativeZero = m_jit.branchDouble(MacroAssembler::DoubleEqualAndOrdered, xOperandFpr, resultFpr);
    59685968
    59695969            m_jit.loadDouble(TrustedImmPtr(&minusInfinityConstant), resultFpr);
    5970             MacroAssembler::Jump xIsMinusInfinity = m_jit.branchDouble(MacroAssembler::DoubleEqual, xOperandFpr, resultFpr);
     5970            MacroAssembler::Jump xIsMinusInfinity = m_jit.branchDouble(MacroAssembler::DoubleEqualAndOrdered, xOperandFpr, resultFpr);
    59715971
    59725972            static constexpr double oneConstant = 1.;
     
    61586158        if (branchIndexInBlock != UINT_MAX) {
    61596159            Node* branchNode = m_block->at(branchIndexInBlock);
    6160             compilePeepHoleDoubleBranch(node, branchNode, MacroAssembler::DoubleEqual);
     6160            compilePeepHoleDoubleBranch(node, branchNode, MacroAssembler::DoubleEqualAndOrdered);
    61616161            use(node->child1());
    61626162            use(node->child2());
     
    61656165            return true;
    61666166        }
    6167         compileDoubleCompare(node, MacroAssembler::DoubleEqual);
     6167        compileDoubleCompare(node, MacroAssembler::DoubleEqualAndOrdered);
    61686168        return false;
    61696169    }
     
    87118711        auto notFound = m_jit.branch32(CCallHelpers::Equal, indexGPR, lengthGPR);
    87128712        m_jit.loadDouble(MacroAssembler::BaseIndex(storageGPR, indexGPR, MacroAssembler::TimesEight), tempFPR);
    8713         auto found = m_jit.branchDouble(CCallHelpers::DoubleEqual, tempFPR, searchElementFPR);
     8713        auto found = m_jit.branchDouble(CCallHelpers::DoubleEqualAndOrdered, tempFPR, searchElementFPR);
    87148714        m_jit.add32(TrustedImm32(1), indexGPR);
    87158715        m_jit.jump().linkTo(loop, &m_jit);
     
    1202412024    m_jit.truncateDoubleToInt32(doubleValueFPR, scratchGPR);
    1202512025    m_jit.convertInt32ToDouble(scratchGPR, tempFPR);
    12026     passThroughCases.append(m_jit.branchDouble(JITCompiler::DoubleNotEqual, doubleValueFPR, tempFPR));
     12026    passThroughCases.append(m_jit.branchDouble(JITCompiler::DoubleNotEqualAndOrdered, doubleValueFPR, tempFPR));
    1202712027
    1202812028    m_jit.boxInt32(scratchGPR, resultRegs);
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp

    r257399 r258063  
    21582158
    21592159    case CompareLess:
    2160         if (compare(node, JITCompiler::LessThan, JITCompiler::DoubleLessThan, operationCompareLess))
     2160        if (compare(node, JITCompiler::LessThan, JITCompiler::DoubleLessThanAndOrdered, operationCompareLess))
    21612161            return;
    21622162        break;
    21632163
    21642164    case CompareLessEq:
    2165         if (compare(node, JITCompiler::LessThanOrEqual, JITCompiler::DoubleLessThanOrEqual, operationCompareLessEq))
     2165        if (compare(node, JITCompiler::LessThanOrEqual, JITCompiler::DoubleLessThanOrEqualAndOrdered, operationCompareLessEq))
    21662166            return;
    21672167        break;
    21682168
    21692169    case CompareGreater:
    2170         if (compare(node, JITCompiler::GreaterThan, JITCompiler::DoubleGreaterThan, operationCompareGreater))
     2170        if (compare(node, JITCompiler::GreaterThan, JITCompiler::DoubleGreaterThanAndOrdered, operationCompareGreater))
    21712171            return;
    21722172        break;
    21732173
    21742174    case CompareGreaterEq:
    2175         if (compare(node, JITCompiler::GreaterThanOrEqual, JITCompiler::DoubleGreaterThanOrEqual, operationCompareGreaterEq))
     2175        if (compare(node, JITCompiler::GreaterThanOrEqual, JITCompiler::DoubleGreaterThanOrEqualAndOrdered, operationCompareGreaterEq))
    21762176            return;
    21772177        break;
     
    21862186
    21872187    case CompareEq:
    2188         if (compare(node, JITCompiler::Equal, JITCompiler::DoubleEqual, operationCompareEq))
     2188        if (compare(node, JITCompiler::Equal, JITCompiler::DoubleEqualAndOrdered, operationCompareEq))
    21892189            return;
    21902190        break;
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp

    r257399 r258063  
    23062306
    23072307    case CompareLess:
    2308         if (compare(node, JITCompiler::LessThan, JITCompiler::DoubleLessThan, operationCompareLess))
     2308        if (compare(node, JITCompiler::LessThan, JITCompiler::DoubleLessThanAndOrdered, operationCompareLess))
    23092309            return;
    23102310        break;
    23112311
    23122312    case CompareLessEq:
    2313         if (compare(node, JITCompiler::LessThanOrEqual, JITCompiler::DoubleLessThanOrEqual, operationCompareLessEq))
     2313        if (compare(node, JITCompiler::LessThanOrEqual, JITCompiler::DoubleLessThanOrEqualAndOrdered, operationCompareLessEq))
    23142314            return;
    23152315        break;
    23162316
    23172317    case CompareGreater:
    2318         if (compare(node, JITCompiler::GreaterThan, JITCompiler::DoubleGreaterThan, operationCompareGreater))
     2318        if (compare(node, JITCompiler::GreaterThan, JITCompiler::DoubleGreaterThanAndOrdered, operationCompareGreater))
    23192319            return;
    23202320        break;
    23212321
    23222322    case CompareGreaterEq:
    2323         if (compare(node, JITCompiler::GreaterThanOrEqual, JITCompiler::DoubleGreaterThanOrEqual, operationCompareGreaterEq))
     2323        if (compare(node, JITCompiler::GreaterThanOrEqual, JITCompiler::DoubleGreaterThanOrEqualAndOrdered, operationCompareGreaterEq))
    23242324            return;
    23252325        break;
     
    23342334
    23352335    case CompareEq:
    2336         if (compare(node, JITCompiler::Equal, JITCompiler::DoubleEqual, operationCompareEq))
     2336        if (compare(node, JITCompiler::Equal, JITCompiler::DoubleEqualAndOrdered, operationCompareEq))
    23372337            return;
    23382338        break;
     
    41154115        notNanNorInfinity.link(&m_jit);
    41164116        m_jit.roundTowardZeroDouble(tempFPR1, tempFPR2);
    4117         m_jit.compareDouble(JITCompiler::DoubleEqual, tempFPR1, tempFPR2, resultGPR);
     4117        m_jit.compareDouble(JITCompiler::DoubleEqualAndOrdered, tempFPR1, tempFPR2, resultGPR);
    41184118        m_jit.or32(TrustedImm32(JSValue::ValueFalse), resultGPR);
    41194119        done.append(m_jit.jump());
  • trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

    r257399 r258063  
    1049710497            FPRReg temp = params.fpScratch(0);
    1049810498            jit.roundTowardZeroDouble(input, temp);
    10499             jit.compareDouble(MacroAssembler::DoubleEqual, input, temp, result);
     10499            jit.compareDouble(MacroAssembler::DoubleEqualAndOrdered, input, temp, result);
    1050010500        });
    1050110501        ValueFromBlock patchpointResult = m_out.anchor(patchpoint);
  • trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h

    r257201 r258063  
    10941094    Jump branchIfNotNaN(FPRReg fpr)
    10951095    {
    1096         return branchDouble(DoubleEqual, fpr, fpr);
     1096        return branchDouble(DoubleEqualAndOrdered, fpr, fpr);
    10971097    }
    10981098
  • trunk/Source/JavaScriptCore/jit/JITArithmetic.cpp

    r254735 r258063  
    9696void JIT::emitSlow_op_jless(const Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
    9797{
    98     emit_compareAndJumpSlow<OpJless>(currentInstruction, DoubleLessThan, operationCompareLess, false, iter);
     98    emit_compareAndJumpSlow<OpJless>(currentInstruction, DoubleLessThanAndOrdered, operationCompareLess, false, iter);
    9999}
    100100
    101101void JIT::emitSlow_op_jlesseq(const Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
    102102{
    103     emit_compareAndJumpSlow<OpJlesseq>(currentInstruction, DoubleLessThanOrEqual, operationCompareLessEq, false, iter);
     103    emit_compareAndJumpSlow<OpJlesseq>(currentInstruction, DoubleLessThanOrEqualAndOrdered, operationCompareLessEq, false, iter);
    104104}
    105105
    106106void JIT::emitSlow_op_jgreater(const Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
    107107{
    108     emit_compareAndJumpSlow<OpJgreater>(currentInstruction, DoubleGreaterThan, operationCompareGreater, false, iter);
     108    emit_compareAndJumpSlow<OpJgreater>(currentInstruction, DoubleGreaterThanAndOrdered, operationCompareGreater, false, iter);
    109109}
    110110
    111111void JIT::emitSlow_op_jgreatereq(const Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
    112112{
    113     emit_compareAndJumpSlow<OpJgreatereq>(currentInstruction, DoubleGreaterThanOrEqual, operationCompareGreaterEq, false, iter);
     113    emit_compareAndJumpSlow<OpJgreatereq>(currentInstruction, DoubleGreaterThanOrEqualAndOrdered, operationCompareGreaterEq, false, iter);
    114114}
    115115
  • trunk/Source/JavaScriptCore/jit/JITArithmetic32_64.cpp

    r254947 r258063  
    234234            case op_jless:
    235235                emitLoadDouble(op1, fpRegT2);
    236                 addJump(branchDouble(DoubleLessThan, fpRegT2, fpRegT0), target);
     236                addJump(branchDouble(DoubleLessThanAndOrdered, fpRegT2, fpRegT0), target);
    237237                break;
    238238            case op_jlesseq:
    239239                emitLoadDouble(op1, fpRegT2);
    240                 addJump(branchDouble(DoubleLessThanOrEqual, fpRegT2, fpRegT0), target);
     240                addJump(branchDouble(DoubleLessThanOrEqualAndOrdered, fpRegT2, fpRegT0), target);
    241241                break;
    242242            case op_jgreater:
    243243                emitLoadDouble(op1, fpRegT2);
    244                 addJump(branchDouble(DoubleGreaterThan, fpRegT2, fpRegT0), target);
     244                addJump(branchDouble(DoubleGreaterThanAndOrdered, fpRegT2, fpRegT0), target);
    245245                break;
    246246            case op_jgreatereq:
    247247                emitLoadDouble(op1, fpRegT2);
    248                 addJump(branchDouble(DoubleGreaterThanOrEqual, fpRegT2, fpRegT0), target);
     248                addJump(branchDouble(DoubleGreaterThanOrEqualAndOrdered, fpRegT2, fpRegT0), target);
    249249                break;
    250250            case op_jnless:
     
    291291            case op_jless:
    292292                emitLoadDouble(op2, fpRegT1);
    293                 addJump(branchDouble(DoubleLessThan, fpRegT0, fpRegT1), target);
     293                addJump(branchDouble(DoubleLessThanAndOrdered, fpRegT0, fpRegT1), target);
    294294                break;
    295295            case op_jlesseq:
    296296                emitLoadDouble(op2, fpRegT1);
    297                 addJump(branchDouble(DoubleLessThanOrEqual, fpRegT0, fpRegT1), target);
     297                addJump(branchDouble(DoubleLessThanOrEqualAndOrdered, fpRegT0, fpRegT1), target);
    298298                break;
    299299            case op_jgreater:
    300300                emitLoadDouble(op2, fpRegT1);
    301                 addJump(branchDouble(DoubleGreaterThan, fpRegT0, fpRegT1), target);
     301                addJump(branchDouble(DoubleGreaterThanAndOrdered, fpRegT0, fpRegT1), target);
    302302                break;
    303303            case op_jgreatereq:
    304304                emitLoadDouble(op2, fpRegT1);
    305                 addJump(branchDouble(DoubleGreaterThanOrEqual, fpRegT0, fpRegT1), target);
     305                addJump(branchDouble(DoubleGreaterThanOrEqualAndOrdered, fpRegT0, fpRegT1), target);
    306306                break;
    307307            case op_jnless:
  • trunk/Source/JavaScriptCore/jit/ThunkGenerators.cpp

    r254843 r258063  
    901901    if (jit.supportsFloatingPointTruncate()) {
    902902        jit.moveZeroToDouble(SpecializedThunkJIT::fpRegT1);
    903         doubleResult.append(jit.branchDouble(MacroAssembler::DoubleEqual, SpecializedThunkJIT::fpRegT0, SpecializedThunkJIT::fpRegT1));
     903        doubleResult.append(jit.branchDouble(MacroAssembler::DoubleEqualAndOrdered, SpecializedThunkJIT::fpRegT0, SpecializedThunkJIT::fpRegT1));
    904904        SpecializedThunkJIT::JumpList slowPath;
    905905        // Handle the negative doubles in the slow path for now.
     
    978978    if (jit.supportsFloatingPointRounding()) {
    979979        jit.moveZeroToDouble(SpecializedThunkJIT::fpRegT1);
    980         doubleResult.append(jit.branchDouble(MacroAssembler::DoubleEqual, SpecializedThunkJIT::fpRegT0, SpecializedThunkJIT::fpRegT1));
     980        doubleResult.append(jit.branchDouble(MacroAssembler::DoubleEqualAndOrdered, SpecializedThunkJIT::fpRegT0, SpecializedThunkJIT::fpRegT1));
    981981
    982982        jit.ceilDouble(SpecializedThunkJIT::fpRegT0, SpecializedThunkJIT::fpRegT1);
     
    984984        jit.loadDouble(MacroAssembler::TrustedImmPtr(&halfConstant), SpecializedThunkJIT::fpRegT2);
    985985        jit.addDouble(SpecializedThunkJIT::fpRegT1, SpecializedThunkJIT::fpRegT2);
    986         MacroAssembler::Jump shouldRoundDown = jit.branchDouble(MacroAssembler::DoubleGreaterThan, SpecializedThunkJIT::fpRegT2, SpecializedThunkJIT::fpRegT0);
     986        MacroAssembler::Jump shouldRoundDown = jit.branchDouble(MacroAssembler::DoubleGreaterThanAndOrdered, SpecializedThunkJIT::fpRegT2, SpecializedThunkJIT::fpRegT0);
    987987
    988988        jit.moveDouble(SpecializedThunkJIT::fpRegT1, SpecializedThunkJIT::fpRegT0);
  • trunk/Source/JavaScriptCore/wasm/WasmAirIRGenerator.cpp

    r257609 r258063  
    31903190{
    31913191    result = g32();
    3192     append(CompareDouble, Arg::doubleCond(MacroAssembler::DoubleLessThanOrEqual), arg0, arg1, result);
     3192    append(CompareDouble, Arg::doubleCond(MacroAssembler::DoubleLessThanOrEqualAndOrdered), arg0, arg1, result);
    31933193    return { };
    31943194}
     
    32163216{
    32173217    result = g32();
    3218     append(CompareDouble, Arg::doubleCond(MacroAssembler::DoubleLessThan), arg0, arg1, result);
     3218    append(CompareDouble, Arg::doubleCond(MacroAssembler::DoubleLessThanAndOrdered), arg0, arg1, result);
    32193219    return { };
    32203220}
     
    32343234
    32353235    auto branchOp = floatType == F32 ? BranchFloat : BranchDouble;
    3236     append(m_currentBlock, branchOp, Arg::doubleCond(MacroAssembler::DoubleEqual), arg0, arg1);
     3236    append(m_currentBlock, branchOp, Arg::doubleCond(MacroAssembler::DoubleEqualAndOrdered), arg0, arg1);
    32373237    m_currentBlock->setSuccessors(isEqual, notEqual);
    32383238
    3239     append(notEqual, branchOp, Arg::doubleCond(MacroAssembler::DoubleLessThan), arg0, arg1);
     3239    append(notEqual, branchOp, Arg::doubleCond(MacroAssembler::DoubleLessThanAndOrdered), arg0, arg1);
    32403240    notEqual->setSuccessors(isLessThan, notLessThan);
    32413241
    3242     append(notLessThan, branchOp, Arg::doubleCond(MacroAssembler::DoubleGreaterThan), arg0, arg1);
     3242    append(notLessThan, branchOp, Arg::doubleCond(MacroAssembler::DoubleGreaterThanAndOrdered), arg0, arg1);
    32433243    notLessThan->setSuccessors(isGreaterThan, isNaN);
    32443244
     
    33493349{
    33503350    result = g32();
    3351     append(CompareDouble, Arg::doubleCond(MacroAssembler::DoubleGreaterThan), arg0, arg1, result);
     3351    append(CompareDouble, Arg::doubleCond(MacroAssembler::DoubleGreaterThanAndOrdered), arg0, arg1, result);
    33523352    return { };
    33533353}
     
    33633363{
    33643364    result = g32();
    3365     append(CompareDouble, Arg::doubleCond(MacroAssembler::DoubleGreaterThanOrEqual), arg0, arg1, result);
     3365    append(CompareDouble, Arg::doubleCond(MacroAssembler::DoubleGreaterThanOrEqualAndOrdered), arg0, arg1, result);
    33663366    return { };
    33673367}
     
    35333533{
    35343534    result = g32();
    3535     append(CompareFloat, Arg::doubleCond(MacroAssembler::DoubleLessThan), arg0, arg1, result);
     3535    append(CompareFloat, Arg::doubleCond(MacroAssembler::DoubleLessThanAndOrdered), arg0, arg1, result);
    35363536    return { };
    35373537}
     
    35473547{
    35483548    result = g32();
    3549     append(CompareDouble, Arg::doubleCond(MacroAssembler::DoubleEqual), arg0, arg1, result);
     3549    append(CompareDouble, Arg::doubleCond(MacroAssembler::DoubleEqualAndOrdered), arg0, arg1, result);
    35503550    return { };
    35513551}
     
    35543554{
    35553555    result = g32();
    3556     append(CompareFloat, Arg::doubleCond(MacroAssembler::DoubleLessThanOrEqual), arg0, arg1, result);
     3556    append(CompareFloat, Arg::doubleCond(MacroAssembler::DoubleLessThanOrEqualAndOrdered), arg0, arg1, result);
    35573557    return { };
    35583558}
     
    35613561{
    35623562    result = g32();
    3563     append(CompareFloat, Arg::doubleCond(MacroAssembler::DoubleGreaterThanOrEqual), arg0, arg1, result);
     3563    append(CompareFloat, Arg::doubleCond(MacroAssembler::DoubleGreaterThanOrEqualAndOrdered), arg0, arg1, result);
    35643564    return { };
    35653565}
     
    37733773{
    37743774    result = g32();
    3775     append(CompareFloat, Arg::doubleCond(MacroAssembler::DoubleEqual), arg0, arg1, result);
     3775    append(CompareFloat, Arg::doubleCond(MacroAssembler::DoubleEqualAndOrdered), arg0, arg1, result);
    37763776    return { };
    37773777}
     
    38373837{
    38383838    result = g32();
    3839     append(CompareFloat, Arg::doubleCond(MacroAssembler::DoubleGreaterThan), arg0, arg1, result);
     3839    append(CompareFloat, Arg::doubleCond(MacroAssembler::DoubleGreaterThanAndOrdered), arg0, arg1, result);
    38403840    return { };
    38413841}
Note: See TracChangeset for help on using the changeset viewer.