1 // Copyright 2015 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef HEAP_HEAP_TESTER_H_ 6 #define HEAP_HEAP_TESTER_H_ 7 8 #include "src/handles.h" 9 #include "src/heap/spaces.h" 10 11 // Tests that should have access to private methods of {v8::internal::Heap}. 12 // Those tests need to be defined using HEAP_TEST(Name) { ... }. 13 #define HEAP_TEST_METHODS(V) \ 14 V(CompactionFullAbortedPage) \ 15 V(CompactionPartiallyAbortedPage) \ 16 V(CompactionPartiallyAbortedPageIntraAbortedPointers) \ 17 V(CompactionPartiallyAbortedPageWithStoreBufferEntries) \ 18 V(CompactionSpaceDivideMultiplePages) \ 19 V(CompactionSpaceDivideSinglePage) \ 20 V(GCFlags) \ 21 V(MarkCompactCollector) \ 22 V(NoPromotion) \ 23 V(NumberStringCacheSize) \ 24 V(ObjectGroups) \ 25 V(Promotion) \ 26 V(Regression39128) \ 27 V(ResetWeakHandle) \ 28 V(StressHandles) \ 29 V(TestMemoryReducerSampleJsCalls) \ 30 V(TestSizeOfObjects) \ 31 V(Regress587004) \ 32 V(Regress589413) \ 33 V(WriteBarriersInCopyJSObject) 34 35 #define HEAP_TEST(Name) \ 36 CcTest register_test_##Name(v8::internal::HeapTester::Test##Name, __FILE__, \ 37 #Name, true, true); \ 38 void v8::internal::HeapTester::Test##Name() 39 40 #define THREADED_HEAP_TEST(Name) \ 41 RegisterThreadedTest register_##Name(v8::internal::HeapTester::Test##Name, \ 42 #Name); \ 43 /* */ HEAP_TEST(Name) 44 45 46 namespace v8 { 47 namespace internal { 48 49 class HeapTester { 50 public: 51 #define DECLARE_STATIC(Name) static void Test##Name(); 52 53 HEAP_TEST_METHODS(DECLARE_STATIC) 54 #undef HEAP_TEST_METHODS 55 56 /* test-alloc.cc */ 57 static AllocationResult AllocateAfterFailures(); 58 static Handle<Object> TestAllocateAfterFailures(); 59 60 /* test-api.cc */ 61 static void ResetWeakHandle(bool global_gc); 62 }; 63 64 } // namespace internal 65 } // namespace v8 66 67 #endif // HEAP_HEAP_TESTER_H_ 68