[codegen] (Slightly) speed up hashing of signatures
The hash of signatures currently has redundancy: We hash both the parameter count and the return count, plus all contained values. The total count of contained values is already implicitly captured by {hash_combine}ing the individual values, thus it's enough to only include one of parameter count and return count. R=manoskouk@chromium.org Bug: v8:12593 Change-Id: I6d3e8b15f4251964e3a74ae5411d06a7d41183a8 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3460415 Reviewed-by: Manos Koukoutos <manoskouk@chromium.org> Commit-Queue: Clemens Backes <clemensb@chromium.org> Cr-Commit-Position: refs/heads/main@{#79095}
This commit is contained in:
parent
ca68fc7390
commit
d7b2dd098a
@ -127,9 +127,12 @@ using MachineSignature = Signature<MachineType>;
|
||||
|
||||
template <typename T>
|
||||
size_t hash_value(const Signature<T>& sig) {
|
||||
size_t hash = base::hash_combine(sig.parameter_count(), sig.return_count());
|
||||
for (const T& t : sig.all()) hash = base::hash_combine(hash, t);
|
||||
return hash;
|
||||
// Hash over all contained representations, plus the parameter count to
|
||||
// differentiate signatures with the same representation array but different
|
||||
// parameter/return count.
|
||||
size_t seed = base::hash_value(sig.parameter_count());
|
||||
for (T rep : sig.all()) seed = base::hash_combine(seed, base::hash<T>{}(rep));
|
||||
return seed;
|
||||
}
|
||||
|
||||
template <typename T, size_t kNumReturns = 0, size_t kNumParams = 0>
|
||||
|
Loading…
Reference in New Issue
Block a user