Changeset 281005 in webkit
- Timestamp:
- Aug 12, 2021, 7:06:38 PM (5 years ago)
- Location:
- branches/safari-611.3.10.0-branch/Source/JavaScriptCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
assembler/AssemblerBuffer.h (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-611.3.10.0-branch/Source/JavaScriptCore/ChangeLog
r281004 r281005 1 2021-08-12 Russell Epstein <repstein@apple.com> 2 3 Cherry-pick r280996. rdar://problem/81752592 4 5 Refactor some ARM64EHash code. 6 https://bugs.webkit.org/show_bug.cgi?id=229054 7 8 Reviewed by Keith Miller and Robin Morisset. 9 10 This patch only refactors ARM64EHash code by moving some methods into the private 11 section, and removing some unneeded static_casts. 12 13 Verified with a diff of `otool -tv` dumps of the built JavaScriptCore binaries, 14 that there are no diffs in the generated code from this change. 15 16 * assembler/AssemblerBuffer.h: 17 (JSC::ARM64EHash::ARM64EHash): 18 (JSC::ARM64EHash::update): 19 (JSC::ARM64EHash::makeDiversifier): 20 (JSC::ARM64EHash::nextValue): 21 (JSC::ARM64EHash::bitsForDiversifier): 22 (JSC::ARM64EHash::currentHash): 23 24 25 26 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280996 268f45cc-cd09-0410-ab3c-d52691b4dbfc 27 28 2021-08-12 Mark Lam <mark.lam@apple.com> 29 30 Refactor some ARM64EHash code. 31 https://bugs.webkit.org/show_bug.cgi?id=229054 32 33 Reviewed by Keith Miller and Robin Morisset. 34 35 This patch only refactors ARM64EHash code by moving some methods into the private 36 section, and removing some unneeded static_casts. 37 38 Verified with a diff of `otool -tv` dumps of the built JavaScriptCore binaries, 39 that there are no diffs in the generated code from this change. 40 41 * assembler/AssemblerBuffer.h: 42 (JSC::ARM64EHash::ARM64EHash): 43 (JSC::ARM64EHash::update): 44 (JSC::ARM64EHash::makeDiversifier): 45 (JSC::ARM64EHash::nextValue): 46 (JSC::ARM64EHash::bitsForDiversifier): 47 (JSC::ARM64EHash::currentHash): 48 1 49 2021-08-12 Russell Epstein <repstein@apple.com> 2 50 -
branches/safari-611.3.10.0-branch/Source/JavaScriptCore/assembler/AssemblerBuffer.h
r281004 r281005 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.