Changeset 280996 in webkit
- Timestamp:
- Aug 12, 2021, 4:49:42 PM (4 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r280984 r280996 1 2021-08-12 Mark Lam <mark.lam@apple.com> 2 3 Refactor some ARM64EHash code. 4 https://bugs.webkit.org/show_bug.cgi?id=229054 5 6 Reviewed by Keith Miller and Robin Morisset. 7 8 This patch only refactors ARM64EHash code by moving some methods into the private 9 section, and removing some unneeded static_casts. 10 11 Verified with a diff of `otool -tv` dumps of the built JavaScriptCore binaries, 12 that there are no diffs in the generated code from this change. 13 14 * assembler/AssemblerBuffer.h: 15 (JSC::ARM64EHash::ARM64EHash): 16 (JSC::ARM64EHash::update): 17 (JSC::ARM64EHash::makeDiversifier): 18 (JSC::ARM64EHash::nextValue): 19 (JSC::ARM64EHash::bitsForDiversifier): 20 (JSC::ARM64EHash::currentHash): 21 1 22 2021-08-12 Saam Barati <sbarati@apple.com> 2 23 -
trunk/Source/JavaScriptCore/assembler/AssemblerBuffer.h
r280984 r280996 1 1 /* 2 * Copyright (C) 2008-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2008-2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 206 206 class ARM64EHash { 207 207 public: 208 ARM64EHash(void* diversifier) 209 { 210 setUpdatedHash(0, 0, diversifier); 211 } 212 213 ALWAYS_INLINE uint32_t update(uint32_t instruction, uint32_t index, void* diversifier) 214 { 215 uint32_t currentHash = this->currentHash(index, diversifier); 216 uint64_t nextIndex = index + 1; 217 uint32_t output = nextValue(instruction, nextIndex, currentHash); 218 setUpdatedHash(output, nextIndex, diversifier); 219 return output; 220 } 221 222 private: 208 223 static constexpr uint8_t initializationNamespace = 0x11; 209 224 … … 211 226 { 212 227 // <namespaceTag:8><index:24><value:32> 213 return static_cast<PtrTag>((static_cast<uint64_t>(namespaceTag) << 56) + ((index & 0xFFFFFF) << 32) + static_cast<uint64_t>(value));228 return static_cast<PtrTag>((static_cast<uint64_t>(namespaceTag) << 56) + ((index & 0xFFFFFF) << 32) + value); 214 229 } 215 230 … … 218 233 uint64_t a = tagInt(instruction, makeDiversifier(0x12, index, currentValue)); 219 234 uint64_t b = tagInt(instruction, makeDiversifier(0x13, index, currentValue)); 220 return static_cast<uint32_t>((a >> 39) ^ (b >> 23));235 return (a >> 39) ^ (b >> 23); 221 236 } 222 237 223 238 static ALWAYS_INLINE uint32_t bitsForDiversifier(void* diversifier) 224 239 { 225 return static_cast<uint32_t>(bitwise_cast<uintptr_t>(diversifier));240 return bitwise_cast<uintptr_t>(diversifier); 226 241 } 227 242 228 243 ALWAYS_INLINE uint32_t currentHash(uint32_t index, void* diversifier) 229 244 { 230 uint64_t result;231 245 bool hashFieldIsTagged = index == 0; 232 246 if (hashFieldIsTagged) 233 result = untagInt(m_hash, makeDiversifier(initializationNamespace, index, bitsForDiversifier(diversifier))); 234 else 235 result = m_hash; 236 return static_cast<uint32_t>(result); 247 return untagInt(m_hash, makeDiversifier(initializationNamespace, index, bitsForDiversifier(diversifier))); 248 return m_hash; 237 249 } 238 250 … … 246 258 } 247 259 248 ARM64EHash(void* diversifier)249 {250 setUpdatedHash(0, 0, diversifier);251 }252 253 ALWAYS_INLINE uint32_t update(uint32_t instruction, uint32_t index, void* diversifier)254 {255 uint32_t currentHash = this->currentHash(index, diversifier);256 uint64_t nextIndex = index + 1;257 uint32_t output = nextValue(instruction, nextIndex, currentHash);258 setUpdatedHash(output, nextIndex, diversifier);259 return output;260 }261 262 private:263 260 uint64_t m_hash; 264 261 };
Note:
See TracChangeset
for help on using the changeset viewer.