OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "wtf/Vector.h" | 44 #include "wtf/Vector.h" |
45 #include "wtf/text/StringHash.h" | 45 #include "wtf/text/StringHash.h" |
46 #include "wtf/text/WTFString.h" | 46 #include "wtf/text/WTFString.h" |
47 | 47 |
48 namespace v8 { | 48 namespace v8 { |
49 class Isolate; | 49 class Isolate; |
50 }; | 50 }; |
51 | 51 |
52 namespace blink { | 52 namespace blink { |
53 | 53 |
54 class BaseHeapPage; | 54 class BasePage; |
55 class CallbackStack; | 55 class CallbackStack; |
56 struct GCInfo; | 56 struct GCInfo; |
57 class HeapObjectHeader; | 57 class HeapObjectHeader; |
58 class PageMemoryRegion; | 58 class PageMemoryRegion; |
59 class PageMemory; | 59 class PageMemory; |
60 class PersistentNode; | 60 class PersistentNode; |
61 class SafePointBarrier; | 61 class SafePointBarrier; |
62 class SafePointAwareMutexLocker; | 62 class SafePointAwareMutexLocker; |
63 class ThreadHeap; | 63 class BaseHeap; |
64 class ThreadState; | 64 class ThreadState; |
65 class Visitor; | 65 class Visitor; |
66 | 66 |
67 using Address = uint8_t*; | 67 using Address = uint8_t*; |
68 | 68 |
69 using FinalizationCallback = void (*)(void*); | 69 using FinalizationCallback = void (*)(void*); |
70 using VisitorCallback = void (*)(Visitor*, void* self); | 70 using VisitorCallback = void (*)(Visitor*, void* self); |
71 using TraceCallback = VisitorCallback; | 71 using TraceCallback = VisitorCallback; |
72 using WeakPointerCallback = VisitorCallback; | 72 using WeakPointerCallback = VisitorCallback; |
73 using EphemeronCallback = VisitorCallback; | 73 using EphemeronCallback = VisitorCallback; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // of typed heap related methods. | 172 // of typed heap related methods. |
173 // | 173 // |
174 // To create a new typed heap add a H(<ClassName>) to the | 174 // To create a new typed heap add a H(<ClassName>) to the |
175 // FOR_EACH_TYPED_HEAP macro below. | 175 // FOR_EACH_TYPED_HEAP macro below. |
176 #define FOR_EACH_TYPED_HEAP(H) \ | 176 #define FOR_EACH_TYPED_HEAP(H) \ |
177 H(Node) \ | 177 H(Node) \ |
178 H(CSSValue) | 178 H(CSSValue) |
179 | 179 |
180 #define TypedHeapEnumName(Type) Type##Heap, | 180 #define TypedHeapEnumName(Type) Type##Heap, |
181 | 181 |
182 enum TypedHeaps { | 182 enum HeapIndices { |
183 GeneralHeap = 0, | 183 NormalPageHeapIndex = 0, |
184 VectorBackingHeap, | 184 VectorHeapIndex, |
185 InlineVectorBackingHeap, | 185 InlineVectorHeapIndex, |
186 HashTableBackingHeap, | 186 HashTableHeapIndex, |
187 FOR_EACH_TYPED_HEAP(TypedHeapEnumName) | 187 FOR_EACH_TYPED_HEAP(TypedHeapEnumName) |
188 LargeObjectHeap, | 188 LargeObjectHeapIndex, |
189 // Values used for iteration of heap segments. | 189 // Values used for iteration of heap segments. |
190 NumberOfHeaps, | 190 NumberOfHeaps, |
191 }; | 191 }; |
192 | 192 |
193 #if ENABLE(GC_PROFILING) | 193 #if ENABLE(GC_PROFILING) |
194 const size_t numberOfGenerationsToTrack = 8; | 194 const size_t numberOfGenerationsToTrack = 8; |
195 const size_t maxHeapObjectAge = numberOfGenerationsToTrack - 1; | 195 const size_t maxHeapObjectAge = numberOfGenerationsToTrack - 1; |
196 | 196 |
197 struct AgeCounts { | 197 struct AgeCounts { |
198 int ages[numberOfGenerationsToTrack]; | 198 int ages[numberOfGenerationsToTrack]; |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 void recordStackEnd(intptr_t* endOfStack) | 474 void recordStackEnd(intptr_t* endOfStack) |
475 { | 475 { |
476 m_endOfStack = endOfStack; | 476 m_endOfStack = endOfStack; |
477 } | 477 } |
478 | 478 |
479 // Get one of the heap structures for this thread. | 479 // Get one of the heap structures for this thread. |
480 // | 480 // |
481 // The heap is split into multiple heap parts based on object | 481 // The heap is split into multiple heap parts based on object |
482 // types. To get the index for a given type, use | 482 // types. To get the index for a given type, use |
483 // HeapIndexTrait<Type>::index. | 483 // HeapIndexTrait<Type>::index. |
484 ThreadHeap* heap(int heapIndex) const { return m_heaps[heapIndex]; } | 484 BaseHeap* heap(int heapIndex) const { return m_heaps[heapIndex]; } |
485 | 485 |
486 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) | 486 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) |
487 // Infrastructure to determine if an address is within one of the | 487 // Infrastructure to determine if an address is within one of the |
488 // address ranges for the Blink heap. If the address is in the Blink | 488 // address ranges for the Blink heap. If the address is in the Blink |
489 // heap the containing heap page is returned. | 489 // heap the containing heap page is returned. |
490 BaseHeapPage* findPageFromAddress(Address); | 490 BasePage* findPageFromAddress(Address); |
491 BaseHeapPage* findPageFromAddress(void* pointer) { return findPageFromAddres
s(reinterpret_cast<Address>(pointer)); } | 491 BasePage* findPageFromAddress(void* pointer) { return findPageFromAddress(re
interpret_cast<Address>(pointer)); } |
492 #endif | 492 #endif |
493 | 493 |
494 // List of persistent roots allocated on the given thread. | 494 // List of persistent roots allocated on the given thread. |
495 PersistentNode* roots() const { return m_persistents.get(); } | 495 PersistentNode* roots() const { return m_persistents.get(); } |
496 | 496 |
497 // List of global persistent roots not owned by any particular thread. | 497 // List of global persistent roots not owned by any particular thread. |
498 // globalRootsMutex must be acquired before any modifications. | 498 // globalRootsMutex must be acquired before any modifications. |
499 static PersistentNode& globalRoots(); | 499 static PersistentNode& globalRoots(); |
500 static Mutex& globalRootsMutex(); | 500 static Mutex& globalRootsMutex(); |
501 | 501 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 intptr_t* m_endOfStack; | 659 intptr_t* m_endOfStack; |
660 void* m_safePointScopeMarker; | 660 void* m_safePointScopeMarker; |
661 Vector<Address> m_safePointStackCopy; | 661 Vector<Address> m_safePointStackCopy; |
662 bool m_atSafePoint; | 662 bool m_atSafePoint; |
663 Vector<Interruptor*> m_interruptors; | 663 Vector<Interruptor*> m_interruptors; |
664 bool m_hasPendingIdleTask; | 664 bool m_hasPendingIdleTask; |
665 bool m_didV8GCAfterLastGC; | 665 bool m_didV8GCAfterLastGC; |
666 bool m_sweepForbidden; | 666 bool m_sweepForbidden; |
667 size_t m_noAllocationCount; | 667 size_t m_noAllocationCount; |
668 size_t m_allocatedObjectSizeBeforeGC; | 668 size_t m_allocatedObjectSizeBeforeGC; |
669 ThreadHeap* m_heaps[NumberOfHeaps]; | 669 BaseHeap* m_heaps[NumberOfHeaps]; |
670 | 670 |
671 Vector<OwnPtr<CleanupTask>> m_cleanupTasks; | 671 Vector<OwnPtr<CleanupTask>> m_cleanupTasks; |
672 bool m_isTerminating; | 672 bool m_isTerminating; |
673 | 673 |
674 bool m_shouldFlushHeapDoesNotContainCache; | 674 bool m_shouldFlushHeapDoesNotContainCache; |
675 double m_collectionRate; | 675 double m_collectionRate; |
676 GCState m_gcState; | 676 GCState m_gcState; |
677 | 677 |
678 CallbackStack* m_weakCallbackStack; | 678 CallbackStack* m_weakCallbackStack; |
679 HashMap<void*, bool (*)(void*, Visitor&)> m_preFinalizers; | 679 HashMap<void*, bool (*)(void*, Visitor&)> m_preFinalizers; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 m_locked = false; | 760 m_locked = false; |
761 } | 761 } |
762 | 762 |
763 MutexBase& m_mutex; | 763 MutexBase& m_mutex; |
764 bool m_locked; | 764 bool m_locked; |
765 }; | 765 }; |
766 | 766 |
767 } // namespace blink | 767 } // namespace blink |
768 | 768 |
769 #endif // ThreadState_h | 769 #endif // ThreadState_h |
OLD | NEW |