OLD | NEW |
| (Empty) |
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_TESTER_H_ | |
6 #define 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(CompactionSpaceDivideMultiplePages) \ | |
15 V(CompactionSpaceDivideSinglePage) \ | |
16 V(GCFlags) \ | |
17 V(MarkCompactCollector) \ | |
18 V(NoPromotion) \ | |
19 V(NumberStringCacheSize) \ | |
20 V(ObjectGroups) \ | |
21 V(Promotion) \ | |
22 V(Regression39128) \ | |
23 V(ResetWeakHandle) \ | |
24 V(StressHandles) \ | |
25 V(TestMemoryReducerSampleJsCalls) \ | |
26 V(TestSizeOfObjects) \ | |
27 V(WriteBarriersInCopyJSObject) | |
28 | |
29 | |
30 #define HEAP_TEST(Name) \ | |
31 CcTest register_test_##Name(v8::internal::HeapTester::Test##Name, __FILE__, \ | |
32 #Name, NULL, true, true); \ | |
33 void v8::internal::HeapTester::Test##Name() | |
34 | |
35 | |
36 #define THREADED_HEAP_TEST(Name) \ | |
37 RegisterThreadedTest register_##Name(v8::internal::HeapTester::Test##Name, \ | |
38 #Name); \ | |
39 /* */ HEAP_TEST(Name) | |
40 | |
41 | |
42 namespace v8 { | |
43 namespace internal { | |
44 | |
45 class HeapTester { | |
46 public: | |
47 #define DECLARE_STATIC(Name) static void Test##Name(); | |
48 | |
49 HEAP_TEST_METHODS(DECLARE_STATIC) | |
50 #undef HEAP_TEST_METHODS | |
51 | |
52 /* test-alloc.cc */ | |
53 static AllocationResult AllocateAfterFailures(); | |
54 static Handle<Object> TestAllocateAfterFailures(); | |
55 | |
56 /* test-api.cc */ | |
57 static void ResetWeakHandle(bool global_gc); | |
58 | |
59 /* test-spaces.cc */ | |
60 static CompactionSpaceCollection** InitializeCompactionSpaces(Heap* heap, | |
61 int num_spaces); | |
62 static void DestroyCompactionSpaces(CompactionSpaceCollection** spaces, | |
63 int num_spaces); | |
64 static void MergeCompactionSpaces(PagedSpace* space, | |
65 CompactionSpaceCollection** spaces, | |
66 int num_spaces); | |
67 static void AllocateInCompactionSpaces(CompactionSpaceCollection** spaces, | |
68 AllocationSpace id, int num_spaces, | |
69 int num_objects, int object_size); | |
70 static void CompactionStats(CompactionSpaceCollection** spaces, | |
71 AllocationSpace id, int num_spaces, | |
72 intptr_t* capacity, intptr_t* size); | |
73 static void TestCompactionSpaceDivide(int num_additional_objects, | |
74 int object_size, | |
75 int num_compaction_spaces, | |
76 int additional_capacity_in_bytes); | |
77 }; | |
78 | |
79 } // namespace internal | |
80 } // namespace v8 | |
81 | |
82 #endif // HEAP_TESTER_H_ | |
OLD | NEW |