Title: [281046] branches/safari-612.1.27.2-branch/Source/_javascript_Core
Revision
281046
Author
alanc...@apple.com
Date
2021-08-13 15:14:54 -0700 (Fri, 13 Aug 2021)

Log Message

Cherry-pick r280996. rdar://problem/81901248

    Refactor some ARM64EHash code.
    https://bugs.webkit.org/show_bug.cgi?id=229054

    Reviewed by Keith Miller and Robin Morisset.

    This patch only refactors ARM64EHash code by moving some methods into the private
    section, and removing some unneeded static_casts.

    Verified with a diff of `otool -tv` dumps of the built _javascript_Core binaries,
    that there are no diffs in the generated code from this change.

    * assembler/AssemblerBuffer.h:
    (JSC::ARM64EHash::ARM64EHash):
    (JSC::ARM64EHash::update):
    (JSC::ARM64EHash::makeDiversifier):
    (JSC::ARM64EHash::nextValue):
    (JSC::ARM64EHash::bitsForDiversifier):
    (JSC::ARM64EHash::currentHash):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280996 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-612.1.27.2-branch/Source/_javascript_Core/ChangeLog (281045 => 281046)


--- branches/safari-612.1.27.2-branch/Source/_javascript_Core/ChangeLog	2021-08-13 22:14:51 UTC (rev 281045)
+++ branches/safari-612.1.27.2-branch/Source/_javascript_Core/ChangeLog	2021-08-13 22:14:54 UTC (rev 281046)
@@ -1,5 +1,53 @@
 2021-08-13  Russell Epstein  <repst...@apple.com>
 
+        Cherry-pick r280996. rdar://problem/81901248
+
+    Refactor some ARM64EHash code.
+    https://bugs.webkit.org/show_bug.cgi?id=229054
+    
+    Reviewed by Keith Miller and Robin Morisset.
+    
+    This patch only refactors ARM64EHash code by moving some methods into the private
+    section, and removing some unneeded static_casts.
+    
+    Verified with a diff of `otool -tv` dumps of the built _javascript_Core binaries,
+    that there are no diffs in the generated code from this change.
+    
+    * assembler/AssemblerBuffer.h:
+    (JSC::ARM64EHash::ARM64EHash):
+    (JSC::ARM64EHash::update):
+    (JSC::ARM64EHash::makeDiversifier):
+    (JSC::ARM64EHash::nextValue):
+    (JSC::ARM64EHash::bitsForDiversifier):
+    (JSC::ARM64EHash::currentHash):
+    
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280996 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-08-12  Mark Lam  <mark....@apple.com>
+
+            Refactor some ARM64EHash code.
+            https://bugs.webkit.org/show_bug.cgi?id=229054
+
+            Reviewed by Keith Miller and Robin Morisset.
+
+            This patch only refactors ARM64EHash code by moving some methods into the private
+            section, and removing some unneeded static_casts.
+
+            Verified with a diff of `otool -tv` dumps of the built _javascript_Core binaries,
+            that there are no diffs in the generated code from this change.
+
+            * assembler/AssemblerBuffer.h:
+            (JSC::ARM64EHash::ARM64EHash):
+            (JSC::ARM64EHash::update):
+            (JSC::ARM64EHash::makeDiversifier):
+            (JSC::ARM64EHash::nextValue):
+            (JSC::ARM64EHash::bitsForDiversifier):
+            (JSC::ARM64EHash::currentHash):
+
+2021-08-13  Russell Epstein  <repst...@apple.com>
+
         Cherry-pick r280984. rdar://problem/81901248
 
     Update ARM64EHash

Modified: branches/safari-612.1.27.2-branch/Source/_javascript_Core/assembler/AssemblerBuffer.h (281045 => 281046)


--- branches/safari-612.1.27.2-branch/Source/_javascript_Core/assembler/AssemblerBuffer.h	2021-08-13 22:14:51 UTC (rev 281045)
+++ branches/safari-612.1.27.2-branch/Source/_javascript_Core/assembler/AssemblerBuffer.h	2021-08-13 22:14:54 UTC (rev 281046)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2008-2021 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -205,12 +205,27 @@
 #if CPU(ARM64E)
     class ARM64EHash {
     public:
+        ARM64EHash(void* diversifier)
+        {
+            setUpdatedHash(0, 0, diversifier);
+        }
+
+        ALWAYS_INLINE uint32_t update(uint32_t instruction, uint32_t index, void* diversifier)
+        {
+            uint32_t currentHash = this->currentHash(index, diversifier);
+            uint64_t nextIndex = index + 1;
+            uint32_t output = nextValue(instruction, nextIndex, currentHash);
+            setUpdatedHash(output, nextIndex, diversifier);
+            return output;
+        }
+
+    private:
         static constexpr uint8_t initializationNamespace = 0x11;
 
         static ALWAYS_INLINE PtrTag makeDiversifier(uint8_t namespaceTag, uint64_t index, uint32_t value)
         {
             // <namespaceTag:8><index:24><value:32>
-            return static_cast<PtrTag>((static_cast<uint64_t>(namespaceTag) << 56) + ((index & 0xFFFFFF) << 32) + static_cast<uint64_t>(value));
+            return static_cast<PtrTag>((static_cast<uint64_t>(namespaceTag) << 56) + ((index & 0xFFFFFF) << 32) + value);
         }
 
         static ALWAYS_INLINE uint32_t nextValue(uint64_t instruction, uint64_t index, uint32_t currentValue)
@@ -217,23 +232,20 @@
         {
             uint64_t a = tagInt(instruction, makeDiversifier(0x12, index, currentValue));
             uint64_t b = tagInt(instruction, makeDiversifier(0x13, index, currentValue));
-            return static_cast<uint32_t>((a >> 39) ^ (b >> 23));
+            return (a >> 39) ^ (b >> 23);
         }
 
         static ALWAYS_INLINE uint32_t bitsForDiversifier(void* diversifier)
         {
-            return static_cast<uint32_t>(bitwise_cast<uintptr_t>(diversifier));
+            return bitwise_cast<uintptr_t>(diversifier);
         }
 
         ALWAYS_INLINE uint32_t currentHash(uint32_t index, void* diversifier)
         {
-            uint64_t result;
             bool hashFieldIsTagged = index == 0;
             if (hashFieldIsTagged)
-                result = untagInt(m_hash, makeDiversifier(initializationNamespace, index, bitsForDiversifier(diversifier)));
-            else
-                result = m_hash;
-            return static_cast<uint32_t>(result);
+                return untagInt(m_hash, makeDiversifier(initializationNamespace, index, bitsForDiversifier(diversifier)));
+            return m_hash;
         }
 
         ALWAYS_INLINE void setUpdatedHash(uint32_t value, uint32_t index, void* diversifier)
@@ -245,21 +257,6 @@
                 m_hash = value;
         }
 
-        ARM64EHash(void* diversifier)
-        {
-            setUpdatedHash(0, 0, diversifier);
-        }
- 
-        ALWAYS_INLINE uint32_t update(uint32_t instruction, uint32_t index, void* diversifier)
-        {
-            uint32_t currentHash = this->currentHash(index, diversifier);
-            uint64_t nextIndex = index + 1;
-            uint32_t output = nextValue(instruction, nextIndex, currentHash);
-            setUpdatedHash(output, nextIndex, diversifier);
-            return output;
-        }
-
-    private:
         uint64_t m_hash;
     };
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to