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) \
|
|
|
|
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) \
|
2020-05-28 07:10:51 +00:00
|
|
|
V(GCDuringOffThreadMergeWithTransferHandle) \
|
2019-10-17 11:36:31 +00:00
|
|
|
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) \
|
|
|
|
V(Regress5831) \
|
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) \
|
2019-07-11 09:57:49 +00:00
|
|
|
V(WriteBarriersInCopyJSObject)
|
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
|
|
|
|
|
|
|
static void UncommitFromSpace(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_
|