Changeset 252229 in webkit


Ignore:
Timestamp:
Nov 7, 2019 6:46:09 PM (4 years ago)
Author:
rmorisset@apple.com
Message:

Split ArithProfile into a Unary and a Binary version
https://bugs.webkit.org/show_bug.cgi?id=202832
<rdar://problem/56266847>

Reviewed by Keith Miller.

ArithProfile was for a long time only used for add/sub/mul/div, but recently it started being used for negate. And it will soon also have to be used for inc and dec due to BigInt.
So in this patch I make a separate version that only has the data for a single argument, and thus takes half as much memory.

After discussing this change with Phil I realized that the ResultType(s) that were taking space in ArithProfile are not needed: they never change and a copy is already in the bytecode instruction itself.
Removing them allowed shrinking both kinds of ArithProfile to fit in 16 bits (9 and 13 respectively).
I kept the two kinds separate because they may shrink or grow independently in the future.

This also required adding the "orh" instruction to the offline assembler, to set bits in the ArithProfile.
This in turn motivated the addition of "storeh", as on RISC platforms "orh" on a memory location is actually loadh -> orh -> storeh.

  • bytecode/ArithProfile.cpp:

(JSC::ArithProfile<BitfieldType>::emitObserveResult):
(JSC::ArithProfile<BitfieldType>::shouldEmitSetDouble const):
(JSC::ArithProfile<BitfieldType>::emitSetDouble const):
(JSC::ArithProfile<BitfieldType>::shouldEmitSetNonNumeric const):
(JSC::ArithProfile<BitfieldType>::shouldEmitSetBigInt const):
(JSC::ArithProfile<BitfieldType>::emitSetNonNumeric const):
(JSC::ArithProfile<BitfieldType>::emitSetBigInt const):
(WTF::printInternal):

  • bytecode/ArithProfile.h:

(JSC::ArithProfile::didObserveNonInt32 const):
(JSC::ArithProfile::didObserveDouble const):
(JSC::ArithProfile::didObserveNonNegZeroDouble const):
(JSC::ArithProfile::didObserveNegZeroDouble const):
(JSC::ArithProfile::didObserveNonNumeric const):
(JSC::ArithProfile::didObserveBigInt const):
(JSC::ArithProfile::didObserveInt32Overflow const):
(JSC::ArithProfile::didObserveInt52Overflow const):
(JSC::ArithProfile::setObservedNonNegZeroDouble):
(JSC::ArithProfile::setObservedNegZeroDouble):
(JSC::ArithProfile::setObservedNonNumeric):
(JSC::ArithProfile::setObservedBigInt):
(JSC::ArithProfile::setObservedInt32Overflow):
(JSC::ArithProfile::setObservedInt52Overflow):
(JSC::ArithProfile::observeResult):
(JSC::ArithProfile::addressOfBits const):
(JSC::ArithProfile::bits const):
(JSC::ArithProfile::ArithProfile):
(JSC::ArithProfile::hasBits const):
(JSC::ArithProfile::setBit):
(JSC::UnaryArithProfile::UnaryArithProfile):
(JSC::UnaryArithProfile::observedIntBits):
(JSC::UnaryArithProfile::observedNumberBits):
(JSC::UnaryArithProfile::argObservedType const):
(JSC::UnaryArithProfile::setArgObservedType):
(JSC::UnaryArithProfile::argSawInt32):
(JSC::UnaryArithProfile::argSawNumber):
(JSC::UnaryArithProfile::argSawNonNumber):
(JSC::UnaryArithProfile::observeArg):
(JSC::UnaryArithProfile::isObservedTypeEmpty):
(JSC::BinaryArithProfile::BinaryArithProfile):
(JSC::BinaryArithProfile::observedIntIntBits):
(JSC::BinaryArithProfile::observedNumberIntBits):
(JSC::BinaryArithProfile::observedIntNumberBits):
(JSC::BinaryArithProfile::observedNumberNumberBits):
(JSC::BinaryArithProfile::setLhsObservedType):
(JSC::BinaryArithProfile::setRhsObservedType):
(JSC::BinaryArithProfile::observeLHS):
(JSC::BinaryArithProfile::observeLHSAndRHS):
(JSC::BinaryArithProfile::isObservedTypeEmpty):

  • bytecode/BytecodeList.rb:
  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::addJITAddIC):
(JSC::CodeBlock::addJITMulIC):
(JSC::CodeBlock::addJITSubIC):
(JSC::CodeBlock::addJITNegIC):
(JSC::CodeBlock::binaryArithProfileForBytecodeOffset):
(JSC::CodeBlock::unaryArithProfileForBytecodeOffset):
(JSC::CodeBlock::binaryArithProfileForPC):
(JSC::CodeBlock::unaryArithProfileForPC):
(JSC::CodeBlock::couldTakeSpecialFastCase):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::addMathIC):

  • bytecode/Fits.h:
  • bytecode/MethodOfGettingAValueProfile.cpp:

(JSC::MethodOfGettingAValueProfile::emitReportValue const):
(JSC::MethodOfGettingAValueProfile::reportValue):

  • bytecode/MethodOfGettingAValueProfile.h:

(JSC::MethodOfGettingAValueProfile::MethodOfGettingAValueProfile):

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::emitUnaryOp):

  • bytecompiler/BytecodeGenerator.h:
  • bytecompiler/NodesCodegen.cpp:

(JSC::UnaryOpNode::emitBytecode):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::makeSafe):
(JSC::DFG::ByteCodeParser::makeDivSafe):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::methodOfGettingAValueProfileFor):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileValueAdd):
(JSC::DFG::SpeculativeJIT::compileValueSub):
(JSC::DFG::SpeculativeJIT::compileValueNegate):
(JSC::DFG::SpeculativeJIT::compileValueMul):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::compileValueAdd):
(JSC::FTL::DFG::LowerDFGToB3::compileValueSub):
(JSC::FTL::DFG::LowerDFGToB3::compileValueMul):
(JSC::FTL::DFG::LowerDFGToB3::compileUnaryMathIC):
(JSC::FTL::DFG::LowerDFGToB3::compileBinaryMathIC):
(JSC::FTL::DFG::LowerDFGToB3::compileArithAddOrSub):
(JSC::FTL::DFG::LowerDFGToB3::compileValueNegate):

  • jit/JIT.h:
  • jit/JITAddGenerator.cpp:

(JSC::JITAddGenerator::generateInline):
(JSC::JITAddGenerator::generateFastPath):

  • jit/JITAddGenerator.h:
  • jit/JITArithmetic.cpp:

(JSC::JIT::emit_op_negate):
(JSC::JIT::emit_op_add):
(JSC::JIT::emitMathICFast):
(JSC::JIT::emitMathICSlow):
(JSC::JIT::emit_op_div):
(JSC::JIT::emit_op_mul):
(JSC::JIT::emit_op_sub):

  • jit/JITDivGenerator.cpp:

(JSC::JITDivGenerator::generateFastPath):

  • jit/JITDivGenerator.h:

(JSC::JITDivGenerator::JITDivGenerator):

  • jit/JITInlines.h:

(JSC::JIT::copiedArithProfile):

  • jit/JITMathIC.h:

(JSC::JITMathIC::JITMathIC):
(JSC::JITMathIC::generateInline):
(JSC::JITMathIC::arithProfile const):
(JSC::isBinaryProfileEmpty):
(JSC::JITBinaryMathIC::JITBinaryMathIC):
(JSC::isUnaryProfileEmpty):
(JSC::JITUnaryMathIC::JITUnaryMathIC):

  • jit/JITMulGenerator.cpp:

(JSC::JITMulGenerator::generateInline):
(JSC::JITMulGenerator::generateFastPath):

  • jit/JITMulGenerator.h:
  • jit/JITNegGenerator.cpp:

(JSC::JITNegGenerator::generateInline):
(JSC::JITNegGenerator::generateFastPath):

  • jit/JITNegGenerator.h:
  • jit/JITOperations.cpp:
  • jit/JITOperations.h:
  • jit/JITSubGenerator.cpp:

(JSC::JITSubGenerator::generateInline):
(JSC::JITSubGenerator::generateFastPath):

  • jit/JITSubGenerator.h:
  • llint/LLIntData.cpp:

(JSC::LLInt::Data::performAssertions):

  • llint/LLIntOffsetsExtractor.cpp:

(JSC::LLIntOffsetsExtractor::dummy):

  • llint/LowLevelInterpreter.asm:
  • llint/LowLevelInterpreter32_64.asm:
  • llint/LowLevelInterpreter64.asm:
  • parser/ResultType.h:

(JSC::ResultType::ResultType):

  • runtime/CommonSlowPaths.cpp:

(JSC::updateArithProfileForUnaryArithOp):
(JSC::updateArithProfileForBinaryArithOp):
(JSC::SLOW_PATH_DECL):

Location:
trunk/Source/JavaScriptCore
Files:
46 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r252216 r252229  
     12019-11-07  Robin Morisset  <rmorisset@apple.com>
     2
     3        Split ArithProfile into a Unary and a Binary version
     4        https://bugs.webkit.org/show_bug.cgi?id=202832
     5        <rdar://problem/56266847>
     6
     7        Reviewed by Keith Miller.
     8
     9        ArithProfile was for a long time only used for add/sub/mul/div, but recently it started being used for negate. And it will soon also have to be used for inc and dec due to BigInt.
     10        So in this patch I make a separate version that only has the data for a single argument, and thus takes half as much memory.
     11
     12        After discussing this change with Phil I realized that the ResultType(s) that were taking space in ArithProfile are not needed: they never change and a copy is already in the bytecode instruction itself.
     13        Removing them allowed shrinking both kinds of ArithProfile to fit in 16 bits (9 and 13 respectively).
     14        I kept the two kinds separate because they may shrink or grow independently in the future.
     15
     16        This also required adding the "orh" instruction to the offline assembler, to set bits in the ArithProfile.
     17        This in turn motivated the addition of "storeh", as on RISC platforms "orh" on a memory location is actually loadh -> orh -> storeh.
     18
     19        * bytecode/ArithProfile.cpp:
     20        (JSC::ArithProfile<BitfieldType>::emitObserveResult):
     21        (JSC::ArithProfile<BitfieldType>::shouldEmitSetDouble const):
     22        (JSC::ArithProfile<BitfieldType>::emitSetDouble const):
     23        (JSC::ArithProfile<BitfieldType>::shouldEmitSetNonNumeric const):
     24        (JSC::ArithProfile<BitfieldType>::shouldEmitSetBigInt const):
     25        (JSC::ArithProfile<BitfieldType>::emitSetNonNumeric const):
     26        (JSC::ArithProfile<BitfieldType>::emitSetBigInt const):
     27        (WTF::printInternal):
     28        * bytecode/ArithProfile.h:
     29        (JSC::ArithProfile::didObserveNonInt32 const):
     30        (JSC::ArithProfile::didObserveDouble const):
     31        (JSC::ArithProfile::didObserveNonNegZeroDouble const):
     32        (JSC::ArithProfile::didObserveNegZeroDouble const):
     33        (JSC::ArithProfile::didObserveNonNumeric const):
     34        (JSC::ArithProfile::didObserveBigInt const):
     35        (JSC::ArithProfile::didObserveInt32Overflow const):
     36        (JSC::ArithProfile::didObserveInt52Overflow const):
     37        (JSC::ArithProfile::setObservedNonNegZeroDouble):
     38        (JSC::ArithProfile::setObservedNegZeroDouble):
     39        (JSC::ArithProfile::setObservedNonNumeric):
     40        (JSC::ArithProfile::setObservedBigInt):
     41        (JSC::ArithProfile::setObservedInt32Overflow):
     42        (JSC::ArithProfile::setObservedInt52Overflow):
     43        (JSC::ArithProfile::observeResult):
     44        (JSC::ArithProfile::addressOfBits const):
     45        (JSC::ArithProfile::bits const):
     46        (JSC::ArithProfile::ArithProfile):
     47        (JSC::ArithProfile::hasBits const):
     48        (JSC::ArithProfile::setBit):
     49        (JSC::UnaryArithProfile::UnaryArithProfile):
     50        (JSC::UnaryArithProfile::observedIntBits):
     51        (JSC::UnaryArithProfile::observedNumberBits):
     52        (JSC::UnaryArithProfile::argObservedType const):
     53        (JSC::UnaryArithProfile::setArgObservedType):
     54        (JSC::UnaryArithProfile::argSawInt32):
     55        (JSC::UnaryArithProfile::argSawNumber):
     56        (JSC::UnaryArithProfile::argSawNonNumber):
     57        (JSC::UnaryArithProfile::observeArg):
     58        (JSC::UnaryArithProfile::isObservedTypeEmpty):
     59        (JSC::BinaryArithProfile::BinaryArithProfile):
     60        (JSC::BinaryArithProfile::observedIntIntBits):
     61        (JSC::BinaryArithProfile::observedNumberIntBits):
     62        (JSC::BinaryArithProfile::observedIntNumberBits):
     63        (JSC::BinaryArithProfile::observedNumberNumberBits):
     64        (JSC::BinaryArithProfile::setLhsObservedType):
     65        (JSC::BinaryArithProfile::setRhsObservedType):
     66        (JSC::BinaryArithProfile::observeLHS):
     67        (JSC::BinaryArithProfile::observeLHSAndRHS):
     68        (JSC::BinaryArithProfile::isObservedTypeEmpty):
     69        * bytecode/BytecodeList.rb:
     70        * bytecode/CodeBlock.cpp:
     71        (JSC::CodeBlock::addJITAddIC):
     72        (JSC::CodeBlock::addJITMulIC):
     73        (JSC::CodeBlock::addJITSubIC):
     74        (JSC::CodeBlock::addJITNegIC):
     75        (JSC::CodeBlock::binaryArithProfileForBytecodeOffset):
     76        (JSC::CodeBlock::unaryArithProfileForBytecodeOffset):
     77        (JSC::CodeBlock::binaryArithProfileForPC):
     78        (JSC::CodeBlock::unaryArithProfileForPC):
     79        (JSC::CodeBlock::couldTakeSpecialFastCase):
     80        * bytecode/CodeBlock.h:
     81        (JSC::CodeBlock::addMathIC):
     82        * bytecode/Fits.h:
     83        * bytecode/MethodOfGettingAValueProfile.cpp:
     84        (JSC::MethodOfGettingAValueProfile::emitReportValue const):
     85        (JSC::MethodOfGettingAValueProfile::reportValue):
     86        * bytecode/MethodOfGettingAValueProfile.h:
     87        (JSC::MethodOfGettingAValueProfile::MethodOfGettingAValueProfile):
     88        * bytecompiler/BytecodeGenerator.cpp:
     89        (JSC::BytecodeGenerator::emitUnaryOp):
     90        * bytecompiler/BytecodeGenerator.h:
     91        * bytecompiler/NodesCodegen.cpp:
     92        (JSC::UnaryOpNode::emitBytecode):
     93        * dfg/DFGByteCodeParser.cpp:
     94        (JSC::DFG::ByteCodeParser::makeSafe):
     95        (JSC::DFG::ByteCodeParser::makeDivSafe):
     96        * dfg/DFGGraph.cpp:
     97        (JSC::DFG::Graph::methodOfGettingAValueProfileFor):
     98        * dfg/DFGSpeculativeJIT.cpp:
     99        (JSC::DFG::SpeculativeJIT::compileValueAdd):
     100        (JSC::DFG::SpeculativeJIT::compileValueSub):
     101        (JSC::DFG::SpeculativeJIT::compileValueNegate):
     102        (JSC::DFG::SpeculativeJIT::compileValueMul):
     103        * ftl/FTLLowerDFGToB3.cpp:
     104        (JSC::FTL::DFG::LowerDFGToB3::compileValueAdd):
     105        (JSC::FTL::DFG::LowerDFGToB3::compileValueSub):
     106        (JSC::FTL::DFG::LowerDFGToB3::compileValueMul):
     107        (JSC::FTL::DFG::LowerDFGToB3::compileUnaryMathIC):
     108        (JSC::FTL::DFG::LowerDFGToB3::compileBinaryMathIC):
     109        (JSC::FTL::DFG::LowerDFGToB3::compileArithAddOrSub):
     110        (JSC::FTL::DFG::LowerDFGToB3::compileValueNegate):
     111        * jit/JIT.h:
     112        * jit/JITAddGenerator.cpp:
     113        (JSC::JITAddGenerator::generateInline):
     114        (JSC::JITAddGenerator::generateFastPath):
     115        * jit/JITAddGenerator.h:
     116        * jit/JITArithmetic.cpp:
     117        (JSC::JIT::emit_op_negate):
     118        (JSC::JIT::emit_op_add):
     119        (JSC::JIT::emitMathICFast):
     120        (JSC::JIT::emitMathICSlow):
     121        (JSC::JIT::emit_op_div):
     122        (JSC::JIT::emit_op_mul):
     123        (JSC::JIT::emit_op_sub):
     124        * jit/JITDivGenerator.cpp:
     125        (JSC::JITDivGenerator::generateFastPath):
     126        * jit/JITDivGenerator.h:
     127        (JSC::JITDivGenerator::JITDivGenerator):
     128        * jit/JITInlines.h:
     129        (JSC::JIT::copiedArithProfile):
     130        * jit/JITMathIC.h:
     131        (JSC::JITMathIC::JITMathIC):
     132        (JSC::JITMathIC::generateInline):
     133        (JSC::JITMathIC::arithProfile const):
     134        (JSC::isBinaryProfileEmpty):
     135        (JSC::JITBinaryMathIC::JITBinaryMathIC):
     136        (JSC::isUnaryProfileEmpty):
     137        (JSC::JITUnaryMathIC::JITUnaryMathIC):
     138        * jit/JITMulGenerator.cpp:
     139        (JSC::JITMulGenerator::generateInline):
     140        (JSC::JITMulGenerator::generateFastPath):
     141        * jit/JITMulGenerator.h:
     142        * jit/JITNegGenerator.cpp:
     143        (JSC::JITNegGenerator::generateInline):
     144        (JSC::JITNegGenerator::generateFastPath):
     145        * jit/JITNegGenerator.h:
     146        * jit/JITOperations.cpp:
     147        * jit/JITOperations.h:
     148        * jit/JITSubGenerator.cpp:
     149        (JSC::JITSubGenerator::generateInline):
     150        (JSC::JITSubGenerator::generateFastPath):
     151        * jit/JITSubGenerator.h:
     152        * llint/LLIntData.cpp:
     153        (JSC::LLInt::Data::performAssertions):
     154        * llint/LLIntOffsetsExtractor.cpp:
     155        (JSC::LLIntOffsetsExtractor::dummy):
     156        * llint/LowLevelInterpreter.asm:
     157        * llint/LowLevelInterpreter32_64.asm:
     158        * llint/LowLevelInterpreter64.asm:
     159        * parser/ResultType.h:
     160        (JSC::ResultType::ResultType):
     161        * runtime/CommonSlowPaths.cpp:
     162        (JSC::updateArithProfileForUnaryArithOp):
     163        (JSC::updateArithProfileForBinaryArithOp):
     164        (JSC::SLOW_PATH_DECL):
     165
    11662019-11-07  Tadeu Zagallo  <tzagallo@apple.com>
    2167
  • trunk/Source/JavaScriptCore/bytecode/ArithProfile.cpp

    r252021 r252229  
    3333
    3434#if ENABLE(JIT)
    35 void ArithProfile::emitObserveResult(CCallHelpers& jit, JSValueRegs regs, TagRegistersMode mode)
     35template<typename BitfieldType>
     36void ArithProfile<BitfieldType>::emitObserveResult(CCallHelpers& jit, JSValueRegs regs, TagRegistersMode mode)
    3637{
    3738    if (!shouldEmitSetDouble() && !shouldEmitSetNonNumeric() && !shouldEmitSetBigInt())
     
    5960}
    6061
    61 bool ArithProfile::shouldEmitSetDouble() const
     62template<typename BitfieldType>
     63bool ArithProfile<BitfieldType>::shouldEmitSetDouble() const
    6264{
    63     uint32_t mask = ArithProfile::Int32Overflow | ArithProfile::Int52Overflow | ArithProfile::NegZeroDouble | ArithProfile::NonNegZeroDouble;
     65    uint32_t mask = Int32Overflow | Int52Overflow | NegZeroDouble | NonNegZeroDouble;
    6466    return (m_bits & mask) != mask;
    6567}
    6668
    67 void ArithProfile::emitSetDouble(CCallHelpers& jit) const
     69template<typename BitfieldType>
     70void ArithProfile<BitfieldType>::emitSetDouble(CCallHelpers& jit) const
    6871{
    6972    if (shouldEmitSetDouble())
    70         jit.or32(CCallHelpers::TrustedImm32(ArithProfile::Int32Overflow | ArithProfile::Int52Overflow | ArithProfile::NegZeroDouble | ArithProfile::NonNegZeroDouble), CCallHelpers::AbsoluteAddress(addressOfBits()));
     73        jit.or32(CCallHelpers::TrustedImm32(Int32Overflow | Int52Overflow | NegZeroDouble | NonNegZeroDouble), CCallHelpers::AbsoluteAddress(addressOfBits()));
    7174}
    7275
    73 bool ArithProfile::shouldEmitSetNonNumeric() const
     76template<typename BitfieldType>
     77bool ArithProfile<BitfieldType>::shouldEmitSetNonNumeric() const
    7478{
    7579    uint32_t mask = ArithProfile::NonNumeric;
     
    7781}
    7882
    79 bool ArithProfile::shouldEmitSetBigInt() const
     83template<typename BitfieldType>
     84bool ArithProfile<BitfieldType>::shouldEmitSetBigInt() const
    8085{
    8186    uint32_t mask = ArithProfile::BigInt;
     
    8388}
    8489
    85 void ArithProfile::emitSetNonNumeric(CCallHelpers& jit) const
     90template<typename BitfieldType>
     91void ArithProfile<BitfieldType>::emitSetNonNumeric(CCallHelpers& jit) const
    8692{
    8793    if (shouldEmitSetNonNumeric())
    88         jit.or32(CCallHelpers::TrustedImm32(ArithProfile::NonNumeric), CCallHelpers::AbsoluteAddress(addressOfBits()));
     94        jit.or32(CCallHelpers::TrustedImm32(NonNumeric), CCallHelpers::AbsoluteAddress(addressOfBits()));
    8995}
    9096
    91 void ArithProfile::emitSetBigInt(CCallHelpers& jit) const
     97template<typename BitfieldType>
     98void ArithProfile<BitfieldType>::emitSetBigInt(CCallHelpers& jit) const
    9299{
    93100    if (shouldEmitSetBigInt())
    94         jit.or32(CCallHelpers::TrustedImm32(ArithProfile::BigInt), CCallHelpers::AbsoluteAddress(addressOfBits()));
     101        jit.or32(CCallHelpers::TrustedImm32(BigInt), CCallHelpers::AbsoluteAddress(addressOfBits()));
    95102}
     103
     104// Generate the implementations of the functions above for UnaryArithProfile/BinaryArithProfile
     105// If changing the size of either, add the corresponding lines here.
     106template class ArithProfile<uint16_t>;
    96107#endif // ENABLE(JIT)
    97108
     
    102113using namespace JSC;
    103114
    104 void printInternal(PrintStream& out, const ArithProfile& profile)
     115template <typename T>
     116void printInternal(PrintStream& out, const ArithProfile<T>& profile)
    105117{
    106118    const char* separator = "";
     
    136148        }
    137149    }
     150    out.print(">");
     151}
     152
     153void printInternal(PrintStream& out, const UnaryArithProfile& profile)
     154{
     155    printInternal(out, static_cast<ArithProfile<UnaryArithProfileBase>>(profile));
     156
     157    out.print(" Arg ObservedType:<");
     158    out.print(profile.argObservedType());
     159    out.print(">");
     160}
     161
     162void printInternal(PrintStream& out, const BinaryArithProfile& profile)
     163{
     164    printInternal(out, static_cast<ArithProfile<UnaryArithProfileBase>>(profile));
     165
    138166    if (profile.tookSpecialFastPath())
    139         out.print(separator, "Took special fast path.");
    140     out.print(">");
     167        out.print(" Took special fast path.");
    141168
    142169    out.print(" LHS ObservedType:<");
     
    144171    out.print("> RHS ObservedType:<");
    145172    out.print(profile.rhsObservedType());
    146     out.print(">");
    147 
    148     out.print(" LHS ResultType:<", RawPointer(bitwise_cast<void*>(static_cast<uintptr_t>(profile.lhsResultType().bits()))));
    149     out.print("> RHS ResultType:<", RawPointer(bitwise_cast<void*>(static_cast<uintptr_t>(profile.rhsResultType().bits()))));
    150173    out.print(">");
    151174}
  • trunk/Source/JavaScriptCore/bytecode/ArithProfile.h

    r252021 r252229  
    6767};
    6868
    69 struct ArithProfile {
    70 private:
    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 
     69template <typename BitfieldType>
     70class ArithProfile {
    8671public:
    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 
    16572    enum ObservedResults {
    16673        NonNegZeroDouble = 1 << 0,
     
    17178        BigInt           = 1 << 5,
    17279    };
    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; }
     80    static constexpr uint32_t observedResultsNumBitsNeeded = 6;
    19881
    19982    bool didObserveNonInt32() const { return hasBits(NonNegZeroDouble | NegZeroDouble | NonNumeric | BigInt); }
     
    21295    void setObservedInt32Overflow() { setBit(Int32Overflow); }
    21396    void setObservedInt52Overflow() { setBit(Int52Overflow); }
    214 
    215     const void* addressOfBits() const { return &m_bits; }
    21697
    21798    void observeResult(JSValue value)
     
    230111    }
    231112
     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
     135protected:
     136    ArithProfile()
     137    {
     138    }
     139
     140    bool hasBits(int mask) const { return m_bits & mask; }
     141    void setBit(int mask) { m_bits |= mask; }
     142
     143    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.
     144};
     145
     146/* This class stores the following components in 16 bits:
     147 * - ObservedResults
     148 * - ObservedType for the argument
     149 */
     150using UnaryArithProfileBase = uint16_t;
     151class UnaryArithProfile : public ArithProfile<UnaryArithProfileBase> {
     152    static constexpr unsigned argObservedTypeShift = observedResultsNumBitsNeeded;
     153
     154    static_assert(argObservedTypeShift + ObservedType::numBitsNeeded <= sizeof(UnaryArithProfileBase) * 8, "Should fit in a the type of the underlying bitfield.");
     155
     156    static constexpr UnaryArithProfileBase clearArgObservedTypeBitMask = static_cast<UnaryArithProfileBase>(~(0b111 << argObservedTypeShift));
     157
     158    static constexpr UnaryArithProfileBase observedTypeMask = (1 << ObservedType::numBitsNeeded) - 1;
     159
     160public:
     161    UnaryArithProfile()
     162        : ArithProfile<UnaryArithProfileBase>()
     163    {
     164        ASSERT(argObservedType().isEmpty());
     165        ASSERT(argObservedType().isEmpty());
     166    }
     167
     168    static constexpr UnaryArithProfileBase observedIntBits()
     169    {
     170        constexpr ObservedType observedInt32 { ObservedType().withInt32() };
     171        constexpr UnaryArithProfileBase bits = observedInt32.bits() << argObservedTypeShift;
     172        return bits;
     173    }
     174    static constexpr UnaryArithProfileBase observedNumberBits()
     175    {
     176        constexpr ObservedType observedNumber { ObservedType().withNumber() };
     177        constexpr UnaryArithProfileBase bits = observedNumber.bits() << argObservedTypeShift;
     178        return bits;
     179    }
     180
     181    constexpr ObservedType argObservedType() const { return ObservedType((m_bits >> argObservedTypeShift) & observedTypeMask); }
     182    void setArgObservedType(ObservedType type)
     183    {
     184        UnaryArithProfileBase bits = m_bits;
     185        bits &= clearArgObservedTypeBitMask;
     186        bits |= type.bits() << argObservedTypeShift;
     187        m_bits = bits;
     188        ASSERT(argObservedType() == type);
     189    }
     190
     191    void argSawInt32() { setArgObservedType(argObservedType().withInt32()); }
     192    void argSawNumber() { setArgObservedType(argObservedType().withNumber()); }
     193    void argSawNonNumber() { setArgObservedType(argObservedType().withNonNumber()); }
     194
     195    void observeArg(JSValue arg)
     196    {
     197        UnaryArithProfile newProfile = *this;
     198        if (arg.isNumber()) {
     199            if (arg.isInt32())
     200                newProfile.argSawInt32();
     201            else
     202                newProfile.argSawNumber();
     203        } else
     204            newProfile.argSawNonNumber();
     205
     206        m_bits = newProfile.bits();
     207    }
     208
     209    bool isObservedTypeEmpty()
     210    {
     211        return argObservedType().isEmpty();
     212    }
     213
     214    friend class JSC::LLIntOffsetsExtractor;
     215};
     216
     217/* This class stores the following components in 16 bits:
     218 * - ObservedResults
     219 * - ObservedType for right-hand-side
     220 * - ObservedType for left-hand-side
     221 * - a bit used by division to indicate whether a special fast path was taken
     222 */
     223using BinaryArithProfileBase = uint16_t;
     224class BinaryArithProfile : public ArithProfile<BinaryArithProfileBase> {
     225    static constexpr uint32_t rhsObservedTypeShift = observedResultsNumBitsNeeded;
     226    static constexpr uint32_t lhsObservedTypeShift = rhsObservedTypeShift + ObservedType::numBitsNeeded;
     227
     228    static_assert(ObservedType::numBitsNeeded == 3, "We make a hard assumption about that here.");
     229    static constexpr BinaryArithProfileBase clearRhsObservedTypeBitMask = static_cast<BinaryArithProfileBase>(~(0b111 << rhsObservedTypeShift));
     230    static constexpr BinaryArithProfileBase clearLhsObservedTypeBitMask = static_cast<BinaryArithProfileBase>(~(0b111 << lhsObservedTypeShift));
     231
     232    static constexpr BinaryArithProfileBase observedTypeMask = (1 << ObservedType::numBitsNeeded) - 1;
     233
     234public:
     235    static constexpr BinaryArithProfileBase specialFastPathBit = 1 << (lhsObservedTypeShift + ObservedType::numBitsNeeded);
     236    static_assert((lhsObservedTypeShift + ObservedType::numBitsNeeded + 1) <= sizeof(BinaryArithProfileBase) * 8, "Should fit in a uint32_t.");
     237    static_assert(!(specialFastPathBit & ~clearLhsObservedTypeBitMask), "These bits should not intersect.");
     238    static_assert(specialFastPathBit & clearLhsObservedTypeBitMask, "These bits should intersect.");
     239    static_assert(specialFastPathBit > ~clearLhsObservedTypeBitMask, "These bits should not intersect and specialFastPathBit should be a higher bit.");
     240
     241    BinaryArithProfile()
     242        : ArithProfile<BinaryArithProfileBase> ()
     243    {
     244        ASSERT(lhsObservedType().isEmpty());
     245        ASSERT(rhsObservedType().isEmpty());
     246    }
     247
     248    static constexpr BinaryArithProfileBase observedIntIntBits()
     249    {
     250        constexpr ObservedType observedInt32 { ObservedType().withInt32() };
     251        constexpr BinaryArithProfileBase bits = (observedInt32.bits() << lhsObservedTypeShift) | (observedInt32.bits() << rhsObservedTypeShift);
     252        return bits;
     253    }
     254    static constexpr BinaryArithProfileBase observedNumberIntBits()
     255    {
     256        constexpr ObservedType observedNumber { ObservedType().withNumber() };
     257        constexpr ObservedType observedInt32 { ObservedType().withInt32() };
     258        constexpr BinaryArithProfileBase bits = (observedNumber.bits() << lhsObservedTypeShift) | (observedInt32.bits() << rhsObservedTypeShift);
     259        return bits;
     260    }
     261    static constexpr BinaryArithProfileBase observedIntNumberBits()
     262    {
     263        constexpr ObservedType observedNumber { ObservedType().withNumber() };
     264        constexpr ObservedType observedInt32 { ObservedType().withInt32() };
     265        constexpr BinaryArithProfileBase bits = (observedInt32.bits() << lhsObservedTypeShift) | (observedNumber.bits() << rhsObservedTypeShift);
     266        return bits;
     267    }
     268    static constexpr BinaryArithProfileBase observedNumberNumberBits()
     269    {
     270        constexpr ObservedType observedNumber { ObservedType().withNumber() };
     271        constexpr BinaryArithProfileBase bits = (observedNumber.bits() << lhsObservedTypeShift) | (observedNumber.bits() << rhsObservedTypeShift);
     272        return bits;
     273    }
     274
     275    constexpr ObservedType lhsObservedType() const { return ObservedType((m_bits >> lhsObservedTypeShift) & observedTypeMask); }
     276    constexpr ObservedType rhsObservedType() const { return ObservedType((m_bits >> rhsObservedTypeShift) & observedTypeMask); }
     277    void setLhsObservedType(ObservedType type)
     278    {
     279        BinaryArithProfileBase bits = m_bits;
     280        bits &= clearLhsObservedTypeBitMask;
     281        bits |= type.bits() << lhsObservedTypeShift;
     282        m_bits = bits;
     283        ASSERT(lhsObservedType() == type);
     284    }
     285
     286    void setRhsObservedType(ObservedType type)
     287    {
     288        BinaryArithProfileBase bits = m_bits;
     289        bits &= clearRhsObservedTypeBitMask;
     290        bits |= type.bits() << rhsObservedTypeShift;
     291        m_bits = bits;
     292        ASSERT(rhsObservedType() == type);
     293    }
     294
     295    bool tookSpecialFastPath() const { return m_bits & specialFastPathBit; }
     296
    232297    void lhsSawInt32() { setLhsObservedType(lhsObservedType().withInt32()); }
    233298    void lhsSawNumber() { setLhsObservedType(lhsObservedType().withNumber()); }
     
    239304    void observeLHS(JSValue lhs)
    240305    {
    241         ArithProfile newProfile = *this;
     306        BinaryArithProfile newProfile = *this;
    242307        if (lhs.isNumber()) {
    243308            if (lhs.isInt32())
     
    255320        observeLHS(lhs);
    256321
    257         ArithProfile newProfile = *this;
     322        BinaryArithProfile newProfile = *this;
    258323        if (rhs.isNumber()) {
    259324            if (rhs.isInt32())
     
    267332    }
    268333
    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 
    289 private:
    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.
     334    bool isObservedTypeEmpty()
     335    {
     336        return lhsObservedType().isEmpty() && rhsObservedType().isEmpty();
     337    }
    309338
    310339    friend class JSC::LLIntOffsetsExtractor;
     
    315344namespace WTF {
    316345
    317 void printInternal(PrintStream&, const JSC::ArithProfile&);
     346void printInternal(PrintStream&, const JSC::UnaryArithProfile&);
     347void printInternal(PrintStream&, const JSC::BinaryArithProfile&);
    318348void printInternal(PrintStream&, const JSC::ObservedType&);
    319349
  • trunk/Source/JavaScriptCore/bytecode/BytecodeList.rb

    r252032 r252229  
    4242    :JSValue,
    4343    :LLIntCallLinkInfo,
     44    :ResultType,
    4445    :OperandTypes,
    4546    :ProfileTypeBytecodeFlag,
     
    5960    :ValueProfile,
    6061    :ValueProfileAndOperandBuffer,
    61     :ArithProfile,
     62    :UnaryArithProfile,
     63    :BinaryArithProfile,
    6264    :ArrayProfile,
    6365    :ArrayAllocationProfile,
     
    280282    },
    281283    metadata: {
    282         arithProfile: ArithProfile
    283     },
    284     metadata_initializers: {
    285         arithProfile: :operandTypes
     284        arithProfile: BinaryArithProfile
    286285    }
    287286
     
    365364        dst: VirtualRegister,
    366365        operand: VirtualRegister,
    367         operandTypes: OperandTypes,
    368     },
    369     metadata: {
    370         arithProfile: ArithProfile,
    371     },
    372     metadata_initializers: {
    373         arithProfile: :operandTypes
     366        resultType: ResultType,
     367    },
     368    metadata: {
     369        arithProfile: UnaryArithProfile,
    374370    }
    375371
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r252032 r252229  
    14801480}
    14811481
    1482 JITAddIC* CodeBlock::addJITAddIC(ArithProfile* arithProfile)
     1482JITAddIC* CodeBlock::addJITAddIC(BinaryArithProfile* arithProfile)
    14831483{
    14841484    ConcurrentJSLocker locker(m_lock);
     
    14861486}
    14871487
    1488 JITMulIC* CodeBlock::addJITMulIC(ArithProfile* arithProfile)
     1488JITMulIC* CodeBlock::addJITMulIC(BinaryArithProfile* arithProfile)
    14891489{
    14901490    ConcurrentJSLocker locker(m_lock);
     
    14921492}
    14931493
    1494 JITSubIC* CodeBlock::addJITSubIC(ArithProfile* arithProfile)
     1494JITSubIC* CodeBlock::addJITSubIC(BinaryArithProfile* arithProfile)
    14951495{
    14961496    ConcurrentJSLocker locker(m_lock);
     
    14981498}
    14991499
    1500 JITNegIC* CodeBlock::addJITNegIC(ArithProfile* arithProfile)
     1500JITNegIC* CodeBlock::addJITNegIC(UnaryArithProfile* arithProfile)
    15011501{
    15021502    ConcurrentJSLocker locker(m_lock);
     
    30853085}
    30863086
    3087 ArithProfile* CodeBlock::arithProfileForBytecodeIndex(BytecodeIndex bytecodeIndex)
    3088 {
    3089     return arithProfileForPC(instructions().at(bytecodeIndex.offset()).ptr());
    3090 }
    3091 
    3092 ArithProfile* CodeBlock::arithProfileForPC(const Instruction* pc)
     3087BinaryArithProfile* CodeBlock::binaryArithProfileForBytecodeIndex(BytecodeIndex bytecodeIndex)
     3088{
     3089    return binaryArithProfileForPC(instructions().at(bytecodeIndex.offset()).ptr());
     3090}
     3091
     3092UnaryArithProfile* CodeBlock::unaryArithProfileForBytecodeIndex(BytecodeIndex bytecodeIndex)
     3093{
     3094    return unaryArithProfileForPC(instructions().at(bytecodeIndex.offset()).ptr());
     3095}
     3096
     3097BinaryArithProfile* CodeBlock::binaryArithProfileForPC(const Instruction* pc)
    30933098{
    30943099    switch (pc->opcodeID()) {
    3095     case op_negate:
    3096         return &pc->as<OpNegate>().metadata(this).m_arithProfile;
    30973100    case op_add:
    30983101        return &pc->as<OpAdd>().metadata(this).m_arithProfile;
     
    31103113}
    31113114
     3115UnaryArithProfile* CodeBlock::unaryArithProfileForPC(const Instruction* pc)
     3116{
     3117    switch (pc->opcodeID()) {
     3118    case op_negate:
     3119        return &pc->as<OpNegate>().metadata(this).m_arithProfile;
     3120    default:
     3121        break;
     3122    }
     3123
     3124    return nullptr;
     3125}
     3126
    31123127bool CodeBlock::couldTakeSpecialArithFastCase(BytecodeIndex bytecodeIndex)
    31133128{
    31143129    if (!hasBaselineJITProfiling())
    31153130        return false;
    3116     ArithProfile* profile = arithProfileForBytecodeIndex(bytecodeIndex);
     3131    BinaryArithProfile* profile = binaryArithProfileForBytecodeIndex(bytecodeIndex);
    31173132    if (!profile)
    31183133        return false;
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.h

    r252021 r252229  
    8484#endif
    8585
     86class UnaryArithProfile;
     87class BinaryArithProfile;
    8688class BytecodeLivenessAnalysis;
    8789class CodeBlockSet;
     
    9799enum class AccessType : int8_t;
    98100
    99 struct ArithProfile;
    100101struct OpCatch;
    101102
     
    280281    JITData& ensureJITDataSlow(const ConcurrentJSLocker&);
    281282
    282     JITAddIC* addJITAddIC(ArithProfile*);
    283     JITMulIC* addJITMulIC(ArithProfile*);
    284     JITNegIC* addJITNegIC(ArithProfile*);
    285     JITSubIC* addJITSubIC(ArithProfile*);
     283    JITAddIC* addJITAddIC(BinaryArithProfile*);
     284    JITMulIC* addJITMulIC(BinaryArithProfile*);
     285    JITNegIC* addJITNegIC(UnaryArithProfile*);
     286    JITSubIC* addJITSubIC(BinaryArithProfile*);
    286287
    287288    template <typename Generator, typename = typename std::enable_if<std::is_same<Generator, JITAddGenerator>::value>::type>
    288     JITAddIC* addMathIC(ArithProfile* profile) { return addJITAddIC(profile); }
     289    JITAddIC* addMathIC(BinaryArithProfile* profile) { return addJITAddIC(profile); }
    289290
    290291    template <typename Generator, typename = typename std::enable_if<std::is_same<Generator, JITMulGenerator>::value>::type>
    291     JITMulIC* addMathIC(ArithProfile* profile) { return addJITMulIC(profile); }
     292    JITMulIC* addMathIC(BinaryArithProfile* profile) { return addJITMulIC(profile); }
    292293
    293294    template <typename Generator, typename = typename std::enable_if<std::is_same<Generator, JITNegGenerator>::value>::type>
    294     JITNegIC* addMathIC(ArithProfile* profile) { return addJITNegIC(profile); }
     295    JITNegIC* addMathIC(UnaryArithProfile* profile) { return addJITNegIC(profile); }
    295296
    296297    template <typename Generator, typename = typename std::enable_if<std::is_same<Generator, JITSubGenerator>::value>::type>
    297     JITSubIC* addMathIC(ArithProfile* profile) { return addJITSubIC(profile); }
     298    JITSubIC* addMathIC(BinaryArithProfile* profile) { return addJITSubIC(profile); }
    298299
    299300    StructureStubInfo* addStubInfo(AccessType);
     
    498499    template<typename Functor> void forEachLLIntCallLinkInfo(const Functor&);
    499500
    500     ArithProfile* arithProfileForBytecodeIndex(BytecodeIndex);
    501     ArithProfile* arithProfileForPC(const Instruction*);
     501    BinaryArithProfile* binaryArithProfileForBytecodeIndex(BytecodeIndex);
     502    UnaryArithProfile* unaryArithProfileForBytecodeIndex(BytecodeIndex);
     503    BinaryArithProfile* binaryArithProfileForPC(const Instruction*);
     504    UnaryArithProfile* unaryArithProfileForPC(const Instruction*);
    502505
    503506    bool couldTakeSpecialArithFastCase(BytecodeIndex bytecodeOffset);
  • trunk/Source/JavaScriptCore/bytecode/Fits.h

    r252032 r252229  
    237237
    238238template<OpcodeSize size>
     239struct Fits<ResultType, size, std::enable_if_t<sizeof(ResultType) != size, std::true_type>> : public Fits<uint8_t, size> {
     240    static_assert(sizeof(ResultType) == sizeof(uint8_t));
     241    using Base = Fits<uint8_t, size>;
     242
     243    static bool check(ResultType type) { return Base::check(type.bits()); }
     244
     245    static typename Base::TargetType convert(ResultType type) { return Base::convert(type.bits()); }
     246
     247    static ResultType convert(typename Base::TargetType type) { return ResultType(Base::convert(type)); }
     248};
     249
     250template<OpcodeSize size>
    239251struct Fits<OperandTypes, size, std::enable_if_t<sizeof(OperandTypes) != size, std::true_type>> {
    240252    static_assert(sizeof(OperandTypes) == sizeof(uint16_t));
  • trunk/Source/JavaScriptCore/bytecode/MethodOfGettingAValueProfile.cpp

    r252021 r252229  
    6767    }
    6868       
    69     case ArithProfileReady: {
    70         u.arithProfile->emitObserveResult(jit, regs, DoNotHaveTagRegisters);
     69    case UnaryArithProfileReady: {
     70        u.unaryArithProfile->emitObserveResult(jit, regs, DoNotHaveTagRegisters);
    7171        return;
    72     } }
     72    }
     73
     74    case BinaryArithProfileReady: {
     75        u.binaryArithProfile->emitObserveResult(jit, regs, DoNotHaveTagRegisters);
     76        return;
     77    }
     78    }
    7379   
    7480    RELEASE_ASSERT_NOT_REACHED();
     
    95101    }
    96102
    97     case ArithProfileReady: {
    98         u.arithProfile->observeResult(value);
     103    case UnaryArithProfileReady: {
     104        u.unaryArithProfile->observeResult(value);
    99105        return;
    100     } }
     106    }
     107
     108    case BinaryArithProfileReady: {
     109        u.binaryArithProfile->observeResult(value);
     110        return;
     111    }
     112    }
    101113
    102114    RELEASE_ASSERT_NOT_REACHED();
  • trunk/Source/JavaScriptCore/bytecode/MethodOfGettingAValueProfile.h

    r252021 r252229  
    3737namespace JSC {
    3838
     39class UnaryArithProfile;
     40class BinaryArithProfile;
    3941class CCallHelpers;
    4042class CodeBlock;
    4143class LazyOperandValueProfileKey;
    42 struct ArithProfile;
    4344struct ValueProfile;
    4445
     
    5859            m_kind = None;
    5960    }
    60    
    61     MethodOfGettingAValueProfile(ArithProfile* profile)
     61
     62    MethodOfGettingAValueProfile(UnaryArithProfile* profile)
    6263    {
    6364        if (profile) {
    64             m_kind = ArithProfileReady;
    65             u.arithProfile = profile;
     65            m_kind = UnaryArithProfileReady;
     66            u.unaryArithProfile = profile;
     67        } else
     68            m_kind = None;
     69    }
     70
     71    MethodOfGettingAValueProfile(BinaryArithProfile* profile)
     72    {
     73        if (profile) {
     74            m_kind = BinaryArithProfileReady;
     75            u.binaryArithProfile = profile;
    6676        } else
    6777            m_kind = None;
     
    8090        None,
    8191        Ready,
    82         ArithProfileReady,
     92        UnaryArithProfileReady,
     93        BinaryArithProfileReady,
    8394        LazyOperand
    8495    };
     
    91102
    92103        ValueProfile* profile;
    93         ArithProfile* arithProfile;
     104        UnaryArithProfile* unaryArithProfile;
     105        BinaryArithProfile* binaryArithProfile;
    94106        struct {
    95107            CodeBlock* codeBlock;
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r252032 r252229  
    15171517}
    15181518
    1519 RegisterID* BytecodeGenerator::emitUnaryOp(OpcodeID opcodeID, RegisterID* dst, RegisterID* src, OperandTypes types)
     1519RegisterID* BytecodeGenerator::emitUnaryOp(OpcodeID opcodeID, RegisterID* dst, RegisterID* src, ResultType type)
    15201520{
    15211521    switch (opcodeID) {
     
    15241524        break;
    15251525    case op_negate:
    1526         OpNegate::emit(this, dst, src, types);
     1526        OpNegate::emit(this, dst, src, type);
    15271527        break;
    15281528    case op_bitnot:
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h

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

    r252032 r252229  
    21472147    RefPtr<RegisterID> src = generator.emitNode(m_expr);
    21482148    generator.emitExpressionInfo(position(), position(), position());
    2149     return generator.emitUnaryOp(opcodeID(), generator.finalDestination(dst), src.get(), OperandTypes(m_expr->resultDescriptor()));
     2149    return generator.emitUnaryOp(opcodeID(), generator.finalDestination(dst), src.get(), m_expr->resultDescriptor());
    21502150}
    21512151
  • trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

    r252032 r252229  
    943943            return node;
    944944
    945         {
    946             ArithProfile* arithProfile = m_inlineStackTop->m_profiledBlock->arithProfileForBytecodeIndex(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             }
     945        switch (node->op()) {
     946        case ArithAdd:
     947        case ArithSub:
     948        case ValueAdd: {
     949            BinaryArithProfile* arithProfile = m_inlineStackTop->m_profiledBlock->binaryArithProfileForBytecodeIndex(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->binaryArithProfileForBytecodeIndex(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->unaryArithProfileForBytecodeIndex(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;
    995999        }
    9961000       
     
    10341038        // FIXME: It might be possible to make this more granular.
    10351039        node->mergeFlags(NodeMayOverflowInt32InBaseline | NodeMayNegZeroInBaseline);
    1036        
    1037         ArithProfile* arithProfile = m_inlineStackTop->m_profiledBlock->arithProfileForBytecodeIndex(m_currentIndex);
     1040
     1041        BinaryArithProfile* arithProfile = m_inlineStackTop->m_profiledBlock->binaryArithProfileForBytecodeIndex(m_currentIndex);
    10381042        if (arithProfile->didObserveBigInt())
    10391043            node->mergeFlags(NodeMayHaveBigIntResult);
  • trunk/Source/JavaScriptCore/dfg/DFGGraph.cpp

    r252021 r252229  
    16551655
    16561656            if (profiledBlock->hasBaselineJITProfiling()) {
    1657                 if (ArithProfile* result = profiledBlock->arithProfileForBytecodeIndex(node->origin.semantic.bytecodeIndex()))
     1657                if (BinaryArithProfile* result = profiledBlock->binaryArithProfileForBytecodeIndex(node->origin.semantic.bytecodeIndex()))
     1658                    return result;
     1659                if (UnaryArithProfile* result = profiledBlock->unaryArithProfileForBytecodeIndex(node->origin.semantic.bytecodeIndex()))
    16581660                    return result;
    16591661            }
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r252160 r252229  
    39963996    CodeBlock* baselineCodeBlock = m_jit.graph().baselineCodeBlockFor(node->origin.semantic);
    39973997    BytecodeIndex bytecodeIndex = node->origin.semantic.bytecodeIndex();
    3998     ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeIndex(bytecodeIndex);
     3998    BinaryArithProfile* arithProfile = baselineCodeBlock->binaryArithProfileForBytecodeIndex(bytecodeIndex);
    39993999    JITAddIC* addIC = m_jit.codeBlock()->addJITAddIC(arithProfile);
    40004000    auto repatchingFunction = operationValueAddOptimize;
     
    40204020        CodeBlock* baselineCodeBlock = m_jit.graph().baselineCodeBlockFor(node->origin.semantic);
    40214021        BytecodeIndex bytecodeIndex = node->origin.semantic.bytecodeIndex();
    4022         ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeIndex(bytecodeIndex);
     4022        BinaryArithProfile* arithProfile = baselineCodeBlock->binaryArithProfileForBytecodeIndex(bytecodeIndex);
    40234023        JITSubIC* subIC = m_jit.codeBlock()->addJITSubIC(arithProfile);
    40244024        auto repatchingFunction = operationValueSubOptimize;
     
    46144614    CodeBlock* baselineCodeBlock = m_jit.graph().baselineCodeBlockFor(node->origin.semantic);
    46154615    BytecodeIndex bytecodeIndex = node->origin.semantic.bytecodeIndex();
    4616     ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeIndex(bytecodeIndex);
     4616    UnaryArithProfile* arithProfile = baselineCodeBlock->unaryArithProfileForBytecodeIndex(bytecodeIndex);
    46174617    JITNegIC* negIC = m_jit.codeBlock()->addJITNegIC(arithProfile);
    46184618    auto repatchingFunction = operationArithNegateOptimize;
     
    48374837    CodeBlock* baselineCodeBlock = m_jit.graph().baselineCodeBlockFor(node->origin.semantic);
    48384838    BytecodeIndex bytecodeIndex = node->origin.semantic.bytecodeIndex();
    4839     ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeIndex(bytecodeIndex);
     4839    BinaryArithProfile* arithProfile = baselineCodeBlock->binaryArithProfileForBytecodeIndex(bytecodeIndex);
    48404840    JITMulIC* mulIC = m_jit.codeBlock()->addJITMulIC(arithProfile);
    48414841    auto repatchingFunction = operationValueMulOptimize;
  • trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

    r252021 r252229  
    21172117        CodeBlock* baselineCodeBlock = m_ftlState.graph.baselineCodeBlockFor(m_node->origin.semantic);
    21182118        BytecodeIndex bytecodeIndex = m_node->origin.semantic.bytecodeIndex();
    2119         ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeIndex(bytecodeIndex);
     2119        BinaryArithProfile* arithProfile = baselineCodeBlock->binaryArithProfileForBytecodeIndex(bytecodeIndex);
    21202120        auto repatchingFunction = operationValueAddOptimize;
    21212121        auto nonRepatchingFunction = operationValueAdd;
     
    21382138        CodeBlock* baselineCodeBlock = m_ftlState.graph.baselineCodeBlockFor(m_node->origin.semantic);
    21392139        BytecodeIndex bytecodeIndex = m_node->origin.semantic.bytecodeIndex();
    2140         ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeIndex(bytecodeIndex);
     2140        BinaryArithProfile* arithProfile = baselineCodeBlock->binaryArithProfileForBytecodeIndex(bytecodeIndex);
    21412141        auto repatchingFunction = operationValueSubOptimize;
    21422142        auto nonRepatchingFunction = operationValueSub;
     
    21592159        CodeBlock* baselineCodeBlock = m_ftlState.graph.baselineCodeBlockFor(m_node->origin.semantic);
    21602160        BytecodeIndex bytecodeIndex = m_node->origin.semantic.bytecodeIndex();
    2161         ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeIndex(bytecodeIndex);
     2161        BinaryArithProfile* arithProfile = baselineCodeBlock->binaryArithProfileForBytecodeIndex(bytecodeIndex);
    21622162        auto repatchingFunction = operationValueMulOptimize;
    21632163        auto nonRepatchingFunction = operationValueMul;
     
    21672167    template <typename Generator, typename Func1, typename Func2,
    21682168        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>>
    2169     void compileUnaryMathIC(ArithProfile* arithProfile, Func1 repatchingFunction, Func2 nonRepatchingFunction)
     2169    void compileUnaryMathIC(UnaryArithProfile* arithProfile, Func1 repatchingFunction, Func2 nonRepatchingFunction)
    21702170    {
    21712171        Node* node = m_node;
     
    22532253    template <typename Generator, typename Func1, typename Func2,
    22542254        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>>
    2255     void compileBinaryMathIC(ArithProfile* arithProfile, Func1 repatchingFunction, Func2 nonRepatchingFunction)
     2255    void compileBinaryMathIC(BinaryArithProfile* arithProfile, Func1 repatchingFunction, Func2 nonRepatchingFunction)
    22562256    {
    22572257        Node* node = m_node;
     
    24222422            CodeBlock* baselineCodeBlock = m_ftlState.graph.baselineCodeBlockFor(m_node->origin.semantic);
    24232423            BytecodeIndex bytecodeIndex = m_node->origin.semantic.bytecodeIndex();
    2424             ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeIndex(bytecodeIndex);
     2424            BinaryArithProfile* arithProfile = baselineCodeBlock->binaryArithProfileForBytecodeIndex(bytecodeIndex);
    24252425            auto repatchingFunction = operationValueSubOptimize;
    24262426            auto nonRepatchingFunction = operationValueSub;
     
    31003100        CodeBlock* baselineCodeBlock = m_ftlState.graph.baselineCodeBlockFor(m_node->origin.semantic);
    31013101        BytecodeIndex bytecodeIndex = m_node->origin.semantic.bytecodeIndex();
    3102         ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeIndex(bytecodeIndex);
     3102        UnaryArithProfile* arithProfile = baselineCodeBlock->unaryArithProfileForBytecodeIndex(bytecodeIndex);
    31033103        auto repatchingFunction = operationArithNegateOptimize;
    31043104        auto nonRepatchingFunction = operationArithNegate;
  • trunk/Source/JavaScriptCore/jit/JIT.h

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

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

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

    r252021 r252229  
    454454void JIT::emit_op_negate(const Instruction* currentInstruction)
    455455{
    456     ArithProfile* arithProfile = &currentInstruction->as<OpNegate>().metadata(m_codeBlock).m_arithProfile;
     456    UnaryArithProfile* arithProfile = &currentInstruction->as<OpNegate>().metadata(m_codeBlock).m_arithProfile;
    457457    JITNegIC* negateIC = m_codeBlock->addJITNegIC(arithProfile);
    458458    m_instructionToMathIC.add(currentInstruction, negateIC);
     
    635635}
    636636
    637 ALWAYS_INLINE static OperandTypes getOperandTypes(const ArithProfile& arithProfile)
    638 {
    639     return OperandTypes(arithProfile.lhsResultType(), arithProfile.rhsResultType());
    640 }
    641 
    642637void JIT::emit_op_add(const Instruction* currentInstruction)
    643638{
    644     ArithProfile* arithProfile = &currentInstruction->as<OpAdd>().metadata(m_codeBlock).m_arithProfile;
     639    BinaryArithProfile* arithProfile = &currentInstruction->as<OpAdd>().metadata(m_codeBlock).m_arithProfile;
    645640    JITAddIC* addIC = m_codeBlock->addJITAddIC(arithProfile);
    646641    m_instructionToMathIC.add(currentInstruction, addIC);
     
    687682    bool generatedInlineCode = mathIC->generateInline(*this, mathICGenerationState);
    688683    if (!generatedInlineCode) {
    689         ArithProfile* arithProfile = mathIC->arithProfile();
     684        UnaryArithProfile* arithProfile = mathIC->arithProfile();
    690685        if (arithProfile && shouldEmitProfiling())
    691686            callOperationWithResult(profiledFunction, resultRegs, TrustedImmPtr(m_codeBlock->globalObject()), srcRegs, arithProfile);
     
    710705{
    711706    auto bytecode = currentInstruction->as<Op>();
    712     OperandTypes types = getOperandTypes(copiedArithProfile(bytecode));
    713707    int result = bytecode.m_dst.offset();
    714708    int op1 = bytecode.m_lhs.offset();
     
    729723#endif
    730724
    731     SnippetOperand leftOperand(types.first());
    732     SnippetOperand rightOperand(types.second());
     725    SnippetOperand leftOperand(bytecode.m_operandTypes.first());
     726    SnippetOperand rightOperand(bytecode.m_operandTypes.second());
    733727
    734728    if (isOperandConstantInt(op1))
     
    760754        else if (rightOperand.isConst())
    761755            emitGetVirtualRegister(op2, rightRegs);
    762         ArithProfile* arithProfile = mathIC->arithProfile();
     756        BinaryArithProfile* arithProfile = mathIC->arithProfile();
    763757        if (arithProfile && shouldEmitProfiling())
    764758            callOperationWithResult(profiledFunction, resultRegs, TrustedImmPtr(m_codeBlock->globalObject()), leftRegs, rightRegs, arithProfile);
     
    800794#endif
    801795
    802     ArithProfile* arithProfile = mathIC->arithProfile();
     796    UnaryArithProfile* arithProfile = mathIC->arithProfile();
    803797    if (arithProfile && shouldEmitProfiling()) {
    804798        if (mathICGenerationState.shouldSlowPathRepatch)
     
    832826
    833827    auto bytecode = currentInstruction->as<Op>();
    834     OperandTypes types = getOperandTypes(copiedArithProfile(bytecode));
    835828    int result = bytecode.m_dst.offset();
    836829    int op1 = bytecode.m_lhs.offset();
     
    847840#endif
    848841   
    849     SnippetOperand leftOperand(types.first());
    850     SnippetOperand rightOperand(types.second());
     842    SnippetOperand leftOperand(bytecode.m_operandTypes.first());
     843    SnippetOperand rightOperand(bytecode.m_operandTypes.second());
    851844
    852845    if (isOperandConstantInt(op1))
     
    866859#endif
    867860
    868     ArithProfile* arithProfile = mathIC->arithProfile();
     861    BinaryArithProfile* arithProfile = mathIC->arithProfile();
    869862    if (arithProfile && shouldEmitProfiling()) {
    870863        if (mathICGenerationState.shouldSlowPathRepatch)
     
    894887{
    895888    auto bytecode = currentInstruction->as<OpDiv>();
    896     auto& metadata = bytecode.metadata(m_codeBlock);
    897889    int result = bytecode.m_dst.offset();
    898890    int op1 = bytecode.m_lhs.offset();
     
    900892
    901893#if USE(JSVALUE64)
    902     OperandTypes types = getOperandTypes(metadata.m_arithProfile);
    903894    JSValueRegs leftRegs = JSValueRegs(regT0);
    904895    JSValueRegs rightRegs = JSValueRegs(regT1);
     
    906897    GPRReg scratchGPR = regT2;
    907898#else
    908     OperandTypes types = getOperandTypes(metadata.m_arithProfile);
    909899    JSValueRegs leftRegs = JSValueRegs(regT1, regT0);
    910900    JSValueRegs rightRegs = JSValueRegs(regT3, regT2);
     
    914904    FPRReg scratchFPR = fpRegT2;
    915905
    916     ArithProfile* arithProfile = nullptr;
     906    BinaryArithProfile* arithProfile = nullptr;
    917907    if (shouldEmitProfiling())
    918908        arithProfile = &currentInstruction->as<OpDiv>().metadata(m_codeBlock).m_arithProfile;
    919909
    920     SnippetOperand leftOperand(types.first());
    921     SnippetOperand rightOperand(types.second());
     910    SnippetOperand leftOperand(bytecode.m_operandTypes.first());
     911    SnippetOperand rightOperand(bytecode.m_operandTypes.second());
    922912
    923913    if (isOperandConstantInt(op1))
     
    961951void JIT::emit_op_mul(const Instruction* currentInstruction)
    962952{
    963     ArithProfile* arithProfile = &currentInstruction->as<OpMul>().metadata(m_codeBlock).m_arithProfile;
     953    BinaryArithProfile* arithProfile = &currentInstruction->as<OpMul>().metadata(m_codeBlock).m_arithProfile;
    964954    JITMulIC* mulIC = m_codeBlock->addJITMulIC(arithProfile);
    965955    m_instructionToMathIC.add(currentInstruction, mulIC);
     
    977967void JIT::emit_op_sub(const Instruction* currentInstruction)
    978968{
    979     ArithProfile* arithProfile = &currentInstruction->as<OpSub>().metadata(m_codeBlock).m_arithProfile;
     969    BinaryArithProfile* arithProfile = &currentInstruction->as<OpSub>().metadata(m_codeBlock).m_arithProfile;
    980970    JITSubIC* subIC = m_codeBlock->addJITSubIC(arithProfile);
    981971    m_instructionToMathIC.add(currentInstruction, subIC);
  • trunk/Source/JavaScriptCore/jit/JITDivGenerator.cpp

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

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

    r252021 r252229  
    717717
    718718template<typename BinaryOp>
    719 ALWAYS_INLINE ArithProfile JIT::copiedArithProfile(BinaryOp bytecode)
     719ALWAYS_INLINE BinaryArithProfile JIT::copiedArithProfile(BinaryOp bytecode)
    720720{
    721721    uint64_t key = (static_cast<uint64_t>(BinaryOp::opcodeID) + 1) << 32 | static_cast<uint64_t>(bytecode.m_metadataID);
     
    723723    if (iterator != m_copiedArithProfiles.end())
    724724        return iterator->value;
    725     ArithProfile arithProfile = bytecode.metadata(m_codeBlock).m_arithProfile;
     725    BinaryArithProfile arithProfile = bytecode.metadata(m_codeBlock).m_arithProfile;
    726726    m_copiedArithProfiles.add(key, arithProfile);
    727727    return arithProfile;
  • trunk/Source/JavaScriptCore/jit/JITMathIC.h

    r252021 r252229  
    5353#define ENABLE_MATH_IC_STATS 0
    5454
    55 template <typename GeneratorType, bool(*isProfileEmpty)(ArithProfile&)>
     55template <typename GeneratorType, typename ArithProfileType>
    5656class JITMathIC {
    5757    WTF_MAKE_FAST_ALLOCATED;
    5858public:
    59     JITMathIC(ArithProfile* arithProfile)
     59    JITMathIC(ArithProfileType* arithProfile)
    6060        : m_arithProfile(arithProfile)
    6161    {
     
    7272
    7373        if (m_arithProfile) {
    74             if (isProfileEmpty(*m_arithProfile)) {
     74            if (m_arithProfile->isObservedTypeEmpty()) {
    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     ArithProfile* arithProfile() const { return m_arithProfile; }
     226    ArithProfileType* arithProfile() const { return m_arithProfile; }
    227227
    228228#if ENABLE(MATH_IC_STATS)
     
    237237#endif
    238238
    239     ArithProfile* m_arithProfile;
     239    ArithProfileType* m_arithProfile;
    240240    MacroAssemblerCodeRef<JITStubRoutinePtrTag> m_code;
    241241    CodeLocationLabel<JSInternalPtrTag> m_inlineStart;
     
    247247};
    248248
    249 inline bool isBinaryProfileEmpty(ArithProfile& arithProfile)
    250 {
    251     return arithProfile.lhsObservedType().isEmpty() || arithProfile.rhsObservedType().isEmpty();
    252 }
    253249template <typename GeneratorType>
    254 class JITBinaryMathIC : public JITMathIC<GeneratorType, isBinaryProfileEmpty> {
     250class JITBinaryMathIC : public JITMathIC<GeneratorType, BinaryArithProfile> {
    255251public:
    256     JITBinaryMathIC(ArithProfile* arithProfile)
    257         : JITMathIC<GeneratorType, isBinaryProfileEmpty>(arithProfile)
     252    JITBinaryMathIC(BinaryArithProfile* arithProfile)
     253        : JITMathIC<GeneratorType, BinaryArithProfile>(arithProfile)
    258254    {
    259255    }
     
    264260typedef JITBinaryMathIC<JITSubGenerator> JITSubIC;
    265261
    266 
    267 inline bool isUnaryProfileEmpty(ArithProfile& arithProfile)
    268 {
    269     return arithProfile.lhsObservedType().isEmpty();
    270 }
    271262template <typename GeneratorType>
    272 class JITUnaryMathIC : public JITMathIC<GeneratorType, isUnaryProfileEmpty> {
     263class JITUnaryMathIC : public JITMathIC<GeneratorType, UnaryArithProfile> {
    273264public:
    274     JITUnaryMathIC(ArithProfile* arithProfile)
    275         : JITMathIC<GeneratorType, isUnaryProfileEmpty>(arithProfile)
     265    JITUnaryMathIC(UnaryArithProfile* arithProfile)
     266        : JITMathIC<GeneratorType, UnaryArithProfile>(arithProfile)
    276267    {
    277268    }
  • trunk/Source/JavaScriptCore/jit/JITMulGenerator.cpp

    r252021 r252229  
    3434namespace JSC {
    3535
    36 JITMathICInlineResult JITMulGenerator::generateInline(CCallHelpers& jit, MathICGenerationState& state, const ArithProfile* arithProfile)
     36JITMathICInlineResult JITMulGenerator::generateInline(CCallHelpers& jit, MathICGenerationState& state, const BinaryArithProfile* arithProfile)
    3737{
    3838    // We default to speculating int32.
     
    9090}
    9191
    92 bool JITMulGenerator::generateFastPath(CCallHelpers& jit, CCallHelpers::JumpList& endJumpList, CCallHelpers::JumpList& slowPathJumpList, const ArithProfile* arithProfile, bool shouldEmitProfiling)
     92bool JITMulGenerator::generateFastPath(CCallHelpers& jit, CCallHelpers::JumpList& endJumpList, CCallHelpers::JumpList& slowPathJumpList, const BinaryArithProfile* 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(ArithProfile::NegZeroDouble), CCallHelpers::AbsoluteAddress(arithProfile->addressOfBits()));
     208        jit.or32(CCallHelpers::TrustedImm32(BinaryArithProfile::NegZeroDouble), CCallHelpers::AbsoluteAddress(arithProfile->addressOfBits()));
    209209        CCallHelpers::Jump done = jit.jump();
    210210
    211211        notNegativeZero.link(&jit);
    212         jit.or32(CCallHelpers::TrustedImm32(ArithProfile::NonNegZeroDouble), CCallHelpers::AbsoluteAddress(arithProfile->addressOfBits()));
     212        jit.or32(CCallHelpers::TrustedImm32(BinaryArithProfile::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(ArithProfile::Int52Overflow), CCallHelpers::AbsoluteAddress(arithProfile->addressOfBits()));
     219        jit.or32(CCallHelpers::TrustedImm32(BinaryArithProfile::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(ArithProfile::NegZeroDouble), CCallHelpers::AbsoluteAddress(arithProfile->addressOfBits()));
     230        jit.or32(CCallHelpers::TrustedImm32(BinaryArithProfile::NegZeroDouble), CCallHelpers::AbsoluteAddress(arithProfile->addressOfBits()));
    231231        CCallHelpers::Jump done = jit.jump();
    232232
    233233        notNegativeZero.link(&jit);
    234         jit.or32(CCallHelpers::TrustedImm32(ArithProfile::NonNegZeroDouble), CCallHelpers::AbsoluteAddress(arithProfile->addressOfBits()));
     234        jit.or32(CCallHelpers::TrustedImm32(BinaryArithProfile::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(ArithProfile::Int52Overflow), CCallHelpers::AbsoluteAddress(arithProfile->addressOfBits()));
     241        jit.or32(CCallHelpers::TrustedImm32(BinaryArithProfile::Int52Overflow), CCallHelpers::AbsoluteAddress(arithProfile->addressOfBits()));
    242242
    243243        endJumpList.append(noInt52Overflow);
  • trunk/Source/JavaScriptCore/jit/JITMulGenerator.h

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

    r252021 r252229  
    3333namespace JSC {
    3434
    35 JITMathICInlineResult JITNegGenerator::generateInline(CCallHelpers& jit, MathICGenerationState& state, const ArithProfile* arithProfile)
     35JITMathICInlineResult JITNegGenerator::generateInline(CCallHelpers& jit, MathICGenerationState& state, const UnaryArithProfile* arithProfile)
    3636{
    3737    ASSERT(m_scratchGPR != InvalidGPRReg);
     
    4646    ObservedType observedTypes = ObservedType().withInt32();
    4747    if (arithProfile)
    48         observedTypes = arithProfile->lhsObservedType();
     48        observedTypes = arithProfile->argObservedType();
    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 ArithProfile* arithProfile, bool shouldEmitProfiling)
     85bool JITNegGenerator::generateFastPath(CCallHelpers& jit, CCallHelpers::JumpList& endJumpList, CCallHelpers::JumpList& slowPathJumpList, const UnaryArithProfile* 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->lhsObservedType().sawNumber() && !arithProfile->didObserveDouble())
     120    if (shouldEmitProfiling && arithProfile && !arithProfile->argObservedType().sawNumber() && !arithProfile->didObserveDouble())
    121121        arithProfile->emitSetDouble(jit);
    122122    return true;
  • trunk/Source/JavaScriptCore/jit/JITNegGenerator.h

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

    r252030 r252229  
    26462646}
    26472647
    2648 ALWAYS_INLINE static JSValue profiledAdd(JSGlobalObject* globalObject, JSValue op1, JSValue op2, ArithProfile& arithProfile)
     2648ALWAYS_INLINE static JSValue profiledAdd(JSGlobalObject* globalObject, JSValue op1, JSValue op2, BinaryArithProfile& arithProfile)
    26492649{
    26502650    arithProfile.observeLHSAndRHS(op1, op2);
     
    26622662}
    26632663
    2664 EncodedJSValue JIT_OPERATION operationValueAddProfiled(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile* arithProfile)
     2664EncodedJSValue JIT_OPERATION operationValueAddProfiled(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, BinaryArithProfile* arithProfile)
    26652665{
    26662666    ASSERT(arithProfile);
     
    26802680    JSValue op2 = JSValue::decode(encodedOp2);
    26812681
    2682     ArithProfile* arithProfile = addIC->arithProfile();
     2682    BinaryArithProfile* arithProfile = addIC->arithProfile();
    26832683    ASSERT(arithProfile);
    26842684    arithProfile->observeLHSAndRHS(op1, op2);
     
    27022702    JITOperationPrologueCallFrameTracer tracer(vm, callFrame);
    27032703
    2704     ArithProfile* arithProfile = addIC->arithProfile();
     2704    BinaryArithProfile* arithProfile = addIC->arithProfile();
    27052705    ASSERT(arithProfile);
    27062706    return JSValue::encode(profiledAdd(globalObject, JSValue::decode(encodedOp1), JSValue::decode(encodedOp2), *arithProfile));
     
    27172717
    27182718    auto nonOptimizeVariant = operationValueAddNoOptimize;
    2719     if (ArithProfile* arithProfile = addIC->arithProfile())
     2719    if (BinaryArithProfile* arithProfile = addIC->arithProfile())
    27202720        arithProfile->observeLHSAndRHS(op1, op2);
    27212721    addIC->generateOutOfLine(callFrame->codeBlock(), nonOptimizeVariant);
     
    27502750}
    27512751
    2752 ALWAYS_INLINE static EncodedJSValue profiledMul(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile& arithProfile, bool shouldObserveLHSAndRHSTypes = true)
     2752ALWAYS_INLINE static EncodedJSValue profiledMul(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, BinaryArithProfile& arithProfile, bool shouldObserveLHSAndRHSTypes = true)
    27532753{
    27542754    VM& vm = globalObject->vm();
     
    27912791
    27922792    auto nonOptimizeVariant = operationValueMulNoOptimize;
    2793     if (ArithProfile* arithProfile = mulIC->arithProfile())
     2793    if (BinaryArithProfile* arithProfile = mulIC->arithProfile())
    27942794        arithProfile->observeLHSAndRHS(JSValue::decode(encodedOp1), JSValue::decode(encodedOp2));
    27952795    mulIC->generateOutOfLine(callFrame->codeBlock(), nonOptimizeVariant);
     
    28022802}
    28032803
    2804 EncodedJSValue JIT_OPERATION operationValueMulProfiled(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile* arithProfile)
     2804EncodedJSValue JIT_OPERATION operationValueMulProfiled(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, BinaryArithProfile* arithProfile)
    28052805{
    28062806    VM& vm = globalObject->vm();
     
    28182818    JITOperationPrologueCallFrameTracer tracer(vm, callFrame);
    28192819
    2820     ArithProfile* arithProfile = mulIC->arithProfile();
     2820    BinaryArithProfile* arithProfile = mulIC->arithProfile();
    28212821    ASSERT(arithProfile);
    28222822    arithProfile->observeLHSAndRHS(JSValue::decode(encodedOp1), JSValue::decode(encodedOp2));
     
    28372837    JITOperationPrologueCallFrameTracer tracer(vm, callFrame);
    28382838
    2839     ArithProfile* arithProfile = mulIC->arithProfile();
     2839    BinaryArithProfile* arithProfile = mulIC->arithProfile();
    28402840    ASSERT(arithProfile);
    28412841    return profiledMul(globalObject, encodedOp1, encodedOp2, *arithProfile);
     
    28632863}
    28642864
    2865 EncodedJSValue JIT_OPERATION operationArithNegateProfiled(JSGlobalObject* globalObject, EncodedJSValue encodedOperand, ArithProfile* arithProfile)
     2865EncodedJSValue JIT_OPERATION operationArithNegateProfiled(JSGlobalObject* globalObject, EncodedJSValue encodedOperand, UnaryArithProfile* arithProfile)
    28662866{
    28672867    ASSERT(arithProfile);
     
    28722872
    28732873    JSValue operand = JSValue::decode(encodedOperand);
    2874     arithProfile->observeLHS(operand);
     2874    arithProfile->observeArg(operand);
    28752875
    28762876    JSValue primValue = operand.toPrimitive(globalObject);
     
    29002900    JSValue operand = JSValue::decode(encodedOperand);
    29012901
    2902     ArithProfile* arithProfile = negIC->arithProfile();
     2902    UnaryArithProfile* arithProfile = negIC->arithProfile();
    29032903    ASSERT(arithProfile);
    2904     arithProfile->observeLHS(operand);
     2904    arithProfile->observeArg(operand);
    29052905    negIC->generateOutOfLine(callFrame->codeBlock(), operationArithNegateProfiled);
    29062906
     
    29342934    JSValue operand = JSValue::decode(encodedOperand);
    29352935
    2936     if (ArithProfile* arithProfile = negIC->arithProfile())
    2937         arithProfile->observeLHS(operand);
     2936    if (UnaryArithProfile* arithProfile = negIC->arithProfile())
     2937        arithProfile->observeArg(operand);
    29382938    negIC->generateOutOfLine(callFrame->codeBlock(), operationArithNegate);
    29392939
     
    29612961}
    29622962
    2963 ALWAYS_INLINE static EncodedJSValue profiledSub(VM& vm, JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile& arithProfile, bool shouldObserveLHSAndRHSTypes = true)
     2963ALWAYS_INLINE static EncodedJSValue profiledSub(VM& vm, JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, BinaryArithProfile& arithProfile, bool shouldObserveLHSAndRHSTypes = true)
    29642964{
    29652965    auto scope = DECLARE_THROW_SCOPE(vm);
     
    29852985}
    29862986
    2987 EncodedJSValue JIT_OPERATION operationValueSubProfiled(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile* arithProfile)
     2987EncodedJSValue JIT_OPERATION operationValueSubProfiled(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, BinaryArithProfile* arithProfile)
    29882988{
    29892989    ASSERT(arithProfile);
     
    30033003
    30043004    auto nonOptimizeVariant = operationValueSubNoOptimize;
    3005     if (ArithProfile* arithProfile = subIC->arithProfile())
     3005    if (BinaryArithProfile* arithProfile = subIC->arithProfile())
    30063006        arithProfile->observeLHSAndRHS(JSValue::decode(encodedOp1), JSValue::decode(encodedOp2));
    30073007    subIC->generateOutOfLine(callFrame->codeBlock(), nonOptimizeVariant);
     
    30293029    JITOperationPrologueCallFrameTracer tracer(vm, callFrame);
    30303030
    3031     ArithProfile* arithProfile = subIC->arithProfile();
     3031    BinaryArithProfile* arithProfile = subIC->arithProfile();
    30323032    ASSERT(arithProfile);
    30333033    arithProfile->observeLHSAndRHS(JSValue::decode(encodedOp1), JSValue::decode(encodedOp2));
     
    30483048    JITOperationPrologueCallFrameTracer tracer(vm, callFrame);
    30493049
    3050     ArithProfile* arithProfile = subIC->arithProfile();
     3050    BinaryArithProfile* arithProfile = subIC->arithProfile();
    30513051    ASSERT(arithProfile);
    30523052    return profiledSub(vm, globalObject, encodedOp1, encodedOp2, *arithProfile);
  • trunk/Source/JavaScriptCore/jit/JITOperations.h

    r252021 r252229  
    3939class ArrayAllocationProfile;
    4040class ArrayProfile;
     41class UnaryArithProfile;
     42class BinaryArithProfile;
    4143class Butterfly;
    4244class CallFrame;
     
    6567struct InlineCallFrame;
    6668struct Instruction;
    67 struct ArithProfile;
    6869
    6970extern "C" {
     
    7879    Aap: ArrayAllocationProfile*
    7980    Ap: ArrayProfile*
    80     Arp: ArithProfile*
     81    Arp: BinaryArithProfile*
    8182    B: Butterfly*
    8283    By: ByValInfo*
     
    283284
    284285EncodedJSValue JIT_OPERATION operationValueAdd(JSGlobalObject*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL;
    285 EncodedJSValue JIT_OPERATION operationValueAddProfiled(JSGlobalObject*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile*) WTF_INTERNAL;
     286EncodedJSValue JIT_OPERATION operationValueAddProfiled(JSGlobalObject*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, BinaryArithProfile*) WTF_INTERNAL;
    286287EncodedJSValue JIT_OPERATION operationValueAddProfiledOptimize(JSGlobalObject*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITAddIC*) WTF_INTERNAL;
    287288EncodedJSValue JIT_OPERATION operationValueAddProfiledNoOptimize(JSGlobalObject*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITAddIC*) WTF_INTERNAL;
     
    293294EncodedJSValue JIT_OPERATION operationValueMulProfiledOptimize(JSGlobalObject*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITMulIC*) WTF_INTERNAL;
    294295EncodedJSValue JIT_OPERATION operationValueMulProfiledNoOptimize(JSGlobalObject*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITMulIC*) WTF_INTERNAL;
    295 EncodedJSValue JIT_OPERATION operationValueMulProfiled(JSGlobalObject*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile*) WTF_INTERNAL;
     296EncodedJSValue JIT_OPERATION operationValueMulProfiled(JSGlobalObject*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, BinaryArithProfile*) WTF_INTERNAL;
    296297EncodedJSValue JIT_OPERATION operationArithNegate(JSGlobalObject*, EncodedJSValue operand);
    297 EncodedJSValue JIT_OPERATION operationArithNegateProfiled(JSGlobalObject*, EncodedJSValue operand, ArithProfile*);
     298EncodedJSValue JIT_OPERATION operationArithNegateProfiled(JSGlobalObject*, EncodedJSValue operand, UnaryArithProfile*);
    298299EncodedJSValue JIT_OPERATION operationArithNegateProfiledOptimize(JSGlobalObject*, EncodedJSValue encodedOperand, JITNegIC*);
    299300EncodedJSValue JIT_OPERATION operationArithNegateOptimize(JSGlobalObject*, EncodedJSValue encodedOperand, JITNegIC*);
    300301EncodedJSValue JIT_OPERATION operationValueSub(JSGlobalObject*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL;
    301 EncodedJSValue JIT_OPERATION operationValueSubProfiled(JSGlobalObject*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile*) WTF_INTERNAL;
     302EncodedJSValue JIT_OPERATION operationValueSubProfiled(JSGlobalObject*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, BinaryArithProfile*) WTF_INTERNAL;
    302303EncodedJSValue JIT_OPERATION operationValueSubOptimize(JSGlobalObject*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITSubIC*) WTF_INTERNAL;
    303304EncodedJSValue JIT_OPERATION operationValueSubNoOptimize(JSGlobalObject*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITSubIC*) WTF_INTERNAL;
  • trunk/Source/JavaScriptCore/jit/JITSubGenerator.cpp

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

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

    r252021 r252229  
    148148
    149149    {
    150         ArithProfile arithProfile;
     150        UnaryArithProfile arithProfile;
     151        arithProfile.argSawInt32();
     152        ASSERT(arithProfile.bits() == UnaryArithProfile::observedIntBits());
     153        ASSERT(arithProfile.argObservedType().isOnlyInt32());
     154    }
     155    {
     156        UnaryArithProfile arithProfile;
     157        arithProfile.argSawNumber();
     158        ASSERT(arithProfile.bits() == UnaryArithProfile::observedNumberBits());
     159        ASSERT(arithProfile.argObservedType().isOnlyNumber());
     160    }
     161
     162    {
     163        BinaryArithProfile arithProfile;
    151164        arithProfile.lhsSawInt32();
    152165        arithProfile.rhsSawInt32();
    153         ASSERT(arithProfile.bits() == ArithProfile::observedBinaryIntInt().bits());
    154         STATIC_ASSERT(ArithProfile::observedBinaryIntInt().lhsObservedType().isOnlyInt32());
    155         STATIC_ASSERT(ArithProfile::observedBinaryIntInt().rhsObservedType().isOnlyInt32());
     166        ASSERT(arithProfile.bits() == BinaryArithProfile::observedIntIntBits());
     167        ASSERT(arithProfile.lhsObservedType().isOnlyInt32());
     168        ASSERT(arithProfile.rhsObservedType().isOnlyInt32());
    156169    }
    157170    {
    158         ArithProfile arithProfile;
     171        BinaryArithProfile arithProfile;
    159172        arithProfile.lhsSawNumber();
    160173        arithProfile.rhsSawInt32();
    161         ASSERT(arithProfile.bits() == ArithProfile::observedBinaryNumberInt().bits());
    162         STATIC_ASSERT(ArithProfile::observedBinaryNumberInt().lhsObservedType().isOnlyNumber());
    163         STATIC_ASSERT(ArithProfile::observedBinaryNumberInt().rhsObservedType().isOnlyInt32());
     174        ASSERT(arithProfile.bits() == BinaryArithProfile::observedNumberIntBits());
     175        ASSERT(arithProfile.lhsObservedType().isOnlyNumber());
     176        ASSERT(arithProfile.rhsObservedType().isOnlyInt32());
    164177    }
    165178    {
    166         ArithProfile arithProfile;
     179        BinaryArithProfile arithProfile;
    167180        arithProfile.lhsSawNumber();
    168181        arithProfile.rhsSawNumber();
    169         ASSERT(arithProfile.bits() == ArithProfile::observedBinaryNumberNumber().bits());
    170         STATIC_ASSERT(ArithProfile::observedBinaryNumberNumber().lhsObservedType().isOnlyNumber());
    171         STATIC_ASSERT(ArithProfile::observedBinaryNumberNumber().rhsObservedType().isOnlyNumber());
     182        ASSERT(arithProfile.bits() == BinaryArithProfile::observedNumberNumberBits());
     183        ASSERT(arithProfile.lhsObservedType().isOnlyNumber());
     184        ASSERT(arithProfile.rhsObservedType().isOnlyNumber());
    172185    }
    173186    {
    174         ArithProfile arithProfile;
     187        BinaryArithProfile arithProfile;
    175188        arithProfile.lhsSawInt32();
    176189        arithProfile.rhsSawNumber();
    177         ASSERT(arithProfile.bits() == ArithProfile::observedBinaryIntNumber().bits());
    178         STATIC_ASSERT(ArithProfile::observedBinaryIntNumber().lhsObservedType().isOnlyInt32());
    179         STATIC_ASSERT(ArithProfile::observedBinaryIntNumber().rhsObservedType().isOnlyNumber());
     190        ASSERT(arithProfile.bits() == BinaryArithProfile::observedIntNumberBits());
     191        ASSERT(arithProfile.lhsObservedType().isOnlyInt32());
     192        ASSERT(arithProfile.rhsObservedType().isOnlyNumber());
    180193    }
    181194}
  • trunk/Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp

    r252021 r252229  
    9292const int64_t* LLIntOffsetsExtractor::dummy()
    9393{
    94 // This is a file generated by offlineasm/generate_offsets_extractor.rb, and contains code
     94// This is a file generated by offlineasm/generate_offset_extractor.rb, and contains code
    9595// to create a table of offsets, sizes, and a header identifying what combination of
    9696// Platform.h macros we have set. We include it inside of a method on LLIntOffsetsExtractor
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm

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

    r252032 r252229  
    10011001llintOpWithMetadata(op_negate, OpNegate, macro (size, get, dispatch, metadata, return)
    10021002
    1003     macro arithProfile(type)
    1004         ori type, OpNegate::Metadata::m_arithProfile + ArithProfile::m_bits[t5]
     1003    macro updateArithProfile(type)
     1004        orh type, OpNegate::Metadata::m_arithProfile + UnaryArithProfile::m_bits[t5]
    10051005    end
    10061006
     
    10111011    btiz t2, 0x7fffffff, .opNegateSlow
    10121012    negi t2
    1013     arithProfile(ArithProfileInt)
     1013    updateArithProfile(ArithProfileInt)
    10141014    return (Int32Tag, t2)
    10151015.opNegateSrcNotInt:
    10161016    bia t1, LowestTag, .opNegateSlow
    10171017    xori 0x80000000, t1
    1018     arithProfile(ArithProfileNumber)
     1018    updateArithProfile(ArithProfileNumber)
    10191019    return(t1, t2)
    10201020
     
    10281028    llintOpWithMetadata(op_%opcodeName%, opcodeStruct, macro (size, get, dispatch, metadata, return)
    10291029        macro arithProfile(type)
    1030             ori type, %opcodeStruct%::Metadata::m_arithProfile + ArithProfile::m_bits[t5]
     1030            orh type, %opcodeStruct%::Metadata::m_arithProfile + BinaryArithProfile::m_bits[t5]
    10311031        end
    10321032
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm

    r252032 r252229  
    982982
    983983llintOpWithMetadata(op_negate, OpNegate, macro (size, get, dispatch, metadata, return)
     984
     985    macro updateArithProfile(type)
     986        orh type, OpNegate::Metadata::m_arithProfile + UnaryArithProfile::m_bits[t1]
     987    end
     988
    984989    get(m_operand, t0)
    985990    loadConstantOrVariable(size, t0, t3)
    986991    metadata(t1, t2)
    987     loadi OpNegate::Metadata::m_arithProfile + ArithProfile::m_bits[t1], t2
    988992    bqb t3, numberTag, .opNegateNotInt
    989993    btiz t3, 0x7fffffff, .opNegateSlow
    990994    negi t3
    991995    orq numberTag, t3
    992     ori ArithProfileInt, t2
    993     storei t2, OpNegate::Metadata::m_arithProfile + ArithProfile::m_bits[t1]
     996    updateArithProfile(ArithProfileInt)
    994997    return(t3)
    995998.opNegateNotInt:
    996999    btqz t3, numberTag, .opNegateSlow
    9971000    xorq 0x8000000000000000, t3
    998     ori ArithProfileNumber, t2
    999     storei t2, OpNegate::Metadata::m_arithProfile + ArithProfile::m_bits[t1]
     1001    updateArithProfile(ArithProfileNumber)
    10001002    return(t3)
    10011003
     
    10111013
    10121014        macro profile(type)
    1013             ori type, %opcodeStruct%::Metadata::m_arithProfile + ArithProfile::m_bits[t5]
     1015            orh type, %opcodeStruct%::Metadata::m_arithProfile + UnaryArithProfile::m_bits[t5]
    10141016        end
    10151017
  • trunk/Source/JavaScriptCore/offlineasm/arm.rb

    r252021 r252229  
    300300        }
    301301        result = riscLowerMalformedAddressesDouble(result)
    302         result = riscLowerMisplacedImmediates(result, ["storeb", "storei", "storep", "storeq"])
     302        result = riscLowerMisplacedImmediates(result, ["storeb", "storeh", "storei", "storep", "storeq"])
    303303        result = riscLowerMalformedImmediates(result, 0..0xff, 0..0x0ff)
    304304        result = riscLowerMisplacedAddresses(result)
     
    419419        when "andi", "andp"
    420420            emitArmCompact("ands", "and", operands)
    421         when "ori", "orp"
     421        when "ori", "orp", "orh"
    422422            emitArmCompact("orrs", "orr", operands)
    423423        when "oris"
  • trunk/Source/JavaScriptCore/offlineasm/arm64.rb

    r252021 r252229  
    394394            when "loadb", "loadbsi", "loadbsq", "storeb", /^bb/, /^btb/, /^cb/, /^tb/
    395395                size = 1
    396             when "loadh", "loadhsi", "loadhsq", "storeh"
     396            when "loadh", "loadhsi", "loadhsq", "orh", "storeh"
    397397                size = 2
    398398            when "loadi", "loadis", "storei", "addi", "andi", "lshifti", "muli", "negi",
     
    419419        }
    420420
    421         result = riscLowerMisplacedImmediates(result, ["storeb", "storei", "storep", "storeq"])
     421        result = riscLowerMisplacedImmediates(result, ["storeb", "storeh", "storei", "storep", "storeq"])
    422422
    423423        # The rules for which immediates are valid for and/or/xor instructions are fairly involved, see https://dinfuehr.github.io/blog/encoding-of-immediate-values-on-aarch64/
     
    712712        when "orq"
    713713            emitARM64TAC("orr", operands, :quad)
     714        when "orh"
     715            emitARM64TAC("orr", operands, :word) # not :half because 16-bit registers don't exist on ARM.
    714716        when "xori"
    715717            emitARM64TAC("eor", operands, :word)
  • trunk/Source/JavaScriptCore/offlineasm/cloop.rb

    r252021 r252229  
    161161        case type
    162162        when :int8;    "int8_t(#{valueStr})"
     163        when :int16;   "int16_t(#{valueStr})"
    163164        when :int32;   "int32_t(#{valueStr})"
    164165        when :int64;   "int64_t(#{valueStr})"
     
    184185        case type
    185186        when :int8;         int8MemRef
     187        when :int16;        int16MemRef
    186188        when :int32;        int32MemRef
    187189        when :int64;        int64MemRef
     
    387389def cloopEmitOperation(operands, type, operator)
    388390    raise unless type == :intptr || type == :uintptr || type == :int32 || type == :uint32 || \
    389         type == :int64 || type == :uint64 || type == :double
     391        type == :int64 || type == :uint64 || type == :double || type == :int16
    390392    if operands.size == 3
    391393        op1 = operands[0]
     
    401403    if dst.is_a? RegisterID and (type == :int32 or type == :uint32)
    402404        truncationHeader = "(uint32_t)("
     405        truncationFooter = ")"
     406    elsif dst.is_a? RegisterID and (type == :int16)
     407        truncationHeader = "(uint16_t)("
    403408        truncationFooter = ")"
    404409    else
     
    586591        when "orp"
    587592            cloopEmitOperation(operands, :intptr, "|")
     593        when "orh"
     594            cloopEmitOperation(operands, :int16, "|")
    588595
    589596        when "xori"
  • trunk/Source/JavaScriptCore/offlineasm/instructions.rb

    r252021 r252229  
    4747     "orf",
    4848     "ord",
     49     "orh",
    4950     "rshifti",
    5051     "urshifti",
  • trunk/Source/JavaScriptCore/offlineasm/mips.rb

    r252021 r252229  
    528528            when /^(addi|subi)/
    529529                newList << node.riscLowerMalformedImmediatesRecurse(newList, -0x7fff..0x7fff)
    530             when "andi", "andp", "ori", "orp", "xori", "xorp"
     530            when "andi", "andp", "ori", "orp", "orh", "xori", "xorp"
    531531                newList << node.riscLowerMalformedImmediatesRecurse(newList, 0..0xffff)
    532532            else
     
    861861        when "andi", "andp"
    862862            emitMIPSCompact("and", "and", operands)
    863         when "ori", "orp"
     863        when "ori", "orp", "orh"
    864864            emitMIPSCompact("or", "orr", operands)
    865865        when "oris"
  • trunk/Source/JavaScriptCore/offlineasm/risc.rb

    r252021 r252229  
    463463            annotation = node.annotation
    464464            case node.opcode
    465             when "addi", "addis", "andi", "lshifti", "muli", "negi", "noti", "ori", "oris",
     465            when "addi", "addis", "andi", "lshifti", "muli", "negi", "noti", "ori", "orh", "oris",
    466466                "rshifti", "urshifti", "subi", "subis", "xori", /^bi/, /^bti/, /^ci/, /^ti/
    467467                newList << Instruction.new(node.codeOrigin,
  • trunk/Source/JavaScriptCore/offlineasm/x86.rb

    r252021 r252229  
    11241124        when "ord"
    11251125            handleX86Op("orpd", :double)
     1126        when "orh"
     1127            handleX86Op("or#{x86Suffix(:half)}", :half)
    11261128        when "rshifti"
    11271129            handleX86Shift("sar#{x86Suffix(:int)}", :int)
  • trunk/Source/JavaScriptCore/parser/ResultType.h

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

    r252030 r252229  
    478478static void updateArithProfileForUnaryArithOp(OpNegate::Metadata& metadata, JSValue result, JSValue operand)
    479479{
    480     ArithProfile& profile = metadata.m_arithProfile;
    481     profile.observeLHS(operand);
     480    UnaryArithProfile& profile = metadata.m_arithProfile;
     481    profile.observeArg(operand);
    482482    ASSERT(result.isNumber() || result.isBigInt());
    483483    if (result.isNumber()) {
     
    536536static void updateArithProfileForBinaryArithOp(JSGlobalObject*, CodeBlock* codeBlock, const Instruction* pc, JSValue result, JSValue left, JSValue right)
    537537{
    538     ArithProfile& profile = *codeBlock->arithProfileForPC(pc);
     538    BinaryArithProfile& profile = *codeBlock->binaryArithProfileForPC(pc);
    539539
    540540    if (result.isNumber()) {
     
    597597    JSValue v2 = GET_C(bytecode.m_rhs).jsValue();
    598598
    599     ArithProfile& arithProfile = *codeBlock->arithProfileForPC(pc);
     599    BinaryArithProfile& arithProfile = *codeBlock->binaryArithProfileForPC(pc);
    600600    arithProfile.observeLHSAndRHS(v1, v2);
    601601
Note: See TracChangeset for help on using the changeset viewer.