Changeset 252422 in webkit for trunk/Source/JavaScriptCore/bytecode/ArithProfile.cpp
- Timestamp:
- Nov 13, 2019, 12:07:29 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/bytecode/ArithProfile.cpp
r252273 r252422 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 { 63 uint32_t mask = ArithProfile::Int32Overflow | ArithProfile::Int52Overflow | ArithProfile::NegZeroDouble | ArithProfile::NonNegZeroDouble; 62 template<typename BitfieldType> 63 bool ArithProfile<BitfieldType>::shouldEmitSetDouble() const 64 { 65 BitfieldType 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())); 71 } 72 73 bool ArithProfile::shouldEmitSetNonNumeric() const 74 { 75 uint32_t mask = ArithProfile::NonNumeric; 73 emitUnconditionalSet(jit, Int32Overflow | Int52Overflow | NegZeroDouble | NonNegZeroDouble); 74 } 75 76 template<typename BitfieldType> 77 bool ArithProfile<BitfieldType>::shouldEmitSetNonNumeric() const 78 { 79 BitfieldType mask = ArithProfile::NonNumeric; 76 80 return (m_bits & mask) != mask; 77 81 } 78 82 79 bool ArithProfile::shouldEmitSetBigInt() const 80 { 81 uint32_t mask = ArithProfile::BigInt; 83 template<typename BitfieldType> 84 void ArithProfile<BitfieldType>::emitSetNonNumeric(CCallHelpers& jit) const 85 { 86 if (shouldEmitSetNonNumeric()) 87 emitUnconditionalSet(jit, NonNumeric); 88 } 89 90 template<typename BitfieldType> 91 bool ArithProfile<BitfieldType>::shouldEmitSetBigInt() const 92 { 93 BitfieldType mask = ArithProfile::BigInt; 82 94 return (m_bits & mask) != mask; 83 95 } 84 96 85 void ArithProfile::emitSetNonNumeric(CCallHelpers& jit) const 86 { 87 if (shouldEmitSetNonNumeric()) 88 jit.or32(CCallHelpers::TrustedImm32(ArithProfile::NonNumeric), CCallHelpers::AbsoluteAddress(addressOfBits())); 89 } 90 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())); 95 } 101 emitUnconditionalSet(jit, BigInt); 102 } 103 104 template<typename BitfieldType> 105 void ArithProfile<BitfieldType>::emitUnconditionalSet(CCallHelpers& jit, BitfieldType mask) const 106 { 107 static_assert(std::is_same<BitfieldType, uint16_t>::value); 108 jit.or16(CCallHelpers::TrustedImm32(mask), CCallHelpers::AbsoluteAddress(addressOfBits())); 109 } 110 111 // Generate the implementations of the functions above for UnaryArithProfile/BinaryArithProfile 112 // If changing the size of either, add the corresponding lines here. 113 template class ArithProfile<uint16_t>; 96 114 #endif // ENABLE(JIT) 97 115 … … 102 120 using namespace JSC; 103 121 104 void printInternal(PrintStream& out, const ArithProfile& profile) 122 template <typename T> 123 void printInternal(PrintStream& out, const ArithProfile<T>& profile) 105 124 { 106 125 const char* separator = ""; … … 136 155 } 137 156 } 157 out.print(">"); 158 } 159 160 void printInternal(PrintStream& out, const UnaryArithProfile& profile) 161 { 162 printInternal(out, static_cast<ArithProfile<UnaryArithProfileBase>>(profile)); 163 164 out.print(" Arg ObservedType:<"); 165 out.print(profile.argObservedType()); 166 out.print(">"); 167 } 168 169 void printInternal(PrintStream& out, const BinaryArithProfile& profile) 170 { 171 printInternal(out, static_cast<ArithProfile<UnaryArithProfileBase>>(profile)); 172 138 173 if (profile.tookSpecialFastPath()) 139 out.print(separator, "Took special fast path."); 140 out.print(">"); 174 out.print(" Took special fast path."); 141 175 142 176 out.print(" LHS ObservedType:<"); … … 145 179 out.print(profile.rhsObservedType()); 146 180 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 out.print(">");151 181 } 152 182
Note:
See TracChangeset
for help on using the changeset viewer.