blob: 599c5d8be20d9d8fc4b36ab92f18e83e3a26410d [file] [log] [blame]
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001// 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) \
Ben Murdoch097c5b22016-05-18 11:27:45 +010031 V(Regress587004) \
Ben Murdochda12d292016-06-02 14:46:10 +010032 V(Regress589413) \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000033 V(WriteBarriersInCopyJSObject)
34
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000035#define HEAP_TEST(Name) \
36 CcTest register_test_##Name(v8::internal::HeapTester::Test##Name, __FILE__, \
Ben Murdochda12d292016-06-02 14:46:10 +010037 #Name, true, true); \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000038 void v8::internal::HeapTester::Test##Name()
39
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000040#define THREADED_HEAP_TEST(Name) \
41 RegisterThreadedTest register_##Name(v8::internal::HeapTester::Test##Name, \
42 #Name); \
43 /* */ HEAP_TEST(Name)
44
45
46namespace v8 {
47namespace internal {
48
49class 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);
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000062};
63
64} // namespace internal
65} // namespace v8
66
67#endif // HEAP_HEAP_TESTER_H_