From ea2c6e679e143343fdc9c2bd07fc7445434bb29c Mon Sep 17 00:00:00 2001 From: Shu-yu Guo Date: Tue, 12 Oct 2021 15:14:47 -0700 Subject: [PATCH] [heap] Fix shared string allocation refinement with single generation builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also skip the test-shared-strings/YoungInternalization cctest, which doesn't make sense when there is no young generation. Bug: v8:12007 Change-Id: I3006960181a7da681d7318289a6ade6b0f0bf6da Cq-Include-Trybots: luci.v8.try:v8_linux64_single_generation_dbg_ng Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3218197 Auto-Submit: Shu-yu Guo Commit-Queue: Shu-yu Guo Reviewed-by: Dominik Inführ Cr-Commit-Position: refs/heads/main@{#77371} --- src/heap/factory-base.cc | 3 +++ test/cctest/test-shared-strings.cc | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/heap/factory-base.cc b/src/heap/factory-base.cc index 36a926d164..dce8112eba 100644 --- a/src/heap/factory-base.cc +++ b/src/heap/factory-base.cc @@ -959,6 +959,9 @@ FactoryBase::RefineAllocationTypeForInPlaceInternalizableString( DCHECK(InstanceTypeChecker::IsInternalizedString(instance_type) || String::IsInPlaceInternalizable(instance_type)); #endif + if (FLAG_single_generation && allocation == AllocationType::kYoung) { + allocation = AllocationType::kOld; + } if (allocation != AllocationType::kOld) return allocation; return impl()->AllocationTypeForInPlaceInternalizableString(); } diff --git a/test/cctest/test-shared-strings.cc b/test/cctest/test-shared-strings.cc index 6acb29f727..8fca331d75 100644 --- a/test/cctest/test-shared-strings.cc +++ b/test/cctest/test-shared-strings.cc @@ -64,6 +64,7 @@ class MultiClientIsolateTest { }; UNINITIALIZED_TEST(InPlaceInternalizableStringsAreShared) { + if (FLAG_single_generation) return; if (!ReadOnlyHeap::IsReadOnlySpaceShared()) return; if (!COMPRESS_POINTERS_IN_SHARED_CAGE_BOOL) return; @@ -176,6 +177,7 @@ UNINITIALIZED_TEST(InPlaceInternalization) { UNINITIALIZED_TEST(YoungInternalization) { if (!ReadOnlyHeap::IsReadOnlySpaceShared()) return; if (!COMPRESS_POINTERS_IN_SHARED_CAGE_BOOL) return; + if (FLAG_single_generation) return; FLAG_shared_string_table = true;