| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 The Chromium 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 BlinkGC_h |
| 6 #define BlinkGC_h |
| 7 |
| 8 // BlinkGC.h is a file that defines common things used by Blink GC. |
| 9 |
| 10 #include "wtf/Allocator.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 class Visitor; |
| 15 |
| 16 #define PRINT_HEAP_STATS 0 // Enable this macro to print heap stats to stderr. |
| 17 |
| 18 using Address = uint8_t*; |
| 19 |
| 20 using FinalizationCallback = void (*)(void*); |
| 21 using VisitorCallback = void (*)(Visitor*, void* self); |
| 22 using TraceCallback = VisitorCallback; |
| 23 using WeakCallback = VisitorCallback; |
| 24 using EphemeronCallback = VisitorCallback; |
| 25 using PreFinalizerCallback = bool(*)(void*); |
| 26 |
| 27 // List of typed heaps. The list is used to generate the implementation |
| 28 // of typed heap related methods. |
| 29 // |
| 30 // To create a new typed heap add a H(<ClassName>) to the |
| 31 // FOR_EACH_TYPED_HEAP macro below. |
| 32 #define FOR_EACH_TYPED_HEAP(H) \ |
| 33 H(Node) \ |
| 34 H(CSSValue) |
| 35 |
| 36 #define TypedHeapEnumName(Type) Type##HeapIndex, |
| 37 |
| 38 class PLATFORM_EXPORT BlinkGC final { |
| 39 STATIC_ONLY(BlinkGC); |
| 40 public: |
| 41 // When garbage collecting we need to know whether or not there |
| 42 // can be pointers to Blink GC managed objects on the stack for |
| 43 // each thread. When threads reach a safe point they record |
| 44 // whether or not they have pointers on the stack. |
| 45 enum StackState { |
| 46 NoHeapPointersOnStack, |
| 47 HeapPointersOnStack |
| 48 }; |
| 49 |
| 50 enum GCType { |
| 51 // Both of the marking task and the sweeping task run in |
| 52 // Heap::collectGarbage(). |
| 53 GCWithSweep, |
| 54 // Only the marking task runs in Heap::collectGarbage(). |
| 55 // The sweeping task is split into chunks and scheduled lazily. |
| 56 GCWithoutSweep, |
| 57 // Only the marking task runs just to take a heap snapshot. |
| 58 // The sweeping task doesn't run. The marks added in the marking task |
| 59 // are just cleared. |
| 60 TakeSnapshot, |
| 61 // The marking task does not mark objects outside the heap of the GCing |
| 62 // thread. |
| 63 ThreadTerminationGC, |
| 64 }; |
| 65 |
| 66 enum HeapIndices { |
| 67 EagerSweepHeapIndex = 0, |
| 68 NormalPage1HeapIndex, |
| 69 NormalPage2HeapIndex, |
| 70 NormalPage3HeapIndex, |
| 71 NormalPage4HeapIndex, |
| 72 Vector1HeapIndex, |
| 73 Vector2HeapIndex, |
| 74 Vector3HeapIndex, |
| 75 Vector4HeapIndex, |
| 76 InlineVectorHeapIndex, |
| 77 HashTableHeapIndex, |
| 78 FOR_EACH_TYPED_HEAP(TypedHeapEnumName) |
| 79 LargeObjectHeapIndex, |
| 80 // Values used for iteration of heap segments. |
| 81 NumberOfHeaps, |
| 82 }; |
| 83 |
| 84 #if defined(ADDRESS_SANITIZER) |
| 85 // Heaps can have their object payloads be poisoned, or cleared |
| 86 // of their poisoning. |
| 87 enum Poisoning { |
| 88 SetPoison, |
| 89 ClearPoison, |
| 90 }; |
| 91 |
| 92 enum ObjectsToPoison { |
| 93 UnmarkedOnly, |
| 94 MarkedAndUnmarked, |
| 95 }; |
| 96 #endif |
| 97 |
| 98 enum V8GCType { |
| 99 V8MinorGC, |
| 100 V8MajorGC, |
| 101 }; |
| 102 }; |
| 103 |
| 104 } // namespace blink |
| 105 |
| 106 #endif |
| OLD | NEW |