From 2de45f214ccef6f50ddb2ff342ad5b94e4859bfc Mon Sep 17 00:00:00 2001 From: Junliang Yan Date: Mon, 3 Dec 2018 14:45:20 -0500 Subject: [PATCH] [heap] adjust kMaxRegularHeapObjectSize on ppc64le This is to address the first issue reported on v8:8453 Page::kPageSize is 524288 MemoryAllocator::GetCommitPageSize() returns 65536 on ppc ObjectEndOffsetInCodePage() returns 458752 ObjectStartOffsetInCodePage() returns (65536 + 65536) => 131072 Therefore, memory = 327680, which is less than kMaxRegularHeapObjectSize(507136), which causes the DCHECK to fail. Bug: v8:8453 Change-Id: I6048192ded4234a6987371ec4d4b2a8553756c25 Reviewed-on: https://chromium-review.googlesource.com/c/1355422 Commit-Queue: Junliang Yan Reviewed-by: Ulan Degenbaev Cr-Commit-Position: refs/heads/master@{#58001} --- src/globals.h | 5 +++++ src/objects/hash-table.h | 5 +++++ test/cctest/test-serialize.cc | 9 +++++++++ 3 files changed, 19 insertions(+) diff --git a/src/globals.h b/src/globals.h index aa392e6f41..865cf9cbf5 100644 --- a/src/globals.h +++ b/src/globals.h @@ -241,7 +241,12 @@ constexpr int kExternalAllocationSoftLimit = // account. // // Current value: Page::kAllocatableMemory (on 32-bit arch) - 512 (slack). +#ifdef V8_HOST_ARCH_PPC +// Reduced kMaxRegularHeapObjectSize due to larger page size(64k) on ppc64le +constexpr int kMaxRegularHeapObjectSize = 327680; +#else constexpr int kMaxRegularHeapObjectSize = 507136; +#endif constexpr int kBitsPerByte = 8; constexpr int kBitsPerByteLog2 = 3; diff --git a/src/objects/hash-table.h b/src/objects/hash-table.h index 3eedbb6997..d358fbb5ef 100644 --- a/src/objects/hash-table.h +++ b/src/objects/hash-table.h @@ -176,7 +176,12 @@ class HashTable : public HashTableBase { static const int kMinShrinkCapacity = 16; // Maximum length to create a regular HashTable (aka. non large object). +#if V8_HOST_ARCH_PPC + // Reduced kMaxRegularCapacity due to reduced kMaxRegularHeapObjectSize + static const int kMaxRegularCapacity = 16384 / 2; +#else static const int kMaxRegularCapacity = 16384; +#endif // Returns the index for an entry (of the key) static constexpr inline int EntryToIndex(int entry) { diff --git a/test/cctest/test-serialize.cc b/test/cctest/test-serialize.cc index 7f9bb23fe7..0986104beb 100644 --- a/test/cctest/test-serialize.cc +++ b/test/cctest/test-serialize.cc @@ -1833,11 +1833,20 @@ TEST(CodeSerializerThreeBigStrings) { result_str = CompileRun("b") ->ToString(CcTest::isolate()->GetCurrentContext()) .ToLocalChecked(); +#if V8_HOST_ARCH_PPC + CHECK(heap->InSpace(*v8::Utils::OpenHandle(*result_str), LO_SPACE)); +#else CHECK(heap->InSpace(*v8::Utils::OpenHandle(*result_str), OLD_SPACE)); +#endif + result_str = CompileRun("c") ->ToString(CcTest::isolate()->GetCurrentContext()) .ToLocalChecked(); +#if V8_HOST_ARCH_PPC + CHECK(heap->InSpace(*v8::Utils::OpenHandle(*result_str), LO_SPACE)); +#else CHECK(heap->InSpace(*v8::Utils::OpenHandle(*result_str), OLD_SPACE)); +#endif delete cache; source_a.Dispose();