[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 <jyan@ca.ibm.com>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58001}
This commit is contained in:
Junliang Yan 2018-12-03 14:45:20 -05:00 committed by Commit Bot
parent 48924ffa0f
commit 2de45f214c
3 changed files with 19 additions and 0 deletions

View File

@ -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;

View File

@ -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) {

View File

@ -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();