Commit 6b915106 authored by Sathya Gunasekaran's avatar Sathya Gunasekaran Committed by Commit Bot

[runtime] Compare against masked_hash while creating identity hash

A random hash could potential have top 10 bits be non zero which would
pass the hash != PropertyArray::kNoHashSentinel test but fail the
masked_hash != PropertyArray::kNoHashSentinel.


Bug: v8:6404, chromium:757750
Change-Id: Iade531fefc75dd76bd7a89b377d17e59532087d8
Reviewed-on: https://chromium-review.googlesource.com/627380Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47528}
parent f0e07e4b
...@@ -6349,12 +6349,14 @@ Smi* JSObject::GetOrCreateIdentityHash(Isolate* isolate) { ...@@ -6349,12 +6349,14 @@ Smi* JSObject::GetOrCreateIdentityHash(Isolate* isolate) {
return Smi::cast(hash_obj); return Smi::cast(hash_obj);
} }
int hash; int masked_hash;
// TODO(gsathya): Remove the loop and pass kHashMask directly to
// GenerateIdentityHash.
do { do {
hash = isolate->GenerateIdentityHash(Smi::kMaxValue); int hash = isolate->GenerateIdentityHash(Smi::kMaxValue);
} while (hash == PropertyArray::kNoHashSentinel); masked_hash = hash & JSReceiver::kHashMask;
} while (masked_hash == PropertyArray::kNoHashSentinel);
int masked_hash = hash & JSReceiver::kHashMask;
SetIdentityHash(masked_hash); SetIdentityHash(masked_hash);
return Smi::FromInt(masked_hash); return Smi::FromInt(masked_hash);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment