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) { ... }.
|
2015-12-16 14:06:33 +00:00
|
|
|
#define HEAP_TEST_METHODS(V) \
|
|
|
|
V(CompactionFullAbortedPage) \
|
|
|
|
V(CompactionPartiallyAbortedPage) \
|
|
|
|
V(CompactionPartiallyAbortedPageIntraAbortedPointers) \
|
|
|
|
V(CompactionPartiallyAbortedPageWithStoreBufferEntries) \
|
|
|
|
V(CompactionSpaceDivideMultiplePages) \
|
|
|
|
V(CompactionSpaceDivideSinglePage) \
|
2017-08-02 17:27:11 +00:00
|
|
|
V(InvalidatedSlotsAfterTrimming) \
|
|
|
|
V(InvalidatedSlotsAllInvalidatedRanges) \
|
2019-08-26 13:12:22 +00:00
|
|
|
V(InvalidatedSlotsCleanupEachObject) \
|
|
|
|
V(InvalidatedSlotsCleanupFull) \
|
|
|
|
V(InvalidatedSlotsCleanupRightTrim) \
|
|
|
|
V(InvalidatedSlotsCleanupOverlapRight) \
|
2017-08-02 17:27:11 +00:00
|
|
|
V(InvalidatedSlotsEvacuationCandidate) \
|
|
|
|
V(InvalidatedSlotsNoInvalidatedRanges) \
|
2017-08-03 17:58:03 +00:00
|
|
|
V(InvalidatedSlotsResetObjectRegression) \
|
2018-08-10 13:33:29 +00:00
|
|
|
V(InvalidatedSlotsRightTrimFixedArray) \
|
|
|
|
V(InvalidatedSlotsRightTrimLargeFixedArray) \
|
|
|
|
V(InvalidatedSlotsLeftTrimFixedArray) \
|
|
|
|
V(InvalidatedSlotsFastToSlow) \
|
2017-08-02 17:27:11 +00:00
|
|
|
V(InvalidatedSlotsSomeInvalidatedRanges) \
|
2016-08-04 08:12:40 +00:00
|
|
|
V(TestNewSpaceRefsInCopiedCode) \
|
2015-12-16 14:06:33 +00:00
|
|
|
V(GCFlags) \
|
|
|
|
V(MarkCompactCollector) \
|
2018-12-19 16:03:41 +00:00
|
|
|
V(MarkCompactEpochCounter) \
|
2019-01-22 10:06:28 +00:00
|
|
|
V(MemoryReducerActivationForSmallHeaps) \
|
2015-12-16 14:06:33 +00:00
|
|
|
V(NoPromotion) \
|
|
|
|
V(NumberStringCacheSize) \
|
|
|
|
V(ObjectGroups) \
|
|
|
|
V(Promotion) \
|
|
|
|
V(Regression39128) \
|
|
|
|
V(ResetWeakHandle) \
|
|
|
|
V(StressHandles) \
|
|
|
|
V(TestMemoryReducerSampleJsCalls) \
|
|
|
|
V(TestSizeOfObjects) \
|
2018-05-22 02:08:21 +00:00
|
|
|
V(Regress5831) \
|
2016-09-28 17:51:48 +00:00
|
|
|
V(Regress538257) \
|
2018-05-22 02:08:21 +00:00
|
|
|
V(Regress587004) \
|
2016-02-25 17:28:50 +00:00
|
|
|
V(Regress589413) \
|
2016-10-25 15:33:56 +00:00
|
|
|
V(Regress658718) \
|
2016-12-06 14:06:10 +00:00
|
|
|
V(Regress670675) \
|
2017-10-26 10:40:48 +00:00
|
|
|
V(Regress777177) \
|
2017-11-02 20:19:04 +00:00
|
|
|
V(Regress779503) \
|
2018-05-22 02:08:21 +00:00
|
|
|
V(Regress791582) \
|
|
|
|
V(Regress845060) \
|
2017-05-29 15:03:50 +00:00
|
|
|
V(RegressMissingWriteBarrierInAllocate) \
|
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);
|
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_
|