Changeset 252015 in webkit for trunk/Source/JavaScriptCore/bytecode/ArithProfile.cpp
- Timestamp:
- Nov 4, 2019, 2:20:37 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/bytecode/ArithProfile.cpp
r251106 r252015 33 33 34 34 #if ENABLE(JIT) 35 void ArithProfile::emitObserveResult(CCallHelpers& jit, JSValueRegs regs, TagRegistersMode mode) 35 template<typename BitfieldType> 36 void ArithProfile<BitfieldType>::emitObserveResult(CCallHelpers& jit, JSValueRegs regs, TagRegistersMode mode) 36 37 { 37 38 if (!shouldEmitSetDouble() && !shouldEmitSetNonNumeric() && !shouldEmitSetBigInt()) … … 59 60 } 60 61 61 bool ArithProfile::shouldEmitSetDouble() const 62 template<typename BitfieldType> 63 bool ArithProfile<BitfieldType>::shouldEmitSetDouble() const 62 64 { 63 uint32_t mask = ArithProfile::Int32Overflow | ArithProfile::Int52Overflow | ArithProfile::NegZeroDouble | ArithProfile::NonNegZeroDouble;65 uint32_t mask = Int32Overflow | Int52Overflow | NegZeroDouble | NonNegZeroDouble; 64 66 return (m_bits & mask) != mask; 65 67 } 66 68 67 void ArithProfile::emitSetDouble(CCallHelpers& jit) const 69 template<typename BitfieldType> 70 void ArithProfile<BitfieldType>::emitSetDouble(CCallHelpers& jit) const 68 71 { 69 72 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())); 71 74 } 72 75 73 bool ArithProfile::shouldEmitSetNonNumeric() const 76 template<typename BitfieldType> 77 bool ArithProfile<BitfieldType>::shouldEmitSetNonNumeric() const 74 78 { 75 79 uint32_t mask = ArithProfile::NonNumeric; … … 77 81 } 78 82 79 bool ArithProfile::shouldEmitSetBigInt() const 83 template<typename BitfieldType> 84 bool ArithProfile<BitfieldType>::shouldEmitSetBigInt() const 80 85 { 81 86 uint32_t mask = ArithProfile::BigInt; … … 83 88 } 84 89 85 void ArithProfile::emitSetNonNumeric(CCallHelpers& jit) const 90 template<typename BitfieldType> 91 void ArithProfile<BitfieldType>::emitSetNonNumeric(CCallHelpers& jit) const 86 92 { 87 93 if (shouldEmitSetNonNumeric()) 88 jit.or32(CCallHelpers::TrustedImm32( ArithProfile::NonNumeric), CCallHelpers::AbsoluteAddress(addressOfBits()));94 jit.or32(CCallHelpers::TrustedImm32(NonNumeric), CCallHelpers::AbsoluteAddress(addressOfBits())); 89 95 } 90 96 91 void ArithProfile::emitSetBigInt(CCallHelpers& jit) const 97 template<typename BitfieldType> 98 void ArithProfile<BitfieldType>::emitSetBigInt(CCallHelpers& jit) const 92 99 { 93 100 if (shouldEmitSetBigInt()) 94 jit.or32(CCallHelpers::TrustedImm32( ArithProfile::BigInt), CCallHelpers::AbsoluteAddress(addressOfBits()));101 jit.or32(CCallHelpers::TrustedImm32(BigInt), CCallHelpers::AbsoluteAddress(addressOfBits())); 95 102 } 103 104 // Generate the implementations of the functions above for UnaryArithProfile/BinaryArithProfile 105 // If changing the size of either, add the corresponding lines here. 106 template class ArithProfile<uint16_t>; 96 107 #endif // ENABLE(JIT) 97 108 … … 102 113 using namespace JSC; 103 114 104 void printInternal(PrintStream& out, const ArithProfile& profile) 115 template <typename T> 116 void printInternal(PrintStream& out, const ArithProfile<T>& profile) 105 117 { 106 118 const char* separator = ""; … … 136 148 } 137 149 } 150 out.print(">"); 151 } 152 153 void 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 162 void printInternal(PrintStream& out, const BinaryArithProfile& profile) 163 { 164 printInternal(out, static_cast<ArithProfile<UnaryArithProfileBase>>(profile)); 165 138 166 if (profile.tookSpecialFastPath()) 139 out.print(separator, "Took special fast path."); 140 out.print(">"); 167 out.print(" Took special fast path."); 141 168 142 169 out.print(" LHS ObservedType:<"); … … 144 171 out.print("> RHS ObservedType:<"); 145 172 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()))));150 173 out.print(">"); 151 174 }
Note:
See TracChangeset
for help on using the changeset viewer.