Skip to content

Commit c97237b

Browse files
targosgibfahn
authored andcommitted
deps: cherry-pick a4bddba from upstream V8
Original commit message: [Runtime] Use platform specific value for JSReceiver::HashMask This allows us to remove the loop while calculating the hash value and just use the HashMask as the mask for ComputeIntegerHash. This previously overflowed on 32-bit systems failing the Smi::IsValid check. Bug: v8:6404 Change-Id: I84610a7592fa9d7ce4fa5cef7903bd50b8e8a4df Reviewed-on: https://chromium-review.googlesource.com/702675 Reviewed-by: Adam Klein <[email protected]> Commit-Queue: Sathya Gunasekaran <[email protected]> Cr-Commit-Position: refs/heads/master@{#48319} PR-URL: #19824 Refs: v8/v8@a4bddba Fixes: #19769 Reviewed-By: Yang Guo <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
1 parent 53b702f commit c97237b

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

deps/v8/include/v8-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 6
1212
#define V8_MINOR_VERSION 2
1313
#define V8_BUILD_NUMBER 414
14-
#define V8_PATCH_LEVEL 50
14+
#define V8_PATCH_LEVEL 51
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

deps/v8/src/objects.cc

+2-7
Original file line numberDiff line numberDiff line change
@@ -6368,13 +6368,8 @@ Smi* JSObject::GetOrCreateIdentityHash(Isolate* isolate) {
63686368
return Smi::cast(hash_obj);
63696369
}
63706370

6371-
int masked_hash;
6372-
// TODO(gsathya): Remove the loop and pass kHashMask directly to
6373-
// GenerateIdentityHash.
6374-
do {
6375-
int hash = isolate->GenerateIdentityHash(Smi::kMaxValue);
6376-
masked_hash = hash & JSReceiver::kHashMask;
6377-
} while (masked_hash == PropertyArray::kNoHashSentinel);
6371+
int masked_hash = isolate->GenerateIdentityHash(JSReceiver::kHashMask);
6372+
DCHECK_NE(PropertyArray::kNoHashSentinel, masked_hash);
63786373

63796374
SetIdentityHash(masked_hash);
63806375
return Smi::FromInt(masked_hash);

deps/v8/src/objects.h

+5
Original file line numberDiff line numberDiff line change
@@ -1954,8 +1954,13 @@ class PropertyArray : public HeapObject {
19541954
typedef BodyDescriptor BodyDescriptorWeak;
19551955

19561956
static const int kLengthMask = 0x3ff;
1957+
#if V8_TARGET_ARCH_64_BIT
19571958
static const int kHashMask = 0x7ffffc00;
19581959
STATIC_ASSERT(kLengthMask + kHashMask == 0x7fffffff);
1960+
#else
1961+
static const int kHashMask = 0x3ffffc00;
1962+
STATIC_ASSERT(kLengthMask + kHashMask == 0x3fffffff);
1963+
#endif
19591964

19601965
static const int kMaxLength = kLengthMask;
19611966
STATIC_ASSERT(kMaxLength > kMaxNumberOfDescriptors);

0 commit comments

Comments
 (0)