Fix two-char hash to use correct fallback for zero hashes.

R=verwaest@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/11228004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12782 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
yangguo@chromium.org 2012-10-22 10:38:40 +00:00
parent c71c3cfd65
commit 3c5e899378
4 changed files with 4 additions and 4 deletions

View File

@ -2713,7 +2713,7 @@ bool Heap::CreateInitialObjects() {
// hash code in place. The hash code for the hidden_symbol is zero to ensure
// that it will always be at the first entry in property descriptors.
{ MaybeObject* maybe_obj =
AllocateSymbol(CStrVector(""), 0, String::kZeroHash);
AllocateSymbol(CStrVector(""), 0, String::kEmptyStringHash);
if (!maybe_obj->ToObject(&obj)) return false;
}
hidden_symbol_ = String::cast(obj);

View File

@ -4955,7 +4955,7 @@ uint32_t StringHasher::GetHashCore(uint32_t running_hash) {
running_hash ^= (running_hash >> 11);
running_hash += (running_hash << 15);
if ((running_hash & String::kHashBitMask) == 0) {
return 27;
return kZeroHash;
}
return running_hash;
}

View File

@ -12083,7 +12083,7 @@ class TwoCharHashTableKey : public HashTableKey {
hash += hash << 3;
hash ^= hash >> 11;
hash += hash << 15;
if ((hash & String::kHashBitMask) == 0) hash = String::kZeroHash;
if ((hash & String::kHashBitMask) == 0) hash = StringHasher::kZeroHash;
#ifdef DEBUG
StringHasher hasher(2, seed);
hasher.AddCharacter(c1);

View File

@ -7380,7 +7380,7 @@ class String: public HeapObject {
kIsNotArrayIndexMask | kHashNotComputedMask;
// Value of hash field containing computed hash equal to zero.
static const int kZeroHash = kIsNotArrayIndexMask;
static const int kEmptyStringHash = kIsNotArrayIndexMask;
// Maximal string length.
static const int kMaxLength = (1 << (32 - 2)) - 1;