5#ifndef V8_STRINGS_STRING_HASHER_INL_H_
6#define V8_STRINGS_STRING_HASHER_INL_H_
16#elif defined(__ARM_NEON__)
27#include "third_party/rapidhash-v8/rapidhash.h"
34 uint32_t length, uint64_t seed);
47 for (
unsigned i = 0;
i < len; ++
i) {
57 return rapidhash(chars, length, seed);
67 return rapidhash(
reinterpret_cast<const uint8_t*
>(chars), 2 * length, seed);
70template <
typename u
char>
122#if V8_HOST_ARCH_64_BIT
128template <
typename u
char>
130 uint32_t length, uint32_t&
i,
137 index = chars[0] -
'0';
151 uint32_t val = c -
'0';
153 index = (10 *
index) + val;
155 if constexpr (
sizeof(
index) ==
sizeof(uint64_t)) {
162 DCHECK(
sizeof(index) ==
sizeof(uint32_t));
173 constexpr uint32_t kMinValidValue =
175 if (index + 1 < kMinValidValue + 1) {
190#if V8_HOST_ARCH_64_BIT
191template <
typename u
char>
193 uint32_t length, uint32_t
i,
208 uint32_t val = c -
'0';
210 index = (10 *
index) + val;
222template <
typename char_t>
224 uint32_t length, uint64_t seed) {
225 static_assert(std::is_integral_v<char_t>);
226 static_assert(
sizeof(char_t) <= 2);
227 using uchar = std::make_unsigned_t<char_t>;
228 const uchar* chars =
reinterpret_cast<const uchar*
>(chars_raw);
246#if V8_HOST_ARCH_64_BIT
251 switch (detail::TryParseIntegerIndex(chars, length,
i, index)) {
295 name,
static_cast<uint32_t
>(strlen(name)),
hashseed_);
static constexpr int kShift
static const uint32_t kMaxArrayIndex
static const int kMaxCachedArrayIndexLength
static bool IsIntegerIndex(uint32_t raw_hash_field)
static uint32_t CreateHashFieldValue(uint32_t hash, HashFieldType type)
static bool ContainsCachedArrayIndex(uint32_t hash)
static const int kMaxArrayIndexSize
static const int kArrayIndexValueBits
static const int kMaxIntegerIndexSize
V8_INLINE void AddCharacter(uint16_t c)
V8_INLINE uint32_t Finalize()
static V8_INLINE uint32_t GetTrivialHash(uint32_t length)
static V8_INLINE uint32_t MakeArrayIndexHash(uint32_t value, uint32_t length)
static const int kZeroHash
static uint32_t HashSequentialString(const char_t *chars, uint32_t length, uint64_t seed)
static const uint32_t kMaxHashCalcLength
static const uint32_t kMaxLength
V8_INLINE bool IsOnly8Bit(const uint16_t *chars, unsigned len)
V8_EXPORT_PRIVATE uint64_t HashConvertingTo8Bit(const uint16_t *chars, uint32_t length, uint64_t seed)
V8_INLINE IndexParseResult TryParseArrayIndex(const uchar *chars, uint32_t length, uint32_t &i, ArrayIndexT &index)
uint32_t ConvertRawHashToUsableHash(T raw_hash)
V8_INLINE uint64_t GetRapidHash(const uint8_t *chars, uint32_t length, uint64_t seed)
V8_INLINE uint32_t GetUsableRapidHash(const uchar *chars, uint32_t length, uint64_t seed)
constexpr uint64_t kMaxSafeIntegerUint64
constexpr uint64_t kMaxUInt64
constexpr uint64_t TenToThe(uint32_t exponent)
#define DCHECK_LE(v1, v2)
#define DCHECK_IMPLIES(v1, v2)
#define DCHECK_GE(v1, v2)
#define DCHECK(condition)
#define DCHECK_LT(v1, v2)
#define DCHECK_EQ(v1, v2)
#define DCHECK_GT(v1, v2)
#define V8_EXPORT_PRIVATE
std::size_t operator()(const char *name) const
#define V8_UNLIKELY(condition)