Bug 228962 - Update ARM64EHash
Summary: Update ARM64EHash
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Saam Barati
URL:
Keywords: InRadar
Depends on: 229384
Blocks:
  Show dependency treegraph
 
Reported: 2021-08-10 11:36 PDT by Saam Barati
Modified: 2021-08-27 12:53 PDT (History)
8 users (show)

See Also:


Attachments
patch (6.25 KB, patch)
2021-08-11 14:46 PDT, Saam Barati
no flags Details | Formatted Diff | Diff
patch (6.56 KB, patch)
2021-08-27 11:45 PDT, Saam Barati
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Saam Barati 2021-08-10 11:36:18 PDT
...
Comment 1 Saam Barati 2021-08-10 11:36:54 PDT
<rdar://79883337>
Comment 2 Saam Barati 2021-08-11 14:46:27 PDT
Created attachment 435377 [details]
patch
Comment 3 Mark Lam 2021-08-11 22:29:24 PDT
Comment on attachment 435377 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=435377&action=review

r=me with some comments.

> Source/JavaScriptCore/assembler/AssemblerBuffer.h:213
> +            return static_cast<PtrTag>((static_cast<uint64_t>(namespaceTag) << 56) + ((index & 0xFFFFFF) << 32) + static_cast<uint64_t>(value));

I think the static_cast in `static_cast<uint64_t>(value)` is not needed.  It will automatically be promoted.

> Source/JavaScriptCore/assembler/AssemblerBuffer.h:251
> +        ARM64EHash(void* diversifier)
> +        {
> +            setUpdatedHash(0, 0, diversifier);
> +        }

nit: can you put this at the top of the class?  Seems weird to have the constructor hidden in the middle of all the other methods.

Also, all the methods above this constructor can be moved into the private section below.  I think that makes it clearer that they are not part of the public interface.

> Source/JavaScriptCore/assembler/AssemblerBuffer.h:432
>              WTF::unalignedStore<uint32_t>(m_hashes.buffer() + m_index, hash);

Funny: this only works because IntegralType == uint32_t because m_index is incremented in sizeof(IntegralType), and this buffer is incremented in sizeof(uint32_t).  Anyway, it's not due to your patch, and in practice, IntegralType is always uint32_t here.
Comment 4 Mark Lam 2021-08-12 13:23:21 PDT
Comment on attachment 435377 [details]
patch

I think this patch is good on its own.  Since Saam is away, I'll just land this as is and implement my nits as a follow up refactoring patch later.
Comment 5 EWS 2021-08-12 13:45:09 PDT
Committed r280984 (240484@main): <https://commits.webkit.org/240484@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 435377 [details].
Comment 6 Darin Adler 2021-08-12 14:04:29 PDT
Comment on attachment 435377 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=435377&action=review

> Source/JavaScriptCore/assembler/AssemblerBuffer.h:220
> +            return static_cast<uint32_t>((a >> 39) ^ (b >> 23));

I’m surprised the static_cast to uint32_t here needed and valuable. Does it silence a truncation warning?

> Source/JavaScriptCore/assembler/AssemblerBuffer.h:225
> +            return static_cast<uint32_t>(bitwise_cast<uintptr_t>(diversifier));

Ditto.

> Source/JavaScriptCore/assembler/AssemblerBuffer.h:236
> +            return static_cast<uint32_t>(result);

Ditto.
Comment 7 Mark Lam 2021-08-12 14:43:32 PDT
Comment on attachment 435377 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=435377&action=review

>> Source/JavaScriptCore/assembler/AssemblerBuffer.h:220
>> +            return static_cast<uint32_t>((a >> 39) ^ (b >> 23));
> 
> I’m surprised the static_cast to uint32_t here needed and valuable. Does it silence a truncation warning?

These static_casts appear to not be needed in my local build test i.e. Clang does not complain.  I'll remove them in my upcoming refactoring patch.
Comment 8 Mark Lam 2021-08-12 15:20:26 PDT
Will do refactoring change in https://bugs.webkit.org/show_bug.cgi?id=229054.
Comment 9 WebKit Commit Bot 2021-08-22 00:33:24 PDT
Re-opened since this is blocked by bug 229384
Comment 10 Saam Barati 2021-08-27 11:45:03 PDT
Created attachment 436649 [details]
patch
Comment 11 Mark Lam 2021-08-27 11:50:46 PDT
Comment on attachment 436649 [details]
patch

r=me
Comment 12 EWS 2021-08-27 12:53:19 PDT
Committed r281717 (241059@main): <https://commits.webkit.org/241059@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 436649 [details].