2015-08-21 12:40:22 +00:00
|
|
|
// Copyright 2015 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2015-12-09 11:25:26 +00:00
|
|
|
#ifndef HEAP_HEAP_TESTER_H_
|
|
|
|
#define HEAP_HEAP_TESTER_H_
|
2015-08-21 12:40:22 +00:00
|
|
|
|
|
|
|
#include "src/heap/spaces.h"
|
2018-11-24 08:51:21 +00:00
|
|
|
#include "src/objects/fixed-array.h"
|
2015-08-21 12:40:22 +00:00
|
|
|
|
|
|
|
// Tests that should have access to private methods of {v8::internal::Heap}.
|
|
|
|
// Those tests need to be defined using HEAP_TEST(Name) { ... }.
|
2019-10-17 11:36:31 +00:00
|
|
|
#define HEAP_TEST_METHODS(V) \
|
2020-09-14 11:17:34 +00:00
|
|
|
V(CodeLargeObjectSpace) \
|
[heap] Make maximum regular code object size a runtime value.
Executable V8 pages include 3 reserved OS pages: one for the writable
header and two as guards. On systems with 64k OS pages, the amount of
allocatable space left for objects can then be quite smaller than the
page size, only 64k for each 256k page.
This means regular code objects cannot be larger than 64k, while the
maximum regular object size is fixed to 128k, half of the page size. As
a result code object never reach this limit and we can end up filling
regular pages with few large code objects.
To fix this, we change the maximum code object size to be runtime value,
set to half of the allocatable space per page. On systems with 64k OS
pages, the limit will be 32k.
Alternatively, we could increase the V8 page size to 512k on Arm64 linux
so we wouldn't waste code space. However, systems with 4k OS pages are
more common, and those with 64k pages tend to have more memory available
so we should be able to live with it.
Bug: v8:10808
Change-Id: I5d807e7a3df89f1e9c648899e9ba2f8e2648264c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2460809
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Pierre Langlois <pierre.langlois@arm.com>
Cr-Commit-Position: refs/heads/master@{#70569}
2020-10-15 10:21:40 +00:00
|
|
|
V(CodeLargeObjectSpace64k) \
|
2019-10-17 11:36:31 +00:00
|
|
|
V(CompactionFullAbortedPage) \
|
|
|
|
V(CompactionPartiallyAbortedPage) \
|
|
|
|
V(CompactionPartiallyAbortedPageIntraAbortedPointers) \
|
|
|
|
V(CompactionPartiallyAbortedPageWithInvalidatedSlots) \
|
|
|
|
V(CompactionPartiallyAbortedPageWithRememberedSetEntries) \
|
|
|
|
V(CompactionSpaceDivideMultiplePages) \
|
|
|
|
V(CompactionSpaceDivideSinglePage) \
|
|
|
|
V(InvalidatedSlotsAfterTrimming) \
|
|
|
|
V(InvalidatedSlotsAllInvalidatedRanges) \
|
|
|
|
V(InvalidatedSlotsCleanupEachObject) \
|
|
|
|
V(InvalidatedSlotsCleanupFull) \
|
|
|
|
V(InvalidatedSlotsCleanupRightTrim) \
|
|
|
|
V(InvalidatedSlotsCleanupOverlapRight) \
|
|
|
|
V(InvalidatedSlotsEvacuationCandidate) \
|
|
|
|
V(InvalidatedSlotsNoInvalidatedRanges) \
|
|
|
|
V(InvalidatedSlotsResetObjectRegression) \
|
|
|
|
V(InvalidatedSlotsRightTrimFixedArray) \
|
|
|
|
V(InvalidatedSlotsRightTrimLargeFixedArray) \
|
|
|
|
V(InvalidatedSlotsLeftTrimFixedArray) \
|
|
|
|
V(InvalidatedSlotsFastToSlow) \
|
|
|
|
V(InvalidatedSlotsSomeInvalidatedRanges) \
|
|
|
|
V(TestNewSpaceRefsInCopiedCode) \
|
|
|
|
V(GCFlags) \
|
|
|
|
V(MarkCompactCollector) \
|
|
|
|
V(MarkCompactEpochCounter) \
|
|
|
|
V(MemoryReducerActivationForSmallHeaps) \
|
|
|
|
V(NoPromotion) \
|
|
|
|
V(NumberStringCacheSize) \
|
|
|
|
V(ObjectGroups) \
|
|
|
|
V(Promotion) \
|
|
|
|
V(Regression39128) \
|
|
|
|
V(ResetWeakHandle) \
|
|
|
|
V(StressHandles) \
|
|
|
|
V(TestMemoryReducerSampleJsCalls) \
|
|
|
|
V(TestSizeOfObjects) \
|
2020-06-03 11:14:02 +00:00
|
|
|
V(Regress10560) \
|
2019-10-17 11:36:31 +00:00
|
|
|
V(Regress538257) \
|
|
|
|
V(Regress587004) \
|
|
|
|
V(Regress589413) \
|
|
|
|
V(Regress658718) \
|
|
|
|
V(Regress670675) \
|
|
|
|
V(Regress777177) \
|
|
|
|
V(Regress779503) \
|
|
|
|
V(Regress791582) \
|
|
|
|
V(Regress845060) \
|
|
|
|
V(RegressMissingWriteBarrierInAllocate) \
|
2020-07-03 07:26:57 +00:00
|
|
|
V(WriteBarrier_Marking) \
|
|
|
|
V(WriteBarrier_MarkingExtension) \
|
2020-07-13 09:17:48 +00:00
|
|
|
V(WriteBarriersInCopyJSObject) \
|
2020-08-28 20:48:41 +00:00
|
|
|
V(DoNotEvacuatePinnedPages) \
|
|
|
|
V(ObjectStartBitmap)
|
2015-08-21 12:40:22 +00:00
|
|
|
|
2017-08-11 10:04:47 +00:00
|
|
|
#define HEAP_TEST(Name) \
|
|
|
|
CcTest register_test_##Name(v8::internal::heap::HeapTester::Test##Name, \
|
|
|
|
__FILE__, #Name, true, true); \
|
|
|
|
void v8::internal::heap::HeapTester::Test##Name()
|
|
|
|
|
|
|
|
#define UNINITIALIZED_HEAP_TEST(Name) \
|
|
|
|
CcTest register_test_##Name(v8::internal::heap::HeapTester::Test##Name, \
|
|
|
|
__FILE__, #Name, true, false); \
|
|
|
|
void v8::internal::heap::HeapTester::Test##Name()
|
|
|
|
|
|
|
|
#define THREADED_HEAP_TEST(Name) \
|
|
|
|
RegisterThreadedTest register_##Name( \
|
|
|
|
v8::internal::heap::HeapTester::Test##Name, #Name); \
|
2015-08-21 12:40:22 +00:00
|
|
|
/* */ HEAP_TEST(Name)
|
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
|
2017-01-27 13:53:13 +00:00
|
|
|
template <typename T>
|
|
|
|
class Handle;
|
|
|
|
|
2017-08-11 10:04:47 +00:00
|
|
|
namespace heap {
|
|
|
|
|
2015-08-21 12:40:22 +00:00
|
|
|
class HeapTester {
|
|
|
|
public:
|
|
|
|
#define DECLARE_STATIC(Name) static void Test##Name();
|
|
|
|
|
|
|
|
HEAP_TEST_METHODS(DECLARE_STATIC)
|
|
|
|
#undef HEAP_TEST_METHODS
|
|
|
|
|
2017-08-02 17:27:11 +00:00
|
|
|
// test-alloc.cc
|
2015-08-21 12:40:22 +00:00
|
|
|
static AllocationResult AllocateAfterFailures();
|
|
|
|
static Handle<Object> TestAllocateAfterFailures();
|
|
|
|
|
2017-08-02 17:27:11 +00:00
|
|
|
// test-invalidated-slots.cc
|
|
|
|
static Page* AllocateByteArraysOnPage(Heap* heap,
|
2018-11-24 08:51:21 +00:00
|
|
|
std::vector<ByteArray>* byte_arrays);
|
2017-08-02 17:27:11 +00:00
|
|
|
|
|
|
|
// test-api.cc
|
2015-08-21 12:40:22 +00:00
|
|
|
static void ResetWeakHandle(bool global_gc);
|
2018-04-09 19:11:22 +00:00
|
|
|
|
|
|
|
// test-heap.cc
|
|
|
|
static AllocationResult AllocateByteArrayForTest(Heap* heap, int length,
|
2019-03-11 19:04:02 +00:00
|
|
|
AllocationType allocation);
|
2019-09-17 09:28:20 +00:00
|
|
|
static bool CodeEnsureLinearAllocationArea(Heap* heap, int size_in_bytes);
|
2018-04-09 19:11:22 +00:00
|
|
|
|
|
|
|
// test-mark-compact.cc
|
|
|
|
static AllocationResult AllocateMapForTest(v8::internal::Isolate* isolate);
|
|
|
|
static AllocationResult AllocateFixedArrayForTest(Heap* heap, int length,
|
2019-03-11 19:04:02 +00:00
|
|
|
AllocationType allocation);
|
2018-05-22 16:03:55 +00:00
|
|
|
|
2022-05-16 14:33:29 +00:00
|
|
|
static void UncommitUnusedMemory(Heap* heap);
|
2015-08-21 12:40:22 +00:00
|
|
|
};
|
2015-09-30 13:46:56 +00:00
|
|
|
|
2017-08-11 10:04:47 +00:00
|
|
|
} // namespace heap
|
2015-09-30 13:46:56 +00:00
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|
2015-08-21 12:40:22 +00:00
|
|
|
|
2015-12-09 11:25:26 +00:00
|
|
|
#endif // HEAP_HEAP_TESTER_H_
|