⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 281005 in webkit


Ignore:
Timestamp:
Aug 12, 2021, 7:06:38 PM (5 years ago)
Author:
Alan Coon
Message:

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

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 JavaScriptCore 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

Location:
branches/safari-611.3.10.0-branch/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-611.3.10.0-branch/Source/JavaScriptCore/ChangeLog

    r281004 r281005  
     12021-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
    1492021-08-12  Russell Epstein  <repstein@apple.com>
    250
  • branches/safari-611.3.10.0-branch/Source/JavaScriptCore/assembler/AssemblerBuffer.h

    r281004 r281005  
    11/*
    2  * Copyright (C) 2008-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2008-2021 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    206206    class ARM64EHash {
    207207    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:
    208223        static constexpr uint8_t initializationNamespace = 0x11;
    209224
     
    211226        {
    212227            // <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);
    214229        }
    215230
     
    218233            uint64_t a = tagInt(instruction, makeDiversifier(0x12, index, currentValue));
    219234            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);
    221236        }
    222237
    223238        static ALWAYS_INLINE uint32_t bitsForDiversifier(void* diversifier)
    224239        {
    225             return static_cast<uint32_t>(bitwise_cast<uintptr_t>(diversifier));
     240            return bitwise_cast<uintptr_t>(diversifier);
    226241        }
    227242
    228243        ALWAYS_INLINE uint32_t currentHash(uint32_t index, void* diversifier)
    229244        {
    230             uint64_t result;
    231245            bool hashFieldIsTagged = index == 0;
    232246            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;
    237249        }
    238250
     
    246258        }
    247259
    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:
    263260        uint64_t m_hash;
    264261    };
Note: See TracChangeset for help on using the changeset viewer.