| Index: src/objects-inl.h
|
| diff --git a/src/objects-inl.h b/src/objects-inl.h
|
| index b750b71a88b75ba5395c4913b7a95c4a5cd04416..dc235df84561a17b7f5c8d560eec34f4bd31bf91 100644
|
| --- a/src/objects-inl.h
|
| +++ b/src/objects-inl.h
|
| @@ -6562,6 +6562,35 @@ uint32_t StringHasher::HashSequentialString(const schar* chars,
|
| }
|
|
|
|
|
| +uint32_t IteratingStringHasher::Hash(String* string, uint32_t seed) {
|
| + IteratingStringHasher hasher(string->length(), seed);
|
| + // Nothing to do.
|
| + if (hasher.has_trivial_hash()) return hasher.GetHashField();
|
| + ConsString* cons_string = String::VisitFlat(&hasher, string);
|
| + // The string was flat.
|
| + if (cons_string == NULL) return hasher.GetHashField();
|
| + // This is a ConsString, iterate across it.
|
| + ConsStringIteratorOp op(cons_string);
|
| + int offset;
|
| + while (NULL != (string = op.Next(&offset))) {
|
| + String::VisitFlat(&hasher, string, offset);
|
| + }
|
| + return hasher.GetHashField();
|
| +}
|
| +
|
| +
|
| +void IteratingStringHasher::VisitOneByteString(const uint8_t* chars,
|
| + int length) {
|
| + AddCharacters(chars, length);
|
| +}
|
| +
|
| +
|
| +void IteratingStringHasher::VisitTwoByteString(const uint16_t* chars,
|
| + int length) {
|
| + AddCharacters(chars, length);
|
| +}
|
| +
|
| +
|
| bool Name::AsArrayIndex(uint32_t* index) {
|
| return IsString() && String::cast(this)->AsArrayIndex(index);
|
| }
|
|
|