| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BlinkGC_h | 5 #ifndef BlinkGC_h |
| 6 #define BlinkGC_h | 6 #define BlinkGC_h |
| 7 | 7 |
| 8 // BlinkGC.h is a file that defines common things used by Blink GC. | 8 // BlinkGC.h is a file that defines common things used by Blink GC. |
| 9 | 9 |
| 10 #include "platform/PlatformExport.h" | 10 #include "platform/PlatformExport.h" |
| 11 #include "wtf/Allocator.h" | 11 #include "wtf/Allocator.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class Visitor; | 15 class Visitor; |
| 16 | 16 |
| 17 #define PRINT_HEAP_STATS 0 // Enable this macro to print heap stats to stderr. | 17 #define PRINT_HEAP_STATS 0 // Enable this macro to print heap stats to stderr. |
| 18 | 18 |
| 19 using Address = uint8_t*; | 19 using Address = uint8_t*; |
| 20 | 20 |
| 21 using FinalizationCallback = void (*)(void*); | 21 using FinalizationCallback = void (*)(void*); |
| 22 using VisitorCallback = void (*)(Visitor*, void* self); | 22 using VisitorCallback = void (*)(Visitor*, void* self); |
| 23 using TraceCallback = VisitorCallback; | 23 using TraceCallback = VisitorCallback; |
| 24 using WeakCallback = VisitorCallback; | 24 using WeakCallback = VisitorCallback; |
| 25 using EphemeronCallback = VisitorCallback; | 25 using EphemeronCallback = VisitorCallback; |
| 26 using PreFinalizerCallback = bool(*)(void*); | 26 using PreFinalizerCallback = bool(*)(void*); |
| 27 | 27 |
| 28 // List of typed heaps. The list is used to generate the implementation | 28 // List of typed arenas. The list is used to generate the implementation |
| 29 // of typed heap related methods. | 29 // of typed arena related methods. |
| 30 // | 30 // |
| 31 // To create a new typed heap add a H(<ClassName>) to the | 31 // To create a new typed arena add a H(<ClassName>) to the |
| 32 // FOR_EACH_TYPED_HEAP macro below. | 32 // FOR_EACH_TYPED_ARENA macro below. |
| 33 #define FOR_EACH_TYPED_HEAP(H) \ | 33 #define FOR_EACH_TYPED_ARENA(H) \ |
| 34 H(Node) \ | 34 H(Node) \ |
| 35 H(CSSValue) | 35 H(CSSValue) |
| 36 | 36 |
| 37 #define TypedHeapEnumName(Type) Type##HeapIndex, | 37 #define TypedArenaEnumName(Type) Type##ArenaIndex, |
| 38 | 38 |
| 39 class PLATFORM_EXPORT BlinkGC final { | 39 class PLATFORM_EXPORT BlinkGC final { |
| 40 STATIC_ONLY(BlinkGC); | 40 STATIC_ONLY(BlinkGC); |
| 41 public: | 41 public: |
| 42 // When garbage collecting we need to know whether or not there | 42 // When garbage collecting we need to know whether or not there |
| 43 // can be pointers to Blink GC managed objects on the stack for | 43 // can be pointers to Blink GC managed objects on the stack for |
| 44 // each thread. When threads reach a safe point they record | 44 // each thread. When threads reach a safe point they record |
| 45 // whether or not they have pointers on the stack. | 45 // whether or not they have pointers on the stack. |
| 46 enum StackState { | 46 enum StackState { |
| 47 NoHeapPointersOnStack, | 47 NoHeapPointersOnStack, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 73 IdleGC, | 73 IdleGC, |
| 74 PreciseGC, | 74 PreciseGC, |
| 75 ConservativeGC, | 75 ConservativeGC, |
| 76 ForcedGC, | 76 ForcedGC, |
| 77 MemoryPressureGC, | 77 MemoryPressureGC, |
| 78 PageNavigationGC, | 78 PageNavigationGC, |
| 79 NumberOfGCReason, | 79 NumberOfGCReason, |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 enum HeapIndices { | 82 enum HeapIndices { |
| 83 EagerSweepHeapIndex = 0, | 83 EagerSweepArenaIndex = 0, |
| 84 NormalPage1HeapIndex, | 84 NormalPage1ArenaIndex, |
| 85 NormalPage2HeapIndex, | 85 NormalPage2ArenaIndex, |
| 86 NormalPage3HeapIndex, | 86 NormalPage3ArenaIndex, |
| 87 NormalPage4HeapIndex, | 87 NormalPage4ArenaIndex, |
| 88 Vector1HeapIndex, | 88 Vector1ArenaIndex, |
| 89 Vector2HeapIndex, | 89 Vector2ArenaIndex, |
| 90 Vector3HeapIndex, | 90 Vector3ArenaIndex, |
| 91 Vector4HeapIndex, | 91 Vector4ArenaIndex, |
| 92 InlineVectorHeapIndex, | 92 InlineVectorArenaIndex, |
| 93 HashTableHeapIndex, | 93 HashTableArenaIndex, |
| 94 FOR_EACH_TYPED_HEAP(TypedHeapEnumName) | 94 FOR_EACH_TYPED_ARENA(TypedArenaEnumName) |
| 95 LargeObjectHeapIndex, | 95 LargeObjectArenaIndex, |
| 96 // Values used for iteration of heap segments. | 96 // Values used for iteration of heap segments. |
| 97 NumberOfHeaps, | 97 NumberOfArenas, |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 #if defined(ADDRESS_SANITIZER) | 100 #if defined(ADDRESS_SANITIZER) |
| 101 // Heaps can have their object payloads be poisoned, or cleared | 101 // Heaps can have their object payloads be poisoned, or cleared |
| 102 // of their poisoning. | 102 // of their poisoning. |
| 103 enum Poisoning { | 103 enum Poisoning { |
| 104 SetPoison, | 104 SetPoison, |
| 105 ClearPoison, | 105 ClearPoison, |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 enum ObjectsToPoison { | 108 enum ObjectsToPoison { |
| 109 UnmarkedOnly, | 109 UnmarkedOnly, |
| 110 MarkedAndUnmarked, | 110 MarkedAndUnmarked, |
| 111 }; | 111 }; |
| 112 #endif | 112 #endif |
| 113 | 113 |
| 114 enum V8GCType { | 114 enum V8GCType { |
| 115 V8MinorGC, | 115 V8MinorGC, |
| 116 V8MajorGC, | 116 V8MajorGC, |
| 117 }; | 117 }; |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 } // namespace blink | 120 } // namespace blink |
| 121 | 121 |
| 122 #endif | 122 #endif |
| OLD | NEW |