Changeset 251090 in webkit for trunk/Source/JavaScriptCore/bytecode/ArithProfile.cpp
- Timestamp:
- Oct 14, 2019, 1:28:41 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/bytecode/ArithProfile.cpp
r237972 r251090 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 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())); 71 } 72 73 bool ArithProfile::shouldEmitSetNonNumeric() const 73 jit.or32(CCallHelpers::TrustedImm32(Int32Overflow | Int52Overflow | NegZeroDouble | NonNegZeroDouble), CCallHelpers::AbsoluteAddress(addressOfBits())); 74 } 75 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())); 89 } 90 91 void ArithProfile::emitSetBigInt(CCallHelpers& jit) const 94 jit.or32(CCallHelpers::TrustedImm32(NonNumeric), CCallHelpers::AbsoluteAddress(addressOfBits())); 95 } 96 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 jit.or32(CCallHelpers::TrustedImm32(BigInt), CCallHelpers::AbsoluteAddress(addressOfBits())); 102 } 103 104 template class ArithProfile<uint16_t>; // Generate the implementations for UnaryArithProfile 105 template class ArithProfile<uint32_t>; // Generate the implementations for BinaryArithProfile 96 106 #endif // ENABLE(JIT) 97 107 … … 102 112 using namespace JSC; 103 113 104 void printInternal(PrintStream& out, const ArithProfile& profile) 114 void printInternal(PrintStream& out, const UnaryArithProfile& profile) 115 { 116 const char* separator = ""; 117 118 out.print("Result:<"); 119 if (!profile.didObserveNonInt32()) { 120 out.print("Int32"); 121 separator = "|"; 122 } else { 123 if (profile.didObserveNegZeroDouble()) { 124 out.print(separator, "NegZeroDouble"); 125 separator = "|"; 126 } 127 if (profile.didObserveNonNegZeroDouble()) { 128 out.print(separator, "NonNegZeroDouble"); 129 separator = "|"; 130 } 131 if (profile.didObserveNonNumeric()) { 132 out.print(separator, "NonNumeric"); 133 separator = "|"; 134 } 135 if (profile.didObserveInt32Overflow()) { 136 out.print(separator, "Int32Overflow"); 137 separator = "|"; 138 } 139 if (profile.didObserveInt52Overflow()) { 140 out.print(separator, "Int52Overflow"); 141 separator = "|"; 142 } 143 if (profile.didObserveBigInt()) { 144 out.print(separator, "BigInt"); 145 separator = "|"; 146 } 147 } 148 out.print(">"); 149 150 out.print(" Arg ObservedType:<"); 151 out.print(profile.argObservedType()); 152 out.print(">"); 153 154 out.print(" Arg ResultType:<"); 155 out.print(RawPointer(bitwise_cast<void*>(static_cast<uintptr_t>(profile.argResultType().bits())))); 156 out.print(">"); 157 } 158 159 void printInternal(PrintStream& out, const BinaryArithProfile& profile) 105 160 { 106 161 const char* separator = "";
Note:
See TracChangeset
for help on using the changeset viewer.