Changeset 251106 in webkit


Ignore:
Timestamp:
Oct 14, 2019 3:52:11 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, rolling out r251090.
https://bugs.webkit.org/show_bug.cgi?id=202959

"broke tests" (Requested by RMorisset on #webkit).

Reverted changeset:

"Split ArithProfile into a Unary and a Binary version"
https://bugs.webkit.org/show_bug.cgi?id=202832
https://trac.webkit.org/changeset/251090

Location:
trunk/Source/JavaScriptCore
Files:
39 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r251090 r251106  
     12019-10-14  Commit Queue  <commit-queue@webkit.org>
     2
     3        Unreviewed, rolling out r251090.
     4        https://bugs.webkit.org/show_bug.cgi?id=202959
     5
     6        "broke tests" (Requested by RMorisset on #webkit).
     7
     8        Reverted changeset:
     9
     10        "Split ArithProfile into a Unary and a Binary version"
     11        https://bugs.webkit.org/show_bug.cgi?id=202832
     12        https://trac.webkit.org/changeset/251090
     13
    1142019-10-14  Robin Morisset  <rmorisset@apple.com>
    215
  • trunk/Source/JavaScriptCore/bytecode/ArithProfile.cpp

    r251090 r251106  
    3333
    3434#if ENABLE(JIT)
    35 template<typename BitfieldType>
    36 void ArithProfile<BitfieldType>::emitObserveResult(CCallHelpers& jit, JSValueRegs regs, TagRegistersMode mode)
     35void ArithProfile::emitObserveResult(CCallHelpers& jit, JSValueRegs regs, TagRegistersMode mode)
    3736{
    3837    if (!shouldEmitSetDouble() && !shouldEmitSetNonNumeric() && !shouldEmitSetBigInt())
     
    6059}
    6160
    62 template<typename BitfieldType>
    63 bool ArithProfile<BitfieldType>::shouldEmitSetDouble() const
     61bool ArithProfile::shouldEmitSetDouble() const
    6462{
    65     uint32_t mask = Int32Overflow | Int52Overflow | NegZeroDouble | NonNegZeroDouble;
     63    uint32_t mask = ArithProfile::Int32Overflow | ArithProfile::Int52Overflow | ArithProfile::NegZeroDouble | ArithProfile::NonNegZeroDouble;
    6664    return (m_bits & mask) != mask;
    6765}
    6866
    69 template<typename BitfieldType>
    70 void ArithProfile<BitfieldType>::emitSetDouble(CCallHelpers& jit) const
     67void ArithProfile::emitSetDouble(CCallHelpers& jit) const
    7168{
    7269    if (shouldEmitSetDouble())
    73         jit.or32(CCallHelpers::TrustedImm32(Int32Overflow | Int52Overflow | NegZeroDouble | NonNegZeroDouble), CCallHelpers::AbsoluteAddress(addressOfBits()));
     70        jit.or32(CCallHelpers::TrustedImm32(ArithProfile::Int32Overflow | ArithProfile::Int52Overflow | ArithProfile::NegZeroDouble | ArithProfile::NonNegZeroDouble), CCallHelpers::AbsoluteAddress(addressOfBits()));
    7471}
    7572
    76 template<typename BitfieldType>
    77 bool ArithProfile<BitfieldType>::shouldEmitSetNonNumeric() const
     73bool ArithProfile::shouldEmitSetNonNumeric() const
    7874{
    7975    uint32_t mask = ArithProfile::NonNumeric;
     
    8177}
    8278
    83 template<typename BitfieldType>
    84 bool ArithProfile<BitfieldType>::shouldEmitSetBigInt() const
     79bool ArithProfile::shouldEmitSetBigInt() const
    8580{
    8681    uint32_t mask = ArithProfile::BigInt;
     
    8883}
    8984
    90 template<typename BitfieldType>
    91 void ArithProfile<BitfieldType>::emitSetNonNumeric(CCallHelpers& jit) const
     85void ArithProfile::emitSetNonNumeric(CCallHelpers& jit) const
    9286{
    9387    if (shouldEmitSetNonNumeric())
    94         jit.or32(CCallHelpers::TrustedImm32(NonNumeric), CCallHelpers::AbsoluteAddress(addressOfBits()));
     88        jit.or32(CCallHelpers::TrustedImm32(ArithProfile::NonNumeric), CCallHelpers::AbsoluteAddress(addressOfBits()));
    9589}
    9690
    97 template<typename BitfieldType>
    98 void ArithProfile<BitfieldType>::emitSetBigInt(CCallHelpers& jit) const
     91void ArithProfile::emitSetBigInt(CCallHelpers& jit) const
    9992{
    10093    if (shouldEmitSetBigInt())
    101         jit.or32(CCallHelpers::TrustedImm32(BigInt), CCallHelpers::AbsoluteAddress(addressOfBits()));
     94        jit.or32(CCallHelpers::TrustedImm32(ArithProfile::BigInt), CCallHelpers::AbsoluteAddress(addressOfBits()));
    10295}
    103 
    104 template class ArithProfile<uint16_t>; // Generate the implementations for UnaryArithProfile
    105 template class ArithProfile<uint32_t>; // Generate the implementations for BinaryArithProfile
    10696#endif // ENABLE(JIT)
    10797
     
    112102using namespace JSC;
    113103
    114 void printInternal(PrintStream& out, const UnaryArithProfile& profile)
    115 {
    116     const char* separator = "";
    117 
    118     out.print("Result:<");
    119     if (!profile.didObserveNonInt32()) {
    120         out.print("Int32");
    121         separator = "|";
    122     } else {
    123         if (profile.didObserveNegZeroDouble()) {
    124             out.print(separator, "NegZeroDouble");
    125             separator = "|";
    126         }
    127         if (profile.didObserveNonNegZeroDouble()) {
    128             out.print(separator, "NonNegZeroDouble");
    129             separator = "|";
    130         }
    131         if (profile.didObserveNonNumeric()) {
    132             out.print(separator, "NonNumeric");
    133             separator = "|";
    134         }
    135         if (profile.didObserveInt32Overflow()) {
    136             out.print(separator, "Int32Overflow");
    137             separator = "|";
    138         }
    139         if (profile.didObserveInt52Overflow()) {
    140             out.print(separator, "Int52Overflow");
    141             separator = "|";
    142         }
    143         if (profile.didObserveBigInt()) {
    144             out.print(separator, "BigInt");
    145             separator = "|";
    146         }
    147     }
    148     out.print(">");
    149 
    150     out.print(" Arg ObservedType:<");
    151     out.print(profile.argObservedType());
    152     out.print(">");
    153 
    154     out.print(" Arg ResultType:<");
    155     out.print(RawPointer(bitwise_cast<void*>(static_cast<uintptr_t>(profile.argResultType().bits()))));
    156     out.print(">");
    157 }
    158 
    159 void printInternal(PrintStream& out, const BinaryArithProfile& profile)
     104void printInternal(PrintStream& out, const ArithProfile& profile)
    160105{
    161106    const char* separator = "";
  • trunk/Source/JavaScriptCore/bytecode/ArithProfile.h

    r251090 r251106  
    6767};
    6868
    69 template <typename BitfieldType>
    70 class ArithProfile {
     69struct ArithProfile {
     70private:
     71    static constexpr uint32_t numberOfFlagBits = 6;
     72    static constexpr uint32_t rhsResultTypeShift = numberOfFlagBits;
     73    static constexpr uint32_t lhsResultTypeShift = rhsResultTypeShift + ResultType::numBitsNeeded;
     74    static constexpr uint32_t rhsObservedTypeShift = lhsResultTypeShift + ResultType::numBitsNeeded;
     75    static constexpr uint32_t lhsObservedTypeShift = rhsObservedTypeShift + ObservedType::numBitsNeeded;
     76
     77    static_assert(ObservedType::numBitsNeeded == 3, "We make a hard assumption about that here.");
     78    static constexpr uint32_t clearRhsObservedTypeBitMask = static_cast<uint32_t>(~((1 << rhsObservedTypeShift) | (1 << (rhsObservedTypeShift + 1)) | (1 << (rhsObservedTypeShift + 2))));
     79    static constexpr uint32_t clearLhsObservedTypeBitMask = static_cast<uint32_t>(~((1 << lhsObservedTypeShift) | (1 << (lhsObservedTypeShift + 1)) | (1 << (lhsObservedTypeShift + 2))));
     80
     81    static constexpr uint32_t resultTypeMask = (1 << ResultType::numBitsNeeded) - 1;
     82    static constexpr uint32_t observedTypeMask = (1 << ObservedType::numBitsNeeded) - 1;
     83
     84    enum class ConstantTag { Constant };
     85
    7186public:
     87    static constexpr uint32_t specialFastPathBit = 1 << (lhsObservedTypeShift + ObservedType::numBitsNeeded);
     88    static_assert((lhsObservedTypeShift + ObservedType::numBitsNeeded) <= (sizeof(uint32_t) * 8) - 1, "Should fit in a uint32_t.");
     89    static_assert(!(specialFastPathBit & ~clearLhsObservedTypeBitMask), "These bits should not intersect.");
     90    static_assert(specialFastPathBit & clearLhsObservedTypeBitMask, "These bits should intersect.");
     91    static_assert(specialFastPathBit > ~clearLhsObservedTypeBitMask, "These bits should not intersect and specialFastPathBit should be a higher bit.");
     92
     93    ArithProfile(ResultType arg)
     94        : ArithProfile(ConstantTag::Constant, arg)
     95    {
     96        ASSERT(lhsResultType().bits() == arg.bits());
     97        ASSERT(lhsObservedType().isEmpty());
     98        ASSERT(rhsObservedType().isEmpty());
     99    }
     100
     101    ArithProfile(ResultType lhs, ResultType rhs)
     102        : ArithProfile(ConstantTag::Constant, lhs, rhs)
     103    {
     104        ASSERT(lhsResultType().bits() == lhs.bits() && rhsResultType().bits() == rhs.bits());
     105        ASSERT(lhsObservedType().isEmpty());
     106        ASSERT(rhsObservedType().isEmpty());
     107    }
     108
     109    ArithProfile(OperandTypes types)
     110        : ArithProfile(types.first(), types.second())
     111    { }
     112
     113    ArithProfile() = default;
     114
     115    static constexpr ArithProfile fromInt(uint32_t bits)
     116    {
     117        return ArithProfile { ConstantTag::Constant, bits };
     118    }
     119
     120    static constexpr ArithProfile observedUnaryInt()
     121    {
     122        constexpr ObservedType observedInt32 { ObservedType().withInt32() };
     123        constexpr uint32_t bits = observedInt32.bits() << lhsObservedTypeShift;
     124        static_assert(bits == 0x800000, "");
     125        return fromInt(bits);
     126    }
     127    static constexpr ArithProfile observedUnaryNumber()
     128    {
     129        constexpr ObservedType observedNumber { ObservedType().withNumber() };
     130        constexpr uint32_t bits = observedNumber.bits() << lhsObservedTypeShift;
     131        static_assert(bits == 0x1000000, "");
     132        return fromInt(bits);
     133    }
     134    static constexpr ArithProfile observedBinaryIntInt()
     135    {
     136        constexpr ObservedType observedInt32 { ObservedType().withInt32() };
     137        constexpr uint32_t bits = (observedInt32.bits() << lhsObservedTypeShift) | (observedInt32.bits() << rhsObservedTypeShift);
     138        static_assert(bits == 0x900000, "");
     139        return fromInt(bits);
     140    }
     141    static constexpr ArithProfile observedBinaryNumberInt()
     142    {
     143        constexpr ObservedType observedNumber { ObservedType().withNumber() };
     144        constexpr ObservedType observedInt32 { ObservedType().withInt32() };
     145        constexpr uint32_t bits = (observedNumber.bits() << lhsObservedTypeShift) | (observedInt32.bits() << rhsObservedTypeShift);
     146        static_assert(bits == 0x1100000, "");
     147        return fromInt(bits);
     148    }
     149    static constexpr ArithProfile observedBinaryIntNumber()
     150    {
     151        constexpr ObservedType observedNumber { ObservedType().withNumber() };
     152        constexpr ObservedType observedInt32 { ObservedType().withInt32() };
     153        constexpr uint32_t bits = (observedInt32.bits() << lhsObservedTypeShift) | (observedNumber.bits() << rhsObservedTypeShift);
     154        static_assert(bits == 0xa00000, "");
     155        return fromInt(bits);
     156    }
     157    static constexpr ArithProfile observedBinaryNumberNumber()
     158    {
     159        constexpr ObservedType observedNumber { ObservedType().withNumber() };
     160        constexpr uint32_t bits = (observedNumber.bits() << lhsObservedTypeShift) | (observedNumber.bits() << rhsObservedTypeShift);
     161        static_assert(bits == 0x1200000, "");
     162        return fromInt(bits);
     163    }
     164
    72165    enum ObservedResults {
    73166        NonNegZeroDouble = 1 << 0,
     
    78171        BigInt           = 1 << 5,
    79172    };
    80     static constexpr uint32_t observedResultsNumBitsNeeded = 6;
     173
     174    ResultType lhsResultType() const { return ResultType((m_bits >> lhsResultTypeShift) & resultTypeMask); }
     175    ResultType rhsResultType() const { return ResultType((m_bits >> rhsResultTypeShift) & resultTypeMask); }
     176
     177    constexpr ObservedType lhsObservedType() const { return ObservedType((m_bits >> lhsObservedTypeShift) & observedTypeMask); }
     178    constexpr ObservedType rhsObservedType() const { return ObservedType((m_bits >> rhsObservedTypeShift) & observedTypeMask); }
     179    void setLhsObservedType(ObservedType type)
     180    {
     181        uint32_t bits = m_bits;
     182        bits &= clearLhsObservedTypeBitMask;
     183        bits |= type.bits() << lhsObservedTypeShift;
     184        m_bits = bits;
     185        ASSERT(lhsObservedType() == type);
     186    }
     187
     188    void setRhsObservedType(ObservedType type)
     189    {
     190        uint32_t bits = m_bits;
     191        bits &= clearRhsObservedTypeBitMask;
     192        bits |= type.bits() << rhsObservedTypeShift;
     193        m_bits = bits;
     194        ASSERT(rhsObservedType() == type);
     195    }
     196
     197    bool tookSpecialFastPath() const { return m_bits & specialFastPathBit; }
    81198
    82199    bool didObserveNonInt32() const { return hasBits(NonNegZeroDouble | NegZeroDouble | NonNumeric | BigInt); }
     
    95212    void setObservedInt32Overflow() { setBit(Int32Overflow); }
    96213    void setObservedInt52Overflow() { setBit(Int52Overflow); }
     214
     215    const void* addressOfBits() const { return &m_bits; }
    97216
    98217    void observeResult(JSValue value)
     
    111230    }
    112231
    113     const void* addressOfBits() const { return &m_bits; }
    114 
    115 #if ENABLE(JIT)
    116     // Sets (Int32Overflow | Int52Overflow | NonNegZeroDouble | NegZeroDouble) if it sees a
    117     // double. Sets NonNumeric if it sees a non-numeric.
    118     void emitObserveResult(CCallHelpers&, JSValueRegs, TagRegistersMode = HaveTagRegisters);
    119 
    120     // Sets (Int32Overflow | Int52Overflow | NonNegZeroDouble | NegZeroDouble).
    121     bool shouldEmitSetDouble() const;
    122     void emitSetDouble(CCallHelpers&) const;
    123 
    124     // Sets NonNumber.
    125     void emitSetNonNumeric(CCallHelpers&) const;
    126     bool shouldEmitSetNonNumeric() const;
    127 
    128     // Sets BigInt
    129     void emitSetBigInt(CCallHelpers&) const;
    130     bool shouldEmitSetBigInt() const;
    131 #endif // ENABLE(JIT)
    132 
    133     constexpr uint32_t bits() const { return m_bits; }
    134 
    135 protected:
    136     ArithProfile(BitfieldType bits)
    137         : m_bits(bits)
    138     {
    139     }
    140 
    141     bool hasBits(int mask) const { return m_bits & mask; }
    142     void setBit(int mask) { m_bits |= mask; }
    143 
    144     BitfieldType m_bits { 0 }; // We take care to update m_bits only in a single operation. We don't ever store an inconsistent bit representation to it.
    145 };
    146 
    147 /* This class stores the following components in 16 bits:
    148  * - ObservedResults
    149  * - ResultType for the argument
    150  * - ObservedType for the argument
    151  */
    152 class UnaryArithProfile : public ArithProfile<uint16_t> {
    153     static constexpr unsigned argResultTypeShift = observedResultsNumBitsNeeded;
    154     static constexpr unsigned argObservedTypeShift = argResultTypeShift + ResultType::numBitsNeeded;
    155 
    156     static_assert(argObservedTypeShift + ObservedType::numBitsNeeded <= sizeof(uint16_t) * 8, "Should fit in a uint16_t");
    157 
    158     static constexpr uint16_t clearArgObservedTypeBitMask = static_cast<uint16_t>(~(0b111 << argObservedTypeShift));
    159 
    160     static constexpr uint16_t resultTypeMask = (1 << ResultType::numBitsNeeded) - 1;
    161     static constexpr uint16_t observedTypeMask = (1 << ObservedType::numBitsNeeded) - 1;
    162 
    163 public:
    164     UnaryArithProfile(ResultType arg)
    165         : ArithProfile<uint16_t>(arg.bits() << argResultTypeShift)
    166     {
    167         ASSERT(argResultType().bits() == arg.bits());
    168         ASSERT(argObservedType().isEmpty());
    169         ASSERT(argObservedType().isEmpty());
    170     }
    171 
    172     UnaryArithProfile()
    173         : UnaryArithProfile(ResultType::unknownType())
    174     {
    175     }
    176 
    177     static constexpr uint16_t observedIntBits()
    178     {
    179         constexpr ObservedType observedInt32 { ObservedType().withInt32() };
    180         constexpr uint16_t bits = observedInt32.bits() << argObservedTypeShift;
    181         static_assert(bits == 0x2000, "");
    182         return bits;
    183     }
    184     static constexpr uint16_t observedNumberBits()
    185     {
    186         constexpr ObservedType observedNumber { ObservedType().withNumber() };
    187         constexpr uint16_t bits = observedNumber.bits() << argObservedTypeShift;
    188         static_assert(bits == 0x4000, "");
    189         return bits;
    190     }
    191 
    192     ResultType argResultType() const { return ResultType((m_bits >> argResultTypeShift) & resultTypeMask); }
    193 
    194     constexpr ObservedType argObservedType() const { return ObservedType((m_bits >> argObservedTypeShift) & observedTypeMask); }
    195     void setArgObservedType(ObservedType type)
    196     {
    197         uint16_t bits = m_bits;
    198         bits &= clearArgObservedTypeBitMask;
    199         bits |= type.bits() << argObservedTypeShift;
    200         m_bits = bits;
    201         ASSERT(argObservedType() == type);
    202     }
    203 
    204     void argSawInt32() { setArgObservedType(argObservedType().withInt32()); }
    205     void argSawNumber() { setArgObservedType(argObservedType().withNumber()); }
    206     void argSawNonNumber() { setArgObservedType(argObservedType().withNonNumber()); }
    207 
    208     void observeArg(JSValue arg)
    209     {
    210         UnaryArithProfile newProfile = *this;
    211         if (arg.isNumber()) {
    212             if (arg.isInt32())
    213                 newProfile.argSawInt32();
    214             else
    215                 newProfile.argSawNumber();
    216         } else
    217             newProfile.argSawNonNumber();
    218 
    219         m_bits = newProfile.bits();
    220     }
    221 
    222     bool isObservedTypeEmpty()
    223     {
    224         return argObservedType().isEmpty();
    225     }
    226 
    227     friend class JSC::LLIntOffsetsExtractor;
    228 };
    229 
    230 /* This class stores the following components in 32 bits:
    231  * - ObservedResults
    232  * - ResultType for right-hand-side
    233  * - ResultType for left-hand-side
    234  * - ObservedType for right-hand-side
    235  * - ObservedType for left-hand-side
    236  * - a bit used by division to indicate whether a special fast path was taken
    237  */
    238 class BinaryArithProfile : public ArithProfile<uint32_t> {
    239     static constexpr uint32_t rhsResultTypeShift = observedResultsNumBitsNeeded;
    240     static constexpr uint32_t lhsResultTypeShift = rhsResultTypeShift + ResultType::numBitsNeeded;
    241     static constexpr uint32_t rhsObservedTypeShift = lhsResultTypeShift + ResultType::numBitsNeeded;
    242     static constexpr uint32_t lhsObservedTypeShift = rhsObservedTypeShift + ObservedType::numBitsNeeded;
    243 
    244     static_assert(ObservedType::numBitsNeeded == 3, "We make a hard assumption about that here.");
    245     static constexpr uint32_t clearRhsObservedTypeBitMask = static_cast<uint32_t>(~(0b111 << rhsObservedTypeShift));
    246     static constexpr uint32_t clearLhsObservedTypeBitMask = static_cast<uint32_t>(~(0b111 << lhsObservedTypeShift));
    247 
    248     static constexpr uint32_t resultTypeMask = (1 << ResultType::numBitsNeeded) - 1;
    249     static constexpr uint32_t observedTypeMask = (1 << ObservedType::numBitsNeeded) - 1;
    250 
    251 public:
    252     static constexpr uint32_t specialFastPathBit = 1 << (lhsObservedTypeShift + ObservedType::numBitsNeeded);
    253     static_assert((lhsObservedTypeShift + ObservedType::numBitsNeeded + 1) <= sizeof(uint32_t) * 8, "Should fit in a uint32_t.");
    254     static_assert(!(specialFastPathBit & ~clearLhsObservedTypeBitMask), "These bits should not intersect.");
    255     static_assert(specialFastPathBit & clearLhsObservedTypeBitMask, "These bits should intersect.");
    256     static_assert(specialFastPathBit > ~clearLhsObservedTypeBitMask, "These bits should not intersect and specialFastPathBit should be a higher bit.");
    257 
    258     BinaryArithProfile(ResultType lhs, ResultType rhs)
    259         : ArithProfile<uint32_t>((lhs.bits() << lhsResultTypeShift) | (rhs.bits() << rhsResultTypeShift))
    260     {
    261         ASSERT(lhsResultType().bits() == lhs.bits() && rhsResultType().bits() == rhs.bits());
    262         ASSERT(lhsObservedType().isEmpty());
    263         ASSERT(rhsObservedType().isEmpty());
    264     }
    265 
    266     BinaryArithProfile(OperandTypes types)
    267         : BinaryArithProfile(types.first(), types.second())
    268     { }
    269 
    270     BinaryArithProfile()
    271         : BinaryArithProfile(ResultType::unknownType(), ResultType::unknownType())
    272     {
    273     }
    274 
    275     static constexpr uint32_t observedIntIntBits()
    276     {
    277         constexpr ObservedType observedInt32 { ObservedType().withInt32() };
    278         constexpr uint32_t bits = (observedInt32.bits() << lhsObservedTypeShift) | (observedInt32.bits() << rhsObservedTypeShift);
    279         static_assert(bits == 0x900000, "");
    280         return bits;
    281     }
    282     static constexpr uint32_t observedNumberIntBits()
    283     {
    284         constexpr ObservedType observedNumber { ObservedType().withNumber() };
    285         constexpr ObservedType observedInt32 { ObservedType().withInt32() };
    286         constexpr uint32_t bits = (observedNumber.bits() << lhsObservedTypeShift) | (observedInt32.bits() << rhsObservedTypeShift);
    287         static_assert(bits == 0x1100000, "");
    288         return bits;
    289     }
    290     static constexpr uint32_t observedIntNumberBits()
    291     {
    292         constexpr ObservedType observedNumber { ObservedType().withNumber() };
    293         constexpr ObservedType observedInt32 { ObservedType().withInt32() };
    294         constexpr uint32_t bits = (observedInt32.bits() << lhsObservedTypeShift) | (observedNumber.bits() << rhsObservedTypeShift);
    295         static_assert(bits == 0xa00000, "");
    296         return bits;
    297     }
    298     static constexpr uint32_t observedNumberNumberBits()
    299     {
    300         constexpr ObservedType observedNumber { ObservedType().withNumber() };
    301         constexpr uint32_t bits = (observedNumber.bits() << lhsObservedTypeShift) | (observedNumber.bits() << rhsObservedTypeShift);
    302         static_assert(bits == 0x1200000, "");
    303         return bits;
    304     }
    305 
    306     ResultType lhsResultType() const { return ResultType((m_bits >> lhsResultTypeShift) & resultTypeMask); }
    307     ResultType rhsResultType() const { return ResultType((m_bits >> rhsResultTypeShift) & resultTypeMask); }
    308 
    309     constexpr ObservedType lhsObservedType() const { return ObservedType((m_bits >> lhsObservedTypeShift) & observedTypeMask); }
    310     constexpr ObservedType rhsObservedType() const { return ObservedType((m_bits >> rhsObservedTypeShift) & observedTypeMask); }
    311     void setLhsObservedType(ObservedType type)
    312     {
    313         uint32_t bits = m_bits;
    314         bits &= clearLhsObservedTypeBitMask;
    315         bits |= type.bits() << lhsObservedTypeShift;
    316         m_bits = bits;
    317         ASSERT(lhsObservedType() == type);
    318     }
    319 
    320     void setRhsObservedType(ObservedType type)
    321     {
    322         uint32_t bits = m_bits;
    323         bits &= clearRhsObservedTypeBitMask;
    324         bits |= type.bits() << rhsObservedTypeShift;
    325         m_bits = bits;
    326         ASSERT(rhsObservedType() == type);
    327     }
    328 
    329     bool tookSpecialFastPath() const { return m_bits & specialFastPathBit; }
    330 
    331232    void lhsSawInt32() { setLhsObservedType(lhsObservedType().withInt32()); }
    332233    void lhsSawNumber() { setLhsObservedType(lhsObservedType().withNumber()); }
     
    338239    void observeLHS(JSValue lhs)
    339240    {
    340         BinaryArithProfile newProfile = *this;
     241        ArithProfile newProfile = *this;
    341242        if (lhs.isNumber()) {
    342243            if (lhs.isInt32())
     
    354255        observeLHS(lhs);
    355256
    356         BinaryArithProfile newProfile = *this;
     257        ArithProfile newProfile = *this;
    357258        if (rhs.isNumber()) {
    358259            if (rhs.isInt32())
     
    366267    }
    367268
    368     bool isObservedTypeEmpty()
    369     {
    370         return lhsObservedType().isEmpty() && rhsObservedType().isEmpty();
    371     }
     269#if ENABLE(JIT)   
     270    // Sets (Int32Overflow | Int52Overflow | NonNegZeroDouble | NegZeroDouble) if it sees a
     271    // double. Sets NonNumeric if it sees a non-numeric.
     272    void emitObserveResult(CCallHelpers&, JSValueRegs, TagRegistersMode = HaveTagRegisters);
     273   
     274    // Sets (Int32Overflow | Int52Overflow | NonNegZeroDouble | NegZeroDouble).
     275    bool shouldEmitSetDouble() const;
     276    void emitSetDouble(CCallHelpers&) const;
     277   
     278    // Sets NonNumber.
     279    void emitSetNonNumeric(CCallHelpers&) const;
     280    bool shouldEmitSetNonNumeric() const;
     281
     282    // Sets BigInt
     283    void emitSetBigInt(CCallHelpers&) const;
     284    bool shouldEmitSetBigInt() const;
     285#endif // ENABLE(JIT)
     286
     287    constexpr uint32_t bits() const { return m_bits; }
     288
     289private:
     290    constexpr explicit ArithProfile(ConstantTag, uint32_t bits)
     291        : m_bits(bits)
     292    {
     293    }
     294
     295    constexpr ArithProfile(ConstantTag, ResultType arg)
     296        : m_bits(arg.bits() << lhsResultTypeShift)
     297    {
     298    }
     299
     300    constexpr ArithProfile(ConstantTag, ResultType lhs, ResultType rhs)
     301        : m_bits((lhs.bits() << lhsResultTypeShift) | (rhs.bits() << rhsResultTypeShift))
     302    {
     303    }
     304
     305    bool hasBits(int mask) const { return m_bits & mask; }
     306    void setBit(int mask) { m_bits |= mask; }
     307
     308    uint32_t m_bits { 0 }; // We take care to update m_bits only in a single operation. We don't ever store an inconsistent bit representation to it.
    372309
    373310    friend class JSC::LLIntOffsetsExtractor;
     
    378315namespace WTF {
    379316
    380 void printInternal(PrintStream&, const JSC::UnaryArithProfile&);
    381 void printInternal(PrintStream&, const JSC::BinaryArithProfile&);
     317void printInternal(PrintStream&, const JSC::ArithProfile&);
    382318void printInternal(PrintStream&, const JSC::ObservedType&);
    383319
  • trunk/Source/JavaScriptCore/bytecode/BytecodeList.rb

    r251090 r251106  
    4242    :JSValue,
    4343    :LLIntCallLinkInfo,
    44     :ResultType,
    4544    :OperandTypes,
    4645    :ProfileTypeBytecodeFlag,
     
    5958    :ValueProfile,
    6059    :ValueProfileAndOperandBuffer,
    61     :UnaryArithProfile,
    62     :BinaryArithProfile,
     60    :ArithProfile,
    6361    :ArrayProfile,
    6462    :ArrayAllocationProfile,
     
    285283    },
    286284    metadata: {
    287         arithProfile: BinaryArithProfile
     285        arithProfile: ArithProfile
    288286    },
    289287    metadata_initializers: {
     
    370368        dst: VirtualRegister,
    371369        operand: VirtualRegister,
    372         resultType: ResultType,
    373     },
    374     metadata: {
    375         arithProfile: UnaryArithProfile,
     370        operandTypes: OperandTypes,
     371    },
     372    metadata: {
     373        arithProfile: ArithProfile,
    376374    },
    377375    metadata_initializers: {
    378         arithProfile: :resultType
     376        arithProfile: :operandTypes
    379377    }
    380378
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r251090 r251106  
    14811481}
    14821482
    1483 JITAddIC* CodeBlock::addJITAddIC(BinaryArithProfile* arithProfile)
     1483JITAddIC* CodeBlock::addJITAddIC(ArithProfile* arithProfile)
    14841484{
    14851485    ConcurrentJSLocker locker(m_lock);
     
    14871487}
    14881488
    1489 JITMulIC* CodeBlock::addJITMulIC(BinaryArithProfile* arithProfile)
     1489JITMulIC* CodeBlock::addJITMulIC(ArithProfile* arithProfile)
    14901490{
    14911491    ConcurrentJSLocker locker(m_lock);
     
    14931493}
    14941494
    1495 JITSubIC* CodeBlock::addJITSubIC(BinaryArithProfile* arithProfile)
     1495JITSubIC* CodeBlock::addJITSubIC(ArithProfile* arithProfile)
    14961496{
    14971497    ConcurrentJSLocker locker(m_lock);
     
    14991499}
    15001500
    1501 JITNegIC* CodeBlock::addJITNegIC(UnaryArithProfile* arithProfile)
     1501JITNegIC* CodeBlock::addJITNegIC(ArithProfile* arithProfile)
    15021502{
    15031503    ConcurrentJSLocker locker(m_lock);
     
    30863086}
    30873087
    3088 BinaryArithProfile* CodeBlock::binaryArithProfileForBytecodeOffset(InstructionStream::Offset bytecodeOffset)
    3089 {
    3090     return binaryArithProfileForPC(instructions().at(bytecodeOffset).ptr());
    3091 }
    3092 
    3093 UnaryArithProfile* CodeBlock::unaryArithProfileForBytecodeOffset(InstructionStream::Offset bytecodeOffset)
    3094 {
    3095     return unaryArithProfileForPC(instructions().at(bytecodeOffset).ptr());
    3096 }
    3097 
    3098 BinaryArithProfile* CodeBlock::binaryArithProfileForPC(const Instruction* pc)
     3088ArithProfile* CodeBlock::arithProfileForBytecodeOffset(InstructionStream::Offset bytecodeOffset)
     3089{
     3090    return arithProfileForPC(instructions().at(bytecodeOffset).ptr());
     3091}
     3092
     3093ArithProfile* CodeBlock::arithProfileForPC(const Instruction* pc)
    30993094{
    31003095    switch (pc->opcodeID()) {
     3096    case op_negate:
     3097        return &pc->as<OpNegate>().metadata(this).m_arithProfile;
    31013098    case op_add:
    31023099        return &pc->as<OpAdd>().metadata(this).m_arithProfile;
     
    31143111}
    31153112
    3116 UnaryArithProfile* CodeBlock::unaryArithProfileForPC(const Instruction* pc)
    3117 {
    3118     switch (pc->opcodeID()) {
    3119     case op_negate:
    3120         return &pc->as<OpNegate>().metadata(this).m_arithProfile;
    3121     default:
    3122         break;
    3123     }
    3124 
    3125     return nullptr;
    3126 }
    3127 
    31283113bool CodeBlock::couldTakeSpecialFastCase(InstructionStream::Offset bytecodeOffset)
    31293114{
    31303115    if (!hasBaselineJITProfiling())
    31313116        return false;
    3132     BinaryArithProfile* profile = binaryArithProfileForBytecodeOffset(bytecodeOffset);
     3117    ArithProfile* profile = arithProfileForBytecodeOffset(bytecodeOffset);
    31333118    if (!profile)
    31343119        return false;
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.h

    r251090 r251106  
    8484#endif
    8585
    86 class UnaryArithProfile;
    87 class BinaryArithProfile;
    8886class BytecodeLivenessAnalysis;
    8987class CodeBlockSet;
     
    9997enum class AccessType : int8_t;
    10098
     99struct ArithProfile;
    101100struct OpCatch;
    102101
     
    281280    JITData& ensureJITDataSlow(const ConcurrentJSLocker&);
    282281
    283     JITAddIC* addJITAddIC(BinaryArithProfile*);
    284     JITMulIC* addJITMulIC(BinaryArithProfile*);
    285     JITNegIC* addJITNegIC(UnaryArithProfile*);
    286     JITSubIC* addJITSubIC(BinaryArithProfile*);
     282    JITAddIC* addJITAddIC(ArithProfile*);
     283    JITMulIC* addJITMulIC(ArithProfile*);
     284    JITNegIC* addJITNegIC(ArithProfile*);
     285    JITSubIC* addJITSubIC(ArithProfile*);
    287286
    288287    template <typename Generator, typename = typename std::enable_if<std::is_same<Generator, JITAddGenerator>::value>::type>
    289     JITAddIC* addMathIC(BinaryArithProfile* profile) { return addJITAddIC(profile); }
     288    JITAddIC* addMathIC(ArithProfile* profile) { return addJITAddIC(profile); }
    290289
    291290    template <typename Generator, typename = typename std::enable_if<std::is_same<Generator, JITMulGenerator>::value>::type>
    292     JITMulIC* addMathIC(BinaryArithProfile* profile) { return addJITMulIC(profile); }
     291    JITMulIC* addMathIC(ArithProfile* profile) { return addJITMulIC(profile); }
    293292
    294293    template <typename Generator, typename = typename std::enable_if<std::is_same<Generator, JITNegGenerator>::value>::type>
    295     JITNegIC* addMathIC(UnaryArithProfile* profile) { return addJITNegIC(profile); }
     294    JITNegIC* addMathIC(ArithProfile* profile) { return addJITNegIC(profile); }
    296295
    297296    template <typename Generator, typename = typename std::enable_if<std::is_same<Generator, JITSubGenerator>::value>::type>
    298     JITSubIC* addMathIC(BinaryArithProfile* profile) { return addJITSubIC(profile); }
     297    JITSubIC* addMathIC(ArithProfile* profile) { return addJITSubIC(profile); }
    299298
    300299    StructureStubInfo* addStubInfo(AccessType);
     
    494493    template<typename Functor> void forEachLLIntCallLinkInfo(const Functor&);
    495494
    496     BinaryArithProfile* binaryArithProfileForBytecodeOffset(InstructionStream::Offset bytecodeOffset);
    497     UnaryArithProfile* unaryArithProfileForBytecodeOffset(InstructionStream::Offset bytecodeOffset);
    498     BinaryArithProfile* binaryArithProfileForPC(const Instruction*);
    499     UnaryArithProfile* unaryArithProfileForPC(const Instruction*);
     495    ArithProfile* arithProfileForBytecodeOffset(InstructionStream::Offset bytecodeOffset);
     496    ArithProfile* arithProfileForPC(const Instruction*);
    500497
    501498    bool couldTakeSpecialFastCase(InstructionStream::Offset bytecodeOffset);
  • trunk/Source/JavaScriptCore/bytecode/Fits.h

    r251090 r251106  
    238238
    239239template<OpcodeSize size>
    240 struct Fits<ResultType, size, std::enable_if_t<sizeof(ResultType) != size, std::true_type>> {
    241     static_assert(sizeof(ResultType) == sizeof(uint8_t));
    242     using TargetType = typename TypeBySize<size>::unsignedType;
    243 
    244     static bool check(ResultType)
    245     {
    246         return true;
    247     }
    248 
    249     static TargetType convert(ResultType type)
    250     {
    251         return static_cast<TargetType>(type.bits());
    252     }
    253 
    254     static ResultType convert(TargetType type)
    255     {
    256         return ResultType(static_cast<uint8_t>(type));
    257     }
    258 };
    259 
    260 template<OpcodeSize size>
    261240struct Fits<OperandTypes, size, std::enable_if_t<sizeof(OperandTypes) != size, std::true_type>> {
    262241    static_assert(sizeof(OperandTypes) == sizeof(uint16_t));
  • trunk/Source/JavaScriptCore/bytecode/MethodOfGettingAValueProfile.cpp

    r251090 r251106  
    6767    }
    6868       
    69     case UnaryArithProfileReady: {
    70         u.unaryArithProfile->emitObserveResult(jit, regs, DoNotHaveTagRegisters);
     69    case ArithProfileReady: {
     70        u.arithProfile->emitObserveResult(jit, regs, DoNotHaveTagRegisters);
    7171        return;
    72     }
    73 
    74     case BinaryArithProfileReady: {
    75         u.binaryArithProfile->emitObserveResult(jit, regs, DoNotHaveTagRegisters);
    76         return;
    77     }
    78     }
     72    } }
    7973   
    8074    RELEASE_ASSERT_NOT_REACHED();
     
    10195    }
    10296
    103     case UnaryArithProfileReady: {
    104         u.unaryArithProfile->observeResult(value);
     97    case ArithProfileReady: {
     98        u.arithProfile->observeResult(value);
    10599        return;
    106     }
    107 
    108     case BinaryArithProfileReady: {
    109         u.binaryArithProfile->observeResult(value);
    110         return;
    111     }
    112     }
     100    } }
    113101
    114102    RELEASE_ASSERT_NOT_REACHED();
  • trunk/Source/JavaScriptCore/bytecode/MethodOfGettingAValueProfile.h

    r251090 r251106  
    3636namespace JSC {
    3737
    38 class UnaryArithProfile;
    39 class BinaryArithProfile;
    4038class CCallHelpers;
    4139class CodeBlock;
    4240class LazyOperandValueProfileKey;
     41struct ArithProfile;
    4342struct ValueProfile;
    4443
     
    5857            m_kind = None;
    5958    }
    60 
    61     MethodOfGettingAValueProfile(UnaryArithProfile* profile)
     59   
     60    MethodOfGettingAValueProfile(ArithProfile* profile)
    6261    {
    6362        if (profile) {
    64             m_kind = UnaryArithProfileReady;
    65             u.unaryArithProfile = profile;
    66         } else
    67             m_kind = None;
    68     }
    69 
    70     MethodOfGettingAValueProfile(BinaryArithProfile* profile)
    71     {
    72         if (profile) {
    73             m_kind = BinaryArithProfileReady;
    74             u.binaryArithProfile = profile;
     63            m_kind = ArithProfileReady;
     64            u.arithProfile = profile;
    7565        } else
    7666            m_kind = None;
     
    8979        None,
    9080        Ready,
    91         UnaryArithProfileReady,
    92         BinaryArithProfileReady,
     81        ArithProfileReady,
    9382        LazyOperand
    9483    };
     
    9786    union {
    9887        ValueProfile* profile;
    99         UnaryArithProfile* unaryArithProfile;
    100         BinaryArithProfile* binaryArithProfile;
     88        ArithProfile* arithProfile;
    10189        struct {
    10290            CodeBlock* codeBlock;
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r251090 r251106  
    16661666}
    16671667
    1668 RegisterID* BytecodeGenerator::emitUnaryOp(OpcodeID opcodeID, RegisterID* dst, RegisterID* src, ResultType type)
     1668RegisterID* BytecodeGenerator::emitUnaryOp(OpcodeID opcodeID, RegisterID* dst, RegisterID* src, OperandTypes types)
    16691669{
    16701670    switch (opcodeID) {
     
    16731673        break;
    16741674    case op_negate:
    1675         OpNegate::emit(this, dst, src, type);
     1675        OpNegate::emit(this, dst, src, types);
    16761676        break;
    16771677    case op_bitnot:
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h

    r251090 r251106  
    683683        }
    684684
    685         RegisterID* emitUnaryOp(OpcodeID, RegisterID* dst, RegisterID* src, ResultType);
     685        RegisterID* emitUnaryOp(OpcodeID, RegisterID* dst, RegisterID* src, OperandTypes);
    686686
    687687        template<typename BinaryOp>
  • trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp

    r251090 r251106  
    21372137    RefPtr<RegisterID> src = generator.emitNode(m_expr);
    21382138    generator.emitExpressionInfo(position(), position(), position());
    2139     return generator.emitUnaryOp(opcodeID(), generator.finalDestination(dst), src.get(), m_expr->resultDescriptor());
     2139    return generator.emitUnaryOp(opcodeID(), generator.finalDestination(dst), src.get(), OperandTypes(m_expr->resultDescriptor()));
    21402140}
    21412141
  • trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

    r251090 r251106  
    943943            return node;
    944944
    945         switch (node->op()) {
    946         case ArithAdd:
    947         case ArithSub:
    948         case ValueAdd: {
    949             BinaryArithProfile* arithProfile = m_inlineStackTop->m_profiledBlock->binaryArithProfileForBytecodeOffset(m_currentIndex);
    950             if (!arithProfile)
    951                 break;
    952             if (arithProfile->didObserveDouble())
    953                 node->mergeFlags(NodeMayHaveDoubleResult);
    954             if (arithProfile->didObserveNonNumeric())
    955                 node->mergeFlags(NodeMayHaveNonNumericResult);
    956             if (arithProfile->didObserveBigInt())
    957                 node->mergeFlags(NodeMayHaveBigIntResult);
    958             break;
    959         }
    960         case ValueMul:
    961         case ArithMul: {
    962             BinaryArithProfile* arithProfile = m_inlineStackTop->m_profiledBlock->binaryArithProfileForBytecodeOffset(m_currentIndex);
    963             if (!arithProfile)
    964                 break;
    965             if (arithProfile->didObserveInt52Overflow())
    966                 node->mergeFlags(NodeMayOverflowInt52);
    967             if (arithProfile->didObserveInt32Overflow() || m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, Overflow))
    968                 node->mergeFlags(NodeMayOverflowInt32InBaseline);
    969             if (arithProfile->didObserveNegZeroDouble() || m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, NegativeZero))
    970                 node->mergeFlags(NodeMayNegZeroInBaseline);
    971             if (arithProfile->didObserveDouble())
    972                 node->mergeFlags(NodeMayHaveDoubleResult);
    973             if (arithProfile->didObserveNonNumeric())
    974                 node->mergeFlags(NodeMayHaveNonNumericResult);
    975             if (arithProfile->didObserveBigInt())
    976                 node->mergeFlags(NodeMayHaveBigIntResult);
    977             break;
    978         }
    979         case ValueNegate:
    980         case ArithNegate: {
    981             UnaryArithProfile* arithProfile = m_inlineStackTop->m_profiledBlock->unaryArithProfileForBytecodeOffset(m_currentIndex);
    982             if (!arithProfile)
    983                 break;
    984             if (arithProfile->argObservedType().sawNumber() || arithProfile->didObserveDouble())
    985                 node->mergeFlags(NodeMayHaveDoubleResult);
    986             if (arithProfile->didObserveNegZeroDouble() || m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, NegativeZero))
    987                 node->mergeFlags(NodeMayNegZeroInBaseline);
    988             if (arithProfile->didObserveInt32Overflow() || m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, Overflow))
    989                 node->mergeFlags(NodeMayOverflowInt32InBaseline);
    990             if (arithProfile->didObserveNonNumeric())
    991                 node->mergeFlags(NodeMayHaveNonNumericResult);
    992             if (arithProfile->didObserveBigInt())
    993                 node->mergeFlags(NodeMayHaveBigIntResult);
    994             break;
    995         }
    996 
    997         default:
    998             break;
     945        {
     946            ArithProfile* arithProfile = m_inlineStackTop->m_profiledBlock->arithProfileForBytecodeOffset(m_currentIndex);
     947            if (arithProfile) {
     948                switch (node->op()) {
     949                case ArithAdd:
     950                case ArithSub:
     951                case ValueAdd:
     952                    if (arithProfile->didObserveDouble())
     953                        node->mergeFlags(NodeMayHaveDoubleResult);
     954                    if (arithProfile->didObserveNonNumeric())
     955                        node->mergeFlags(NodeMayHaveNonNumericResult);
     956                    if (arithProfile->didObserveBigInt())
     957                        node->mergeFlags(NodeMayHaveBigIntResult);
     958                    break;
     959               
     960                case ValueMul:
     961                case ArithMul: {
     962                    if (arithProfile->didObserveInt52Overflow())
     963                        node->mergeFlags(NodeMayOverflowInt52);
     964                    if (arithProfile->didObserveInt32Overflow() || m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, Overflow))
     965                        node->mergeFlags(NodeMayOverflowInt32InBaseline);
     966                    if (arithProfile->didObserveNegZeroDouble() || m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, NegativeZero))
     967                        node->mergeFlags(NodeMayNegZeroInBaseline);
     968                    if (arithProfile->didObserveDouble())
     969                        node->mergeFlags(NodeMayHaveDoubleResult);
     970                    if (arithProfile->didObserveNonNumeric())
     971                        node->mergeFlags(NodeMayHaveNonNumericResult);
     972                    if (arithProfile->didObserveBigInt())
     973                        node->mergeFlags(NodeMayHaveBigIntResult);
     974                    break;
     975                }
     976                case ValueNegate:
     977                case ArithNegate: {
     978                    if (arithProfile->lhsObservedType().sawNumber() || arithProfile->didObserveDouble())
     979                        node->mergeFlags(NodeMayHaveDoubleResult);
     980                    if (arithProfile->didObserveNegZeroDouble() || m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, NegativeZero))
     981                        node->mergeFlags(NodeMayNegZeroInBaseline);
     982                    if (arithProfile->didObserveInt32Overflow() || m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, Overflow))
     983                        node->mergeFlags(NodeMayOverflowInt32InBaseline);
     984                    if (arithProfile->didObserveNonNumeric())
     985                        node->mergeFlags(NodeMayHaveNonNumericResult);
     986                    if (arithProfile->didObserveBigInt())
     987                        node->mergeFlags(NodeMayHaveBigIntResult);
     988                    break;
     989                }
     990               
     991                default:
     992                    break;
     993                }
     994            }
    999995        }
    1000996       
     
    10391035        node->mergeFlags(NodeMayOverflowInt32InBaseline | NodeMayNegZeroInBaseline);
    10401036       
    1041         BinaryArithProfile* arithProfile = m_inlineStackTop->m_profiledBlock->binaryArithProfileForBytecodeOffset(m_currentIndex);
     1037        ArithProfile* arithProfile = m_inlineStackTop->m_profiledBlock->arithProfileForBytecodeOffset(m_currentIndex);
    10421038        if (arithProfile->didObserveBigInt())
    10431039            node->mergeFlags(NodeMayHaveBigIntResult);
  • trunk/Source/JavaScriptCore/dfg/DFGGraph.cpp

    r251090 r251106  
    16531653
    16541654            if (profiledBlock->hasBaselineJITProfiling()) {
    1655                 if (BinaryArithProfile* result = profiledBlock->binaryArithProfileForBytecodeOffset(node->origin.semantic.bytecodeIndex()))
    1656                     return result;
    1657                 if (UnaryArithProfile* result = profiledBlock->unaryArithProfileForBytecodeOffset(node->origin.semantic.bytecodeIndex()))
     1655                if (ArithProfile* result = profiledBlock->arithProfileForBytecodeOffset(node->origin.semantic.bytecodeIndex()))
    16581656                    return result;
    16591657            }
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r251090 r251106  
    40014001    CodeBlock* baselineCodeBlock = m_jit.graph().baselineCodeBlockFor(node->origin.semantic);
    40024002    unsigned bytecodeIndex = node->origin.semantic.bytecodeIndex();
    4003     BinaryArithProfile* arithProfile = baselineCodeBlock->binaryArithProfileForBytecodeOffset(bytecodeIndex);
     4003    ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeOffset(bytecodeIndex);
    40044004    JITAddIC* addIC = m_jit.codeBlock()->addJITAddIC(arithProfile);
    40054005    auto repatchingFunction = operationValueAddOptimize;
     
    40254025        CodeBlock* baselineCodeBlock = m_jit.graph().baselineCodeBlockFor(node->origin.semantic);
    40264026        unsigned bytecodeIndex = node->origin.semantic.bytecodeIndex();
    4027         BinaryArithProfile* arithProfile = baselineCodeBlock->binaryArithProfileForBytecodeOffset(bytecodeIndex);
     4027        ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeOffset(bytecodeIndex);
    40284028        JITSubIC* subIC = m_jit.codeBlock()->addJITSubIC(arithProfile);
    40294029        auto repatchingFunction = operationValueSubOptimize;
     
    46194619    CodeBlock* baselineCodeBlock = m_jit.graph().baselineCodeBlockFor(node->origin.semantic);
    46204620    unsigned bytecodeIndex = node->origin.semantic.bytecodeIndex();
    4621     UnaryArithProfile* arithProfile = baselineCodeBlock->unaryArithProfileForBytecodeOffset(bytecodeIndex);
     4621    ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeOffset(bytecodeIndex);
    46224622    JITNegIC* negIC = m_jit.codeBlock()->addJITNegIC(arithProfile);
    46234623    auto repatchingFunction = operationArithNegateOptimize;
     
    48424842    CodeBlock* baselineCodeBlock = m_jit.graph().baselineCodeBlockFor(node->origin.semantic);
    48434843    unsigned bytecodeIndex = node->origin.semantic.bytecodeIndex();
    4844     BinaryArithProfile* arithProfile = baselineCodeBlock->binaryArithProfileForBytecodeOffset(bytecodeIndex);
     4844    ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeOffset(bytecodeIndex);
    48454845    JITMulIC* mulIC = m_jit.codeBlock()->addJITMulIC(arithProfile);
    48464846    auto repatchingFunction = operationValueMulOptimize;
  • trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

    r251090 r251106  
    21082108        CodeBlock* baselineCodeBlock = m_ftlState.graph.baselineCodeBlockFor(m_node->origin.semantic);
    21092109        unsigned bytecodeIndex = m_node->origin.semantic.bytecodeIndex();
    2110         BinaryArithProfile* arithProfile = baselineCodeBlock->binaryArithProfileForBytecodeOffset(bytecodeIndex);
     2110        ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeOffset(bytecodeIndex);
    21112111        auto repatchingFunction = operationValueAddOptimize;
    21122112        auto nonRepatchingFunction = operationValueAdd;
     
    21272127        CodeBlock* baselineCodeBlock = m_ftlState.graph.baselineCodeBlockFor(m_node->origin.semantic);
    21282128        unsigned bytecodeIndex = m_node->origin.semantic.bytecodeIndex();
    2129         BinaryArithProfile* arithProfile = baselineCodeBlock->binaryArithProfileForBytecodeOffset(bytecodeIndex);
     2129        ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeOffset(bytecodeIndex);
    21302130        auto repatchingFunction = operationValueSubOptimize;
    21312131        auto nonRepatchingFunction = operationValueSub;
     
    21462146        CodeBlock* baselineCodeBlock = m_ftlState.graph.baselineCodeBlockFor(m_node->origin.semantic);
    21472147        unsigned bytecodeIndex = m_node->origin.semantic.bytecodeIndex();
    2148         BinaryArithProfile* arithProfile = baselineCodeBlock->binaryArithProfileForBytecodeOffset(bytecodeIndex);
     2148        ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeOffset(bytecodeIndex);
    21492149        auto repatchingFunction = operationValueMulOptimize;
    21502150        auto nonRepatchingFunction = operationValueMul;
     
    21542154    template <typename Generator, typename Func1, typename Func2,
    21552155        typename = std::enable_if_t<std::is_function<typename std::remove_pointer<Func1>::type>::value && std::is_function<typename std::remove_pointer<Func2>::type>::value>>
    2156     void compileUnaryMathIC(UnaryArithProfile* arithProfile, Func1 repatchingFunction, Func2 nonRepatchingFunction)
     2156    void compileUnaryMathIC(ArithProfile* arithProfile, Func1 repatchingFunction, Func2 nonRepatchingFunction)
    21572157    {
    21582158        Node* node = m_node;
     
    22402240    template <typename Generator, typename Func1, typename Func2,
    22412241        typename = std::enable_if_t<std::is_function<typename std::remove_pointer<Func1>::type>::value && std::is_function<typename std::remove_pointer<Func2>::type>::value>>
    2242     void compileBinaryMathIC(BinaryArithProfile* arithProfile, Func1 repatchingFunction, Func2 nonRepatchingFunction)
     2242    void compileBinaryMathIC(ArithProfile* arithProfile, Func1 repatchingFunction, Func2 nonRepatchingFunction)
    22432243    {
    22442244        Node* node = m_node;
     
    24072407            CodeBlock* baselineCodeBlock = m_ftlState.graph.baselineCodeBlockFor(m_node->origin.semantic);
    24082408            unsigned bytecodeIndex = m_node->origin.semantic.bytecodeIndex();
    2409             BinaryArithProfile* arithProfile = baselineCodeBlock->binaryArithProfileForBytecodeOffset(bytecodeIndex);
     2409            ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeOffset(bytecodeIndex);
    24102410            auto repatchingFunction = operationValueSubOptimize;
    24112411            auto nonRepatchingFunction = operationValueSub;
     
    30733073        CodeBlock* baselineCodeBlock = m_ftlState.graph.baselineCodeBlockFor(m_node->origin.semantic);
    30743074        unsigned bytecodeIndex = m_node->origin.semantic.bytecodeIndex();
    3075         UnaryArithProfile* arithProfile = baselineCodeBlock->unaryArithProfileForBytecodeOffset(bytecodeIndex);
     3075        ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeOffset(bytecodeIndex);
    30763076        auto repatchingFunction = operationArithNegateOptimize;
    30773077        auto nonRepatchingFunction = operationArithNegate;
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r251090 r251106  
    920920        GetPutInfo copiedGetPutInfo(OpPutToScope);
    921921        template<typename BinaryOp>
    922         BinaryArithProfile copiedArithProfile(BinaryOp);
     922        ArithProfile copiedArithProfile(BinaryOp);
    923923
    924924        Interpreter* m_interpreter;
     
    940940
    941941        HashMap<unsigned, unsigned> m_copiedGetPutInfos;
    942         HashMap<uint64_t, BinaryArithProfile> m_copiedArithProfiles;
     942        HashMap<uint64_t, ArithProfile> m_copiedArithProfiles;
    943943
    944944        JumpList m_exceptionChecks;
  • trunk/Source/JavaScriptCore/jit/JITAddGenerator.cpp

    r251090 r251106  
    3535namespace JSC {
    3636
    37 JITMathICInlineResult JITAddGenerator::generateInline(CCallHelpers& jit, MathICGenerationState& state, const BinaryArithProfile* arithProfile)
     37JITMathICInlineResult JITAddGenerator::generateInline(CCallHelpers& jit, MathICGenerationState& state, const ArithProfile* arithProfile)
    3838{
    3939    // We default to speculating int32.
     
    7474}
    7575
    76 bool JITAddGenerator::generateFastPath(CCallHelpers& jit, CCallHelpers::JumpList& endJumpList, CCallHelpers::JumpList& slowPathJumpList, const BinaryArithProfile* arithProfile, bool shouldEmitProfiling)
     76bool JITAddGenerator::generateFastPath(CCallHelpers& jit, CCallHelpers::JumpList& endJumpList, CCallHelpers::JumpList& slowPathJumpList, const ArithProfile* arithProfile, bool shouldEmitProfiling)
    7777{
    7878    ASSERT(m_scratchGPR != InvalidGPRReg);
  • trunk/Source/JavaScriptCore/jit/JITAddGenerator.h

    r251090 r251106  
    5656    }
    5757
    58     JITMathICInlineResult generateInline(CCallHelpers&, MathICGenerationState&, const BinaryArithProfile*);
    59     bool generateFastPath(CCallHelpers&, CCallHelpers::JumpList& endJumpList, CCallHelpers::JumpList& slowPathJumpList, const BinaryArithProfile*, bool shouldEmitProfiling);
     58    JITMathICInlineResult generateInline(CCallHelpers&, MathICGenerationState&, const ArithProfile*);
     59    bool generateFastPath(CCallHelpers&, CCallHelpers::JumpList& endJumpList, CCallHelpers::JumpList& slowPathJumpList, const ArithProfile*, bool shouldEmitProfiling);
    6060
    6161    static bool isLeftOperandValidConstant(SnippetOperand leftOperand) { return leftOperand.isPositiveConstInt32(); }
  • trunk/Source/JavaScriptCore/jit/JITArithmetic.cpp

    r251090 r251106  
    453453void JIT::emit_op_negate(const Instruction* currentInstruction)
    454454{
    455     UnaryArithProfile* arithProfile = &currentInstruction->as<OpNegate>().metadata(m_codeBlock).m_arithProfile;
     455    ArithProfile* arithProfile = &currentInstruction->as<OpNegate>().metadata(m_codeBlock).m_arithProfile;
    456456    JITNegIC* negateIC = m_codeBlock->addJITNegIC(arithProfile);
    457457    m_instructionToMathIC.add(currentInstruction, negateIC);
     
    634634}
    635635
     636ALWAYS_INLINE static OperandTypes getOperandTypes(const ArithProfile& arithProfile)
     637{
     638    return OperandTypes(arithProfile.lhsResultType(), arithProfile.rhsResultType());
     639}
     640
    636641void JIT::emit_op_add(const Instruction* currentInstruction)
    637642{
    638     BinaryArithProfile* arithProfile = &currentInstruction->as<OpAdd>().metadata(m_codeBlock).m_arithProfile;
     643    ArithProfile* arithProfile = &currentInstruction->as<OpAdd>().metadata(m_codeBlock).m_arithProfile;
    639644    JITAddIC* addIC = m_codeBlock->addJITAddIC(arithProfile);
    640645    m_instructionToMathIC.add(currentInstruction, addIC);
     
    681686    bool generatedInlineCode = mathIC->generateInline(*this, mathICGenerationState);
    682687    if (!generatedInlineCode) {
    683         UnaryArithProfile* arithProfile = mathIC->arithProfile();
     688        ArithProfile* arithProfile = mathIC->arithProfile();
    684689        if (arithProfile && shouldEmitProfiling())
    685690            callOperationWithResult(profiledFunction, resultRegs, srcRegs, arithProfile);
     
    704709{
    705710    auto bytecode = currentInstruction->as<Op>();
    706     BinaryArithProfile arithProfile = copiedArithProfile(bytecode);
     711    OperandTypes types = getOperandTypes(copiedArithProfile(bytecode));
    707712    int result = bytecode.m_dst.offset();
    708713    int op1 = bytecode.m_lhs.offset();
     
    723728#endif
    724729
    725     SnippetOperand leftOperand(arithProfile.lhsResultType());
    726     SnippetOperand rightOperand(arithProfile.rhsResultType());
     730    SnippetOperand leftOperand(types.first());
     731    SnippetOperand rightOperand(types.second());
    727732
    728733    if (isOperandConstantInt(op1))
     
    754759        else if (rightOperand.isConst())
    755760            emitGetVirtualRegister(op2, rightRegs);
    756         BinaryArithProfile* arithProfile = mathIC->arithProfile();
     761        ArithProfile* arithProfile = mathIC->arithProfile();
    757762        if (arithProfile && shouldEmitProfiling())
    758763            callOperationWithResult(profiledFunction, resultRegs, leftRegs, rightRegs, arithProfile);
     
    794799#endif
    795800
    796     UnaryArithProfile* arithProfile = mathIC->arithProfile();
     801    ArithProfile* arithProfile = mathIC->arithProfile();
    797802    if (arithProfile && shouldEmitProfiling()) {
    798803        if (mathICGenerationState.shouldSlowPathRepatch)
     
    826831
    827832    auto bytecode = currentInstruction->as<Op>();
    828     BinaryArithProfile consistentArithProfile = copiedArithProfile(bytecode);
     833    OperandTypes types = getOperandTypes(copiedArithProfile(bytecode));
    829834    int result = bytecode.m_dst.offset();
    830835    int op1 = bytecode.m_lhs.offset();
     
    841846#endif
    842847   
    843     SnippetOperand leftOperand(consistentArithProfile.lhsResultType());
    844     SnippetOperand rightOperand(consistentArithProfile.rhsResultType());
     848    SnippetOperand leftOperand(types.first());
     849    SnippetOperand rightOperand(types.second());
    845850
    846851    if (isOperandConstantInt(op1))
     
    860865#endif
    861866
    862     BinaryArithProfile* arithProfile = mathIC->arithProfile();
     867    ArithProfile* arithProfile = mathIC->arithProfile();
    863868    if (arithProfile && shouldEmitProfiling()) {
    864869        if (mathICGenerationState.shouldSlowPathRepatch)
     
    888893{
    889894    auto bytecode = currentInstruction->as<OpDiv>();
    890     BinaryArithProfile consistentArithProfile = copiedArithProfile(bytecode);
     895    auto& metadata = bytecode.metadata(m_codeBlock);
    891896    int result = bytecode.m_dst.offset();
    892897    int op1 = bytecode.m_lhs.offset();
     
    894899
    895900#if USE(JSVALUE64)
     901    OperandTypes types = getOperandTypes(metadata.m_arithProfile);
    896902    JSValueRegs leftRegs = JSValueRegs(regT0);
    897903    JSValueRegs rightRegs = JSValueRegs(regT1);
     
    899905    GPRReg scratchGPR = regT2;
    900906#else
     907    OperandTypes types = getOperandTypes(metadata.m_arithProfile);
    901908    JSValueRegs leftRegs = JSValueRegs(regT1, regT0);
    902909    JSValueRegs rightRegs = JSValueRegs(regT3, regT2);
     
    906913    FPRReg scratchFPR = fpRegT2;
    907914
    908     BinaryArithProfile* arithProfile = nullptr;
     915    ArithProfile* arithProfile = nullptr;
    909916    if (shouldEmitProfiling())
    910917        arithProfile = &currentInstruction->as<OpDiv>().metadata(m_codeBlock).m_arithProfile;
    911918
    912     SnippetOperand leftOperand(consistentArithProfile.lhsResultType());
    913     SnippetOperand rightOperand(consistentArithProfile.rhsResultType());
     919    SnippetOperand leftOperand(types.first());
     920    SnippetOperand rightOperand(types.second());
    914921
    915922    if (isOperandConstantInt(op1))
     
    953960void JIT::emit_op_mul(const Instruction* currentInstruction)
    954961{
    955     BinaryArithProfile* arithProfile = &currentInstruction->as<OpMul>().metadata(m_codeBlock).m_arithProfile;
     962    ArithProfile* arithProfile = &currentInstruction->as<OpMul>().metadata(m_codeBlock).m_arithProfile;
    956963    JITMulIC* mulIC = m_codeBlock->addJITMulIC(arithProfile);
    957964    m_instructionToMathIC.add(currentInstruction, mulIC);
     
    969976void JIT::emit_op_sub(const Instruction* currentInstruction)
    970977{
    971     BinaryArithProfile* arithProfile = &currentInstruction->as<OpSub>().metadata(m_codeBlock).m_arithProfile;
     978    ArithProfile* arithProfile = &currentInstruction->as<OpSub>().metadata(m_codeBlock).m_arithProfile;
    972979    JITSubIC* subIC = m_codeBlock->addJITSubIC(arithProfile);
    973980    m_instructionToMathIC.add(currentInstruction, subIC);
  • trunk/Source/JavaScriptCore/jit/JITDivGenerator.cpp

    r251090 r251106  
    131131#endif
    132132    if (m_arithProfile)
    133         jit.or32(CCallHelpers::TrustedImm32(BinaryArithProfile::specialFastPathBit), CCallHelpers::AbsoluteAddress(m_arithProfile->addressOfBits()));
     133        jit.or32(CCallHelpers::TrustedImm32(ArithProfile::specialFastPathBit), CCallHelpers::AbsoluteAddress(m_arithProfile->addressOfBits()));
    134134    jit.boxDouble(m_leftFPR, m_result);
    135135}
  • trunk/Source/JavaScriptCore/jit/JITDivGenerator.h

    r251090 r251106  
    3838        JSValueRegs result, JSValueRegs left, JSValueRegs right,
    3939        FPRReg leftFPR, FPRReg rightFPR, GPRReg scratchGPR, FPRReg scratchFPR,
    40         BinaryArithProfile* arithProfile = nullptr)
     40        ArithProfile* arithProfile = nullptr)
    4141        : m_leftOperand(leftOperand)
    4242        , m_rightOperand(rightOperand)
     
    7272    FPRReg m_scratchFPR;
    7373    bool m_didEmitFastPath { false };
    74     BinaryArithProfile* m_arithProfile;
     74    ArithProfile* m_arithProfile;
    7575
    7676    CCallHelpers::JumpList m_endJumpList;
  • trunk/Source/JavaScriptCore/jit/JITInlines.h

    r251090 r251106  
    718718
    719719template<typename BinaryOp>
    720 ALWAYS_INLINE BinaryArithProfile JIT::copiedArithProfile(BinaryOp bytecode)
     720ALWAYS_INLINE ArithProfile JIT::copiedArithProfile(BinaryOp bytecode)
    721721{
    722722    uint64_t key = (static_cast<uint64_t>(BinaryOp::opcodeID) + 1) << 32 | static_cast<uint64_t>(bytecode.m_metadataID);
     
    724724    if (iterator != m_copiedArithProfiles.end())
    725725        return iterator->value;
    726     BinaryArithProfile arithProfile = bytecode.metadata(m_codeBlock).m_arithProfile;
     726    ArithProfile arithProfile = bytecode.metadata(m_codeBlock).m_arithProfile;
    727727    m_copiedArithProfiles.add(key, arithProfile);
    728728    return arithProfile;
  • trunk/Source/JavaScriptCore/jit/JITMathIC.h

    r251090 r251106  
    5353#define ENABLE_MATH_IC_STATS 0
    5454
    55 template <typename GeneratorType, typename ArithProfileType>
     55template <typename GeneratorType, bool(*isProfileEmpty)(ArithProfile&)>
    5656class JITMathIC {
    5757    WTF_MAKE_FAST_ALLOCATED;
    5858public:
    59     JITMathIC(ArithProfileType* arithProfile)
     59    JITMathIC(ArithProfile* arithProfile)
    6060        : m_arithProfile(arithProfile)
    6161    {
     
    7272
    7373        if (m_arithProfile) {
    74             if (m_arithProfile->isObservedTypeEmpty()) {
     74            if (isProfileEmpty(*m_arithProfile)) {
    7575                // It looks like the MathIC has yet to execute. We don't want to emit code in this
    7676                // case for a couple reasons. First, the operation may never execute, so if we don't emit
     
    224224    }
    225225
    226     ArithProfileType* arithProfile() const { return m_arithProfile; }
     226    ArithProfile* arithProfile() const { return m_arithProfile; }
    227227
    228228#if ENABLE(MATH_IC_STATS)
     
    237237#endif
    238238
    239     ArithProfileType* m_arithProfile;
     239    ArithProfile* m_arithProfile;
    240240    MacroAssemblerCodeRef<JITStubRoutinePtrTag> m_code;
    241241    CodeLocationLabel<JSInternalPtrTag> m_inlineStart;
     
    247247};
    248248
    249 inline bool isBinaryProfileEmpty(BinaryArithProfile& arithProfile)
     249inline bool isBinaryProfileEmpty(ArithProfile& arithProfile)
    250250{
    251251    return arithProfile.lhsObservedType().isEmpty() || arithProfile.rhsObservedType().isEmpty();
    252252}
    253253template <typename GeneratorType>
    254 class JITBinaryMathIC : public JITMathIC<GeneratorType, BinaryArithProfile> {
     254class JITBinaryMathIC : public JITMathIC<GeneratorType, isBinaryProfileEmpty> {
    255255public:
    256     JITBinaryMathIC(BinaryArithProfile* arithProfile)
    257         : JITMathIC<GeneratorType, BinaryArithProfile>(arithProfile)
     256    JITBinaryMathIC(ArithProfile* arithProfile)
     257        : JITMathIC<GeneratorType, isBinaryProfileEmpty>(arithProfile)
    258258    {
    259259    }
     
    265265
    266266
    267 inline bool isUnaryProfileEmpty(BinaryArithProfile& arithProfile)
     267inline bool isUnaryProfileEmpty(ArithProfile& arithProfile)
    268268{
    269269    return arithProfile.lhsObservedType().isEmpty();
    270270}
    271271template <typename GeneratorType>
    272 class JITUnaryMathIC : public JITMathIC<GeneratorType, UnaryArithProfile> {
     272class JITUnaryMathIC : public JITMathIC<GeneratorType, isUnaryProfileEmpty> {
    273273public:
    274     JITUnaryMathIC(UnaryArithProfile* arithProfile)
    275         : JITMathIC<GeneratorType, UnaryArithProfile>(arithProfile)
     274    JITUnaryMathIC(ArithProfile* arithProfile)
     275        : JITMathIC<GeneratorType, isUnaryProfileEmpty>(arithProfile)
    276276    {
    277277    }
  • trunk/Source/JavaScriptCore/jit/JITMulGenerator.cpp

    r251090 r251106  
    3434namespace JSC {
    3535
    36 JITMathICInlineResult JITMulGenerator::generateInline(CCallHelpers& jit, MathICGenerationState& state, const BinaryArithProfile* arithProfile)
     36JITMathICInlineResult JITMulGenerator::generateInline(CCallHelpers& jit, MathICGenerationState& state, const ArithProfile* arithProfile)
    3737{
    3838    // We default to speculating int32.
     
    9090}
    9191
    92 bool JITMulGenerator::generateFastPath(CCallHelpers& jit, CCallHelpers::JumpList& endJumpList, CCallHelpers::JumpList& slowPathJumpList, const BinaryArithProfile* arithProfile, bool shouldEmitProfiling)
     92bool JITMulGenerator::generateFastPath(CCallHelpers& jit, CCallHelpers::JumpList& endJumpList, CCallHelpers::JumpList& slowPathJumpList, const ArithProfile* arithProfile, bool shouldEmitProfiling)
    9393{
    9494    ASSERT(m_scratchGPR != InvalidGPRReg);
     
    206206        CCallHelpers::Jump notNegativeZero = jit.branch64(CCallHelpers::NotEqual, m_result.payloadGPR(), CCallHelpers::TrustedImm64(negativeZeroBits));
    207207
    208         jit.or32(CCallHelpers::TrustedImm32(BinaryArithProfile::NegZeroDouble), CCallHelpers::AbsoluteAddress(arithProfile->addressOfBits()));
     208        jit.or32(CCallHelpers::TrustedImm32(ArithProfile::NegZeroDouble), CCallHelpers::AbsoluteAddress(arithProfile->addressOfBits()));
    209209        CCallHelpers::Jump done = jit.jump();
    210210
    211211        notNegativeZero.link(&jit);
    212         jit.or32(CCallHelpers::TrustedImm32(BinaryArithProfile::NonNegZeroDouble), CCallHelpers::AbsoluteAddress(arithProfile->addressOfBits()));
     212        jit.or32(CCallHelpers::TrustedImm32(ArithProfile::NonNegZeroDouble), CCallHelpers::AbsoluteAddress(arithProfile->addressOfBits()));
    213213
    214214        jit.move(m_result.payloadGPR(), m_scratchGPR);
     
    217217        CCallHelpers::Jump noInt52Overflow = jit.branch32(CCallHelpers::LessThanOrEqual, m_scratchGPR, CCallHelpers::TrustedImm32(0x431));
    218218
    219         jit.or32(CCallHelpers::TrustedImm32(BinaryArithProfile::Int52Overflow), CCallHelpers::AbsoluteAddress(arithProfile->addressOfBits()));
     219        jit.or32(CCallHelpers::TrustedImm32(ArithProfile::Int52Overflow), CCallHelpers::AbsoluteAddress(arithProfile->addressOfBits()));
    220220        noInt52Overflow.link(&jit);
    221221
     
    228228        notNegativeZero.append(jit.branch32(CCallHelpers::NotEqual, m_result.tagGPR(), CCallHelpers::TrustedImm32(negativeZeroBits >> 32)));
    229229
    230         jit.or32(CCallHelpers::TrustedImm32(BinaryArithProfile::NegZeroDouble), CCallHelpers::AbsoluteAddress(arithProfile->addressOfBits()));
     230        jit.or32(CCallHelpers::TrustedImm32(ArithProfile::NegZeroDouble), CCallHelpers::AbsoluteAddress(arithProfile->addressOfBits()));
    231231        CCallHelpers::Jump done = jit.jump();
    232232
    233233        notNegativeZero.link(&jit);
    234         jit.or32(CCallHelpers::TrustedImm32(BinaryArithProfile::NonNegZeroDouble), CCallHelpers::AbsoluteAddress(arithProfile->addressOfBits()));
     234        jit.or32(CCallHelpers::TrustedImm32(ArithProfile::NonNegZeroDouble), CCallHelpers::AbsoluteAddress(arithProfile->addressOfBits()));
    235235
    236236        jit.move(m_result.tagGPR(), m_scratchGPR);
     
    239239        CCallHelpers::Jump noInt52Overflow = jit.branch32(CCallHelpers::LessThanOrEqual, m_scratchGPR, CCallHelpers::TrustedImm32(0x431));
    240240       
    241         jit.or32(CCallHelpers::TrustedImm32(BinaryArithProfile::Int52Overflow), CCallHelpers::AbsoluteAddress(arithProfile->addressOfBits()));
     241        jit.or32(CCallHelpers::TrustedImm32(ArithProfile::Int52Overflow), CCallHelpers::AbsoluteAddress(arithProfile->addressOfBits()));
    242242
    243243        endJumpList.append(noInt52Overflow);
  • trunk/Source/JavaScriptCore/jit/JITMulGenerator.h

    r251090 r251106  
    5757    }
    5858
    59     JITMathICInlineResult generateInline(CCallHelpers&, MathICGenerationState&, const BinaryArithProfile*);
    60     bool generateFastPath(CCallHelpers&, CCallHelpers::JumpList& endJumpList, CCallHelpers::JumpList& slowJumpList, const BinaryArithProfile*, bool shouldEmitProfiling);
     59    JITMathICInlineResult generateInline(CCallHelpers&, MathICGenerationState&, const ArithProfile*);
     60    bool generateFastPath(CCallHelpers&, CCallHelpers::JumpList& endJumpList, CCallHelpers::JumpList& slowJumpList, const ArithProfile*, bool shouldEmitProfiling);
    6161
    6262    static bool isLeftOperandValidConstant(SnippetOperand leftOperand) { return leftOperand.isPositiveConstInt32(); }
  • trunk/Source/JavaScriptCore/jit/JITNegGenerator.cpp

    r251090 r251106  
    3333namespace JSC {
    3434
    35 JITMathICInlineResult JITNegGenerator::generateInline(CCallHelpers& jit, MathICGenerationState& state, const UnaryArithProfile* arithProfile)
     35JITMathICInlineResult JITNegGenerator::generateInline(CCallHelpers& jit, MathICGenerationState& state, const ArithProfile* arithProfile)
    3636{
    3737    ASSERT(m_scratchGPR != InvalidGPRReg);
     
    4646    ObservedType observedTypes = ObservedType().withInt32();
    4747    if (arithProfile)
    48         observedTypes = arithProfile->argObservedType();
     48        observedTypes = arithProfile->lhsObservedType();
    4949    ASSERT_WITH_MESSAGE(!observedTypes.isEmpty(), "We should not attempt to generate anything if we do not have a profile.");
    5050
     
    8383}
    8484
    85 bool JITNegGenerator::generateFastPath(CCallHelpers& jit, CCallHelpers::JumpList& endJumpList, CCallHelpers::JumpList& slowPathJumpList, const UnaryArithProfile* arithProfile, bool shouldEmitProfiling)
     85bool JITNegGenerator::generateFastPath(CCallHelpers& jit, CCallHelpers::JumpList& endJumpList, CCallHelpers::JumpList& slowPathJumpList, const ArithProfile* arithProfile, bool shouldEmitProfiling)
    8686{
    8787    ASSERT(m_scratchGPR != m_src.payloadGPR());
     
    118118    // The flags of ArithNegate are basic in DFG.
    119119    // We only need to know if we ever produced a number.
    120     if (shouldEmitProfiling && arithProfile && !arithProfile->argObservedType().sawNumber() && !arithProfile->didObserveDouble())
     120    if (shouldEmitProfiling && arithProfile && !arithProfile->lhsObservedType().sawNumber() && !arithProfile->didObserveDouble())
    121121        arithProfile->emitSetDouble(jit);
    122122    return true;
  • trunk/Source/JavaScriptCore/jit/JITNegGenerator.h

    r251090 r251106  
    4444    { }
    4545
    46     JITMathICInlineResult generateInline(CCallHelpers&, MathICGenerationState&, const UnaryArithProfile*);
    47     bool generateFastPath(CCallHelpers&, CCallHelpers::JumpList& endJumpList, CCallHelpers::JumpList& slowPathJumpList, const UnaryArithProfile*, bool shouldEmitProfiling);
     46    JITMathICInlineResult generateInline(CCallHelpers&, MathICGenerationState&, const ArithProfile*);
     47    bool generateFastPath(CCallHelpers&, CCallHelpers::JumpList& endJumpList, CCallHelpers::JumpList& slowPathJumpList, const ArithProfile*, bool shouldEmitProfiling);
    4848
    4949private:
  • trunk/Source/JavaScriptCore/jit/JITOperations.cpp

    r251090 r251106  
    25552555}
    25562556
    2557 ALWAYS_INLINE static EncodedJSValue profiledAdd(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, BinaryArithProfile& arithProfile)
     2557ALWAYS_INLINE static EncodedJSValue profiledAdd(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile& arithProfile)
    25582558{
    25592559    VM& vm = exec->vm();
     
    25752575}
    25762576
    2577 EncodedJSValue JIT_OPERATION operationValueAddProfiled(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, BinaryArithProfile* arithProfile)
     2577EncodedJSValue JIT_OPERATION operationValueAddProfiled(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile* arithProfile)
    25782578{
    25792579    ASSERT(arithProfile);
     
    25892589    JSValue op2 = JSValue::decode(encodedOp2);
    25902590
    2591     BinaryArithProfile* arithProfile = addIC->arithProfile();
     2591    ArithProfile* arithProfile = addIC->arithProfile();
    25922592    ASSERT(arithProfile);
    25932593    arithProfile->observeLHSAndRHS(op1, op2);
     
    26102610    NativeCallFrameTracer tracer(vm, exec);
    26112611
    2612     BinaryArithProfile* arithProfile = addIC->arithProfile();
     2612    ArithProfile* arithProfile = addIC->arithProfile();
    26132613    ASSERT(arithProfile);
    26142614    return profiledAdd(exec, encodedOp1, encodedOp2, *arithProfile);
     
    26242624
    26252625    auto nonOptimizeVariant = operationValueAddNoOptimize;
    2626     if (BinaryArithProfile* arithProfile = addIC->arithProfile())
     2626    if (ArithProfile* arithProfile = addIC->arithProfile())
    26272627        arithProfile->observeLHSAndRHS(op1, op2);
    26282628    addIC->generateOutOfLine(exec->codeBlock(), nonOptimizeVariant);
     
    26562656}
    26572657
    2658 ALWAYS_INLINE static EncodedJSValue profiledMul(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, BinaryArithProfile& arithProfile, bool shouldObserveLHSAndRHSTypes = true)
     2658ALWAYS_INLINE static EncodedJSValue profiledMul(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile& arithProfile, bool shouldObserveLHSAndRHSTypes = true)
    26592659{
    26602660    VM& vm = exec->vm();
     
    26942694
    26952695    auto nonOptimizeVariant = operationValueMulNoOptimize;
    2696     if (BinaryArithProfile* arithProfile = mulIC->arithProfile())
     2696    if (ArithProfile* arithProfile = mulIC->arithProfile())
    26972697        arithProfile->observeLHSAndRHS(JSValue::decode(encodedOp1), JSValue::decode(encodedOp2));
    26982698    mulIC->generateOutOfLine(exec->codeBlock(), nonOptimizeVariant);
     
    27052705}
    27062706
    2707 EncodedJSValue JIT_OPERATION operationValueMulProfiled(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, BinaryArithProfile* arithProfile)
     2707EncodedJSValue JIT_OPERATION operationValueMulProfiled(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile* arithProfile)
    27082708{
    27092709    VM& vm = exec->vm();
     
    27192719    NativeCallFrameTracer tracer(vm, exec);
    27202720
    2721     BinaryArithProfile* arithProfile = mulIC->arithProfile();
     2721    ArithProfile* arithProfile = mulIC->arithProfile();
    27222722    ASSERT(arithProfile);
    27232723    arithProfile->observeLHSAndRHS(JSValue::decode(encodedOp1), JSValue::decode(encodedOp2));
     
    27372737    NativeCallFrameTracer tracer(vm, exec);
    27382738
    2739     BinaryArithProfile* arithProfile = mulIC->arithProfile();
     2739    ArithProfile* arithProfile = mulIC->arithProfile();
    27402740    ASSERT(arithProfile);
    27412741    return profiledMul(exec, encodedOp1, encodedOp2, *arithProfile);
     
    27612761}
    27622762
    2763 ALWAYS_INLINE static EncodedJSValue profiledNegate(ExecState* exec, EncodedJSValue encodedOperand, UnaryArithProfile& arithProfile)
     2763ALWAYS_INLINE static EncodedJSValue profiledNegate(ExecState* exec, EncodedJSValue encodedOperand, ArithProfile& arithProfile)
    27642764{
    27652765    VM& vm = exec->vm();
     
    27682768
    27692769    JSValue operand = JSValue::decode(encodedOperand);
    2770     arithProfile.observeArg(operand);
     2770    arithProfile.observeLHS(operand);
    27712771   
    27722772    JSValue primValue = operand.toPrimitive(exec);
     
    27922792}
    27932793
    2794 EncodedJSValue JIT_OPERATION operationArithNegateProfiled(ExecState* exec, EncodedJSValue operand, UnaryArithProfile* arithProfile)
     2794EncodedJSValue JIT_OPERATION operationArithNegateProfiled(ExecState* exec, EncodedJSValue operand, ArithProfile* arithProfile)
    27952795{
    27962796    ASSERT(arithProfile);
     
    28062806    JSValue operand = JSValue::decode(encodedOperand);
    28072807
    2808     UnaryArithProfile* arithProfile = negIC->arithProfile();
     2808    ArithProfile* arithProfile = negIC->arithProfile();
    28092809    ASSERT(arithProfile);
    2810     arithProfile->observeArg(operand);
     2810    arithProfile->observeLHS(operand);
    28112811    negIC->generateOutOfLine(exec->codeBlock(), operationArithNegateProfiled);
    28122812
     
    28392839    JSValue operand = JSValue::decode(encodedOperand);
    28402840
    2841     if (UnaryArithProfile* arithProfile = negIC->arithProfile())
    2842         arithProfile->observeArg(operand);
     2841    if (ArithProfile* arithProfile = negIC->arithProfile())
     2842        arithProfile->observeLHS(operand);
    28432843    negIC->generateOutOfLine(exec->codeBlock(), operationArithNegate);
    28442844
     
    28662866}
    28672867
    2868 ALWAYS_INLINE static EncodedJSValue profiledSub(VM& vm, ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, BinaryArithProfile& arithProfile, bool shouldObserveLHSAndRHSTypes = true)
     2868ALWAYS_INLINE static EncodedJSValue profiledSub(VM& vm, ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile& arithProfile, bool shouldObserveLHSAndRHSTypes = true)
    28692869{
    28702870    auto scope = DECLARE_THROW_SCOPE(vm);
     
    28892889}
    28902890
    2891 EncodedJSValue JIT_OPERATION operationValueSubProfiled(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, BinaryArithProfile* arithProfile)
     2891EncodedJSValue JIT_OPERATION operationValueSubProfiled(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile* arithProfile)
    28922892{
    28932893    ASSERT(arithProfile);
     
    29052905
    29062906    auto nonOptimizeVariant = operationValueSubNoOptimize;
    2907     if (BinaryArithProfile* arithProfile = subIC->arithProfile())
     2907    if (ArithProfile* arithProfile = subIC->arithProfile())
    29082908        arithProfile->observeLHSAndRHS(JSValue::decode(encodedOp1), JSValue::decode(encodedOp2));
    29092909    subIC->generateOutOfLine(exec->codeBlock(), nonOptimizeVariant);
     
    29292929    NativeCallFrameTracer tracer(vm, exec);
    29302930
    2931     BinaryArithProfile* arithProfile = subIC->arithProfile();
     2931    ArithProfile* arithProfile = subIC->arithProfile();
    29322932    ASSERT(arithProfile);
    29332933    arithProfile->observeLHSAndRHS(JSValue::decode(encodedOp1), JSValue::decode(encodedOp2));
     
    29472947    NativeCallFrameTracer tracer(vm, exec);
    29482948
    2949     BinaryArithProfile* arithProfile = subIC->arithProfile();
     2949    ArithProfile* arithProfile = subIC->arithProfile();
    29502950    ASSERT(arithProfile);
    29512951    return profiledSub(vm, exec, encodedOp1, encodedOp2, *arithProfile);
  • trunk/Source/JavaScriptCore/jit/JITOperations.h

    r251090 r251106  
    3939class ArrayAllocationProfile;
    4040class ArrayProfile;
    41 class UnaryArithProfile;
    42 class BinaryArithProfile;
    4341class Butterfly;
    4442class CallFrame;
     
    6765struct InlineCallFrame;
    6866struct Instruction;
     67struct ArithProfile;
    6968
    7069using ExecState = CallFrame;
     
    8180    Aap: ArrayAllocationProfile*
    8281    Ap: ArrayProfile*
    83     Arp: BinaryArithProfile*
     82    Arp: ArithProfile*
    8483    B: Butterfly*
    8584    By: ByValInfo*
     
    147146typedef EncodedJSValue (JIT_OPERATION *J_JITOperation_EJA)(ExecState*, EncodedJSValue, JSArray*);
    148147typedef EncodedJSValue (JIT_OPERATION *J_JITOperation_EAPZ)(ExecState*, JSArray*, void*, int32_t);
    149 typedef EncodedJSValue (JIT_OPERATION *J_JITOperation_EJArp)(ExecState*, EncodedJSValue, BinaryArithProfile*);
     148typedef EncodedJSValue (JIT_OPERATION *J_JITOperation_EJArp)(ExecState*, EncodedJSValue, ArithProfile*);
    150149typedef EncodedJSValue (JIT_OPERATION *J_JITOperation_EJI)(ExecState*, EncodedJSValue, UniquedStringImpl*);
    151150typedef EncodedJSValue (JIT_OPERATION *J_JITOperation_EJJ)(ExecState*, EncodedJSValue, EncodedJSValue);
     
    153152typedef EncodedJSValue (JIT_OPERATION *J_JITOperation_EJJJJ)(ExecState*, EncodedJSValue, EncodedJSValue, EncodedJSValue, EncodedJSValue);
    154153typedef EncodedJSValue (JIT_OPERATION *J_JITOperation_EJJAp)(ExecState*, EncodedJSValue, EncodedJSValue, ArrayProfile*);
    155 typedef EncodedJSValue (JIT_OPERATION *J_JITOperation_EJJArp)(ExecState*, EncodedJSValue, EncodedJSValue, BinaryArithProfile*);
     154typedef EncodedJSValue (JIT_OPERATION *J_JITOperation_EJJArp)(ExecState*, EncodedJSValue, EncodedJSValue, ArithProfile*);
    156155typedef EncodedJSValue (JIT_OPERATION *J_JITOperation_EJJBy)(ExecState*, EncodedJSValue, EncodedJSValue, ByValInfo*);
    157156typedef EncodedJSValue (JIT_OPERATION *J_JITOperation_EJJMic)(ExecState*, EncodedJSValue, EncodedJSValue, void*);
     
    484483
    485484EncodedJSValue JIT_OPERATION operationValueAdd(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL;
    486 EncodedJSValue JIT_OPERATION operationValueAddProfiled(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, BinaryArithProfile*) WTF_INTERNAL;
     485EncodedJSValue JIT_OPERATION operationValueAddProfiled(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile*) WTF_INTERNAL;
    487486EncodedJSValue JIT_OPERATION operationValueAddProfiledOptimize(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITAddIC*) WTF_INTERNAL;
    488487EncodedJSValue JIT_OPERATION operationValueAddProfiledNoOptimize(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITAddIC*) WTF_INTERNAL;
     
    494493EncodedJSValue JIT_OPERATION operationValueMulProfiledOptimize(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITMulIC*) WTF_INTERNAL;
    495494EncodedJSValue JIT_OPERATION operationValueMulProfiledNoOptimize(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITMulIC*) WTF_INTERNAL;
    496 EncodedJSValue JIT_OPERATION operationValueMulProfiled(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, BinaryArithProfile*) WTF_INTERNAL;
     495EncodedJSValue JIT_OPERATION operationValueMulProfiled(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile*) WTF_INTERNAL;
    497496EncodedJSValue JIT_OPERATION operationArithNegate(ExecState*, EncodedJSValue operand);
    498 EncodedJSValue JIT_OPERATION operationArithNegateProfiled(ExecState*, EncodedJSValue operand, UnaryArithProfile*);
     497EncodedJSValue JIT_OPERATION operationArithNegateProfiled(ExecState*, EncodedJSValue operand, ArithProfile*);
    499498EncodedJSValue JIT_OPERATION operationArithNegateProfiledOptimize(ExecState*, EncodedJSValue encodedOperand, JITNegIC*);
    500499EncodedJSValue JIT_OPERATION operationArithNegateOptimize(ExecState*, EncodedJSValue encodedOperand, JITNegIC*);
    501500EncodedJSValue JIT_OPERATION operationValueSub(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL;
    502 EncodedJSValue JIT_OPERATION operationValueSubProfiled(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, BinaryArithProfile*) WTF_INTERNAL;
     501EncodedJSValue JIT_OPERATION operationValueSubProfiled(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile*) WTF_INTERNAL;
    503502EncodedJSValue JIT_OPERATION operationValueSubOptimize(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITSubIC*) WTF_INTERNAL;
    504503EncodedJSValue JIT_OPERATION operationValueSubNoOptimize(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITSubIC*) WTF_INTERNAL;
  • trunk/Source/JavaScriptCore/jit/JITSubGenerator.cpp

    r251090 r251106  
    3434namespace JSC {
    3535
    36 JITMathICInlineResult JITSubGenerator::generateInline(CCallHelpers& jit, MathICGenerationState& state, const BinaryArithProfile* arithProfile)
     36JITMathICInlineResult JITSubGenerator::generateInline(CCallHelpers& jit, MathICGenerationState& state, const ArithProfile* arithProfile)
    3737{
    3838    // We default to speculating int32.
     
    7979}
    8080
    81 bool JITSubGenerator::generateFastPath(CCallHelpers& jit, CCallHelpers::JumpList& endJumpList, CCallHelpers::JumpList& slowPathJumpList, const BinaryArithProfile* arithProfile, bool shouldEmitProfiling)
     81bool JITSubGenerator::generateFastPath(CCallHelpers& jit, CCallHelpers::JumpList& endJumpList, CCallHelpers::JumpList& slowPathJumpList, const ArithProfile* arithProfile, bool shouldEmitProfiling)
    8282{
    8383    ASSERT(m_scratchGPR != InvalidGPRReg);
  • trunk/Source/JavaScriptCore/jit/JITSubGenerator.h

    r251090 r251106  
    5454    { }
    5555
    56     JITMathICInlineResult generateInline(CCallHelpers&, MathICGenerationState&, const BinaryArithProfile*);
    57     bool generateFastPath(CCallHelpers&, CCallHelpers::JumpList& endJumpList, CCallHelpers::JumpList& slowPathJumpList, const BinaryArithProfile*, bool shouldEmitProfiling);
     56    JITMathICInlineResult generateInline(CCallHelpers&, MathICGenerationState&, const ArithProfile*);
     57    bool generateFastPath(CCallHelpers&, CCallHelpers::JumpList& endJumpList, CCallHelpers::JumpList& slowPathJumpList, const ArithProfile*, bool shouldEmitProfiling);
    5858
    5959    static bool isLeftOperandValidConstant(SnippetOperand) { return false; }
  • trunk/Source/JavaScriptCore/llint/LLIntData.cpp

    r251090 r251106  
    136136
    137137    {
    138         UnaryArithProfile arithProfile;
    139         arithProfile.argSawInt32();
    140         ASSERT(arithProfile.bits() == UnaryArithProfile::observedIntBits());
    141         ASSERT(arithProfile.argObservedType().isOnlyInt32());
     138        ArithProfile arithProfile;
     139        arithProfile.lhsSawInt32();
     140        arithProfile.rhsSawInt32();
     141        ASSERT(arithProfile.bits() == ArithProfile::observedBinaryIntInt().bits());
     142        STATIC_ASSERT(ArithProfile::observedBinaryIntInt().lhsObservedType().isOnlyInt32());
     143        STATIC_ASSERT(ArithProfile::observedBinaryIntInt().rhsObservedType().isOnlyInt32());
    142144    }
    143145    {
    144         UnaryArithProfile arithProfile;
    145         arithProfile.argSawNumber();
    146         ASSERT(arithProfile.bits() == UnaryArithProfile::observedNumberBits());
    147         ASSERT(arithProfile.argObservedType().isOnlyNumber());
    148     }
    149 
    150     {
    151         BinaryArithProfile arithProfile;
    152         arithProfile.lhsSawInt32();
     146        ArithProfile arithProfile;
     147        arithProfile.lhsSawNumber();
    153148        arithProfile.rhsSawInt32();
    154         ASSERT(arithProfile.bits() == BinaryArithProfile::observedIntIntBits());
    155         ASSERT(arithProfile.lhsObservedType().isOnlyInt32());
    156         ASSERT(arithProfile.rhsObservedType().isOnlyInt32());
     149        ASSERT(arithProfile.bits() == ArithProfile::observedBinaryNumberInt().bits());
     150        STATIC_ASSERT(ArithProfile::observedBinaryNumberInt().lhsObservedType().isOnlyNumber());
     151        STATIC_ASSERT(ArithProfile::observedBinaryNumberInt().rhsObservedType().isOnlyInt32());
    157152    }
    158153    {
    159         BinaryArithProfile arithProfile;
     154        ArithProfile arithProfile;
    160155        arithProfile.lhsSawNumber();
    161         arithProfile.rhsSawInt32();
    162         ASSERT(arithProfile.bits() == BinaryArithProfile::observedNumberIntBits());
    163         ASSERT(arithProfile.lhsObservedType().isOnlyNumber());
    164         ASSERT(arithProfile.rhsObservedType().isOnlyInt32());
     156        arithProfile.rhsSawNumber();
     157        ASSERT(arithProfile.bits() == ArithProfile::observedBinaryNumberNumber().bits());
     158        STATIC_ASSERT(ArithProfile::observedBinaryNumberNumber().lhsObservedType().isOnlyNumber());
     159        STATIC_ASSERT(ArithProfile::observedBinaryNumberNumber().rhsObservedType().isOnlyNumber());
    165160    }
    166161    {
    167         BinaryArithProfile arithProfile;
    168         arithProfile.lhsSawNumber();
    169         arithProfile.rhsSawNumber();
    170         ASSERT(arithProfile.bits() == BinaryArithProfile::observedNumberNumberBits());
    171         ASSERT(arithProfile.lhsObservedType().isOnlyNumber());
    172         ASSERT(arithProfile.rhsObservedType().isOnlyNumber());
    173     }
    174     {
    175         BinaryArithProfile arithProfile;
     162        ArithProfile arithProfile;
    176163        arithProfile.lhsSawInt32();
    177164        arithProfile.rhsSawNumber();
    178         ASSERT(arithProfile.bits() == BinaryArithProfile::observedIntNumberBits());
    179         ASSERT(arithProfile.lhsObservedType().isOnlyInt32());
    180         ASSERT(arithProfile.rhsObservedType().isOnlyNumber());
     165        ASSERT(arithProfile.bits() == ArithProfile::observedBinaryIntNumber().bits());
     166        STATIC_ASSERT(ArithProfile::observedBinaryIntNumber().lhsObservedType().isOnlyInt32());
     167        STATIC_ASSERT(ArithProfile::observedBinaryIntNumber().rhsObservedType().isOnlyNumber());
    181168    }
    182169}
  • trunk/Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp

    r251090 r251106  
    8787const int64_t* LLIntOffsetsExtractor::dummy()
    8888{
    89 // This is a file generated by offlineasm/generate_offset_extractor.rb, and contains code
     89// This is a file generated by offlineasm/generate_offsets_extractor.rb, and contains code
    9090// to create a table of offsets, sizes, and a header identifying what combination of
    9191// Platform.h macros we have set. We include it inside of a method on LLIntOffsetsExtractor
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm

    r251090 r251106  
    241241const ShadowChickenTailMarker = constexpr ShadowChicken::Packet::tailMarkerValue
    242242
    243 # UnaryArithProfile data
    244 const ArithProfileInt = constexpr (UnaryArithProfile::observedIntBits())
    245 const ArithProfileNumber = constexpr (UnaryArithProfile::observedNumberBits())
    246 
    247 # BinaryArithProfile data
    248 const ArithProfileIntInt = constexpr (BinaryArithProfile::observedIntIntBits())
    249 const ArithProfileNumberInt = constexpr (BinaryArithProfile::observedNumberIntBits())
    250 const ArithProfileIntNumber = constexpr (BinaryArithProfile::observedIntNumberBits())
    251 const ArithProfileNumberNumber = constexpr (BinaryArithProfile::observedNumberNumberBits())
     243# ArithProfile data
     244const ArithProfileInt = constexpr (ArithProfile::observedUnaryInt().bits())
     245const ArithProfileNumber = constexpr (ArithProfile::observedUnaryNumber().bits())
     246const ArithProfileIntInt = constexpr (ArithProfile::observedBinaryIntInt().bits())
     247const ArithProfileNumberInt = constexpr (ArithProfile::observedBinaryNumberInt().bits())
     248const ArithProfileIntNumber = constexpr (ArithProfile::observedBinaryIntNumber().bits())
     249const ArithProfileNumberNumber = constexpr (ArithProfile::observedBinaryNumberNumber().bits())
    252250
    253251# Pointer Tags
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm

    r251090 r251106  
    10051005
    10061006    macro arithProfile(type)
    1007         ori type, OpNegate::Metadata::m_arithProfile + BinaryArithProfile::m_bits[t5]
     1007        ori type, OpNegate::Metadata::m_arithProfile + ArithProfile::m_bits[t5]
    10081008    end
    10091009
     
    10311031    llintOpWithMetadata(op_%opcodeName%, opcodeStruct, macro (size, get, dispatch, metadata, return)
    10321032        macro arithProfile(type)
    1033             ori type, %opcodeStruct%::Metadata::m_arithProfile + BinaryArithProfile::m_bits[t5]
     1033            ori type, %opcodeStruct%::Metadata::m_arithProfile + ArithProfile::m_bits[t5]
    10341034        end
    10351035
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm

    r251090 r251106  
    977977    loadConstantOrVariable(size, t0, t3)
    978978    metadata(t1, t2)
    979     loadi OpNegate::Metadata::m_arithProfile + BinaryArithProfile::m_bits[t1], t2
     979    loadi OpNegate::Metadata::m_arithProfile + ArithProfile::m_bits[t1], t2
    980980    bqb t3, numberTag, .opNegateNotInt
    981981    btiz t3, 0x7fffffff, .opNegateSlow
     
    983983    orq numberTag, t3
    984984    ori ArithProfileInt, t2
    985     storei t2, OpNegate::Metadata::m_arithProfile + BinaryArithProfile::m_bits[t1]
     985    storei t2, OpNegate::Metadata::m_arithProfile + ArithProfile::m_bits[t1]
    986986    return(t3)
    987987.opNegateNotInt:
     
    989989    xorq 0x8000000000000000, t3
    990990    ori ArithProfileNumber, t2
    991     storei t2, OpNegate::Metadata::m_arithProfile + BinaryArithProfile::m_bits[t1]
     991    storei t2, OpNegate::Metadata::m_arithProfile + ArithProfile::m_bits[t1]
    992992    return(t3)
    993993
     
    10031003
    10041004        macro profile(type)
    1005             ori type, %opcodeStruct%::Metadata::m_arithProfile + BinaryArithProfile::m_bits[t5]
     1005            ori type, %opcodeStruct%::Metadata::m_arithProfile + ArithProfile::m_bits[t5]
    10061006        end
    10071007
  • trunk/Source/JavaScriptCore/parser/ResultType.h

    r251090 r251106  
    4949        static_assert((TypeBits & ((1 << numBitsNeeded) - 1)) == TypeBits, "This is necessary for correctness.");
    5050
    51         constexpr explicit ResultType()
    52             : ResultType(unknownType())
    53         {
    54         }
    5551        constexpr explicit ResultType(Type type)
    5652            : m_bits(type)
  • trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp

    r251090 r251106  
    488488static void updateArithProfileForUnaryArithOp(OpNegate::Metadata& metadata, JSValue result, JSValue operand)
    489489{
    490     UnaryArithProfile& profile = metadata.m_arithProfile;
    491     profile.observeArg(operand);
     490    ArithProfile& profile = metadata.m_arithProfile;
     491    profile.observeLHS(operand);
    492492    ASSERT(result.isNumber() || result.isBigInt());
    493493    if (result.isNumber()) {
     
    547547{
    548548    CodeBlock* codeBlock = exec->codeBlock();
    549     BinaryArithProfile& profile = *codeBlock->binaryArithProfileForPC(pc);
     549    ArithProfile& profile = *codeBlock->arithProfileForPC(pc);
    550550
    551551    if (result.isNumber()) {
     
    608608    JSValue v2 = GET_C(bytecode.m_rhs).jsValue();
    609609
    610     BinaryArithProfile& arithProfile = *exec->codeBlock()->binaryArithProfileForPC(pc);
     610    ArithProfile& arithProfile = *exec->codeBlock()->arithProfileForPC(pc);
    611611    arithProfile.observeLHSAndRHS(v1, v2);
    612612
Note: See TracChangeset for help on using the changeset viewer.