Index: src/objects.cc |
=================================================================== |
--- src/objects.cc (revision 5369) |
+++ src/objects.cc (working copy) |
@@ -4990,17 +4990,20 @@ |
} |
-uint32_t StringHasher::MakeCachedArrayIndex(uint32_t value, int length) { |
- value <<= String::kHashShift; |
+uint32_t StringHasher::MakeArrayIndexHash(uint32_t value, int length) { |
// For array indexes mix the length into the hash as an array index could |
// be zero. |
ASSERT(length > 0); |
ASSERT(length <= String::kMaxArrayIndexSize); |
ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) < |
(1 << String::kArrayIndexValueBits)); |
- ASSERT(String::kMaxArrayIndexSize < (1 << String::kArrayIndexValueBits)); |
- value &= ~String::kIsNotArrayIndexMask; |
+ |
+ value <<= String::kHashShift; |
value |= length << String::kArrayIndexHashLengthShift; |
+ |
+ ASSERT((value & String::kIsNotArrayIndexMask) == 0); |
+ ASSERT((length > String::kMaxCachedArrayIndexLength) || |
+ (value & String::kContainsCachedArrayIndexMask) == 0); |
return value; |
} |
@@ -5009,7 +5012,7 @@ |
ASSERT(is_valid()); |
if (length_ <= String::kMaxHashCalcLength) { |
if (is_array_index()) { |
- return MakeCachedArrayIndex(array_index(), length_); |
+ return MakeArrayIndexHash(array_index(), length_); |
} |
return (GetHash() << String::kHashShift) | String::kIsNotArrayIndexMask; |
} else { |