| 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 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef Heap_h | 31 #ifndef Heap_h |
| 32 #define Heap_h | 32 #define Heap_h |
| 33 | 33 |
| 34 #include "platform/PlatformExport.h" | 34 #include "platform/PlatformExport.h" |
| 35 #include "platform/heap/GCInfo.h" | 35 #include "platform/heap/GCInfo.h" |
| 36 #include "platform/heap/HeapPage.h" | 36 #include "platform/heap/HeapPage.h" |
| 37 #include "platform/heap/PageMemory.h" | 37 #include "platform/heap/PageMemory.h" |
| 38 #include "platform/heap/StackFrameDepth.h" |
| 38 #include "platform/heap/ThreadState.h" | 39 #include "platform/heap/ThreadState.h" |
| 39 #include "platform/heap/Visitor.h" | 40 #include "platform/heap/Visitor.h" |
| 40 #include "wtf/AddressSanitizer.h" | 41 #include "wtf/AddressSanitizer.h" |
| 41 #include "wtf/Allocator.h" | 42 #include "wtf/Allocator.h" |
| 42 #include "wtf/Assertions.h" | 43 #include "wtf/Assertions.h" |
| 43 #include "wtf/Atomics.h" | 44 #include "wtf/Atomics.h" |
| 44 #include "wtf/Forward.h" | 45 #include "wtf/Forward.h" |
| 45 #include <memory> | 46 #include <memory> |
| 46 | 47 |
| 47 namespace blink { | 48 namespace blink { |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 static inline bool isHeapObjectAlive(const UntracedMember<T>& member) | 225 static inline bool isHeapObjectAlive(const UntracedMember<T>& member) |
| 225 { | 226 { |
| 226 return isHeapObjectAlive(member.get()); | 227 return isHeapObjectAlive(member.get()); |
| 227 } | 228 } |
| 228 template<typename T> | 229 template<typename T> |
| 229 static inline bool isHeapObjectAlive(const T*& ptr) | 230 static inline bool isHeapObjectAlive(const T*& ptr) |
| 230 { | 231 { |
| 231 return isHeapObjectAlive(ptr); | 232 return isHeapObjectAlive(ptr); |
| 232 } | 233 } |
| 233 | 234 |
| 235 StackFrameDepth& stackFrameDepth() { return m_stackFrameDepth; } |
| 236 |
| 234 RecursiveMutex& threadAttachMutex() { return m_threadAttachMutex; } | 237 RecursiveMutex& threadAttachMutex() { return m_threadAttachMutex; } |
| 235 const ThreadStateSet& threads() const { return m_threads; } | 238 const ThreadStateSet& threads() const { return m_threads; } |
| 236 ThreadHeapStats& heapStats() { return m_stats; } | 239 ThreadHeapStats& heapStats() { return m_stats; } |
| 237 SafePointBarrier* safePointBarrier() { return m_safePointBarrier.get(); } | 240 SafePointBarrier* safePointBarrier() { return m_safePointBarrier.get(); } |
| 238 CallbackStack* markingStack() const { return m_markingStack.get(); } | 241 CallbackStack* markingStack() const { return m_markingStack.get(); } |
| 239 CallbackStack* postMarkingCallbackStack() const { return m_postMarkingCallba
ckStack.get(); } | 242 CallbackStack* postMarkingCallbackStack() const { return m_postMarkingCallba
ckStack.get(); } |
| 240 CallbackStack* globalWeakCallbackStack() const { return m_globalWeakCallback
Stack.get(); } | 243 CallbackStack* globalWeakCallbackStack() const { return m_globalWeakCallback
Stack.get(); } |
| 241 CallbackStack* ephemeronStack() const { return m_ephemeronStack.get(); } | 244 CallbackStack* ephemeronStack() const { return m_ephemeronStack.get(); } |
| 242 | 245 |
| 243 void attach(ThreadState*); | 246 void attach(ThreadState*); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 std::unique_ptr<RegionTree> m_regionTree; | 408 std::unique_ptr<RegionTree> m_regionTree; |
| 406 std::unique_ptr<HeapDoesNotContainCache> m_heapDoesNotContainCache; | 409 std::unique_ptr<HeapDoesNotContainCache> m_heapDoesNotContainCache; |
| 407 std::unique_ptr<SafePointBarrier> m_safePointBarrier; | 410 std::unique_ptr<SafePointBarrier> m_safePointBarrier; |
| 408 std::unique_ptr<FreePagePool> m_freePagePool; | 411 std::unique_ptr<FreePagePool> m_freePagePool; |
| 409 std::unique_ptr<OrphanedPagePool> m_orphanedPagePool; | 412 std::unique_ptr<OrphanedPagePool> m_orphanedPagePool; |
| 410 std::unique_ptr<CallbackStack> m_markingStack; | 413 std::unique_ptr<CallbackStack> m_markingStack; |
| 411 std::unique_ptr<CallbackStack> m_postMarkingCallbackStack; | 414 std::unique_ptr<CallbackStack> m_postMarkingCallbackStack; |
| 412 std::unique_ptr<CallbackStack> m_globalWeakCallbackStack; | 415 std::unique_ptr<CallbackStack> m_globalWeakCallbackStack; |
| 413 std::unique_ptr<CallbackStack> m_ephemeronStack; | 416 std::unique_ptr<CallbackStack> m_ephemeronStack; |
| 414 BlinkGC::GCReason m_lastGCReason; | 417 BlinkGC::GCReason m_lastGCReason; |
| 418 StackFrameDepth m_stackFrameDepth; |
| 415 | 419 |
| 416 static ThreadHeap* s_mainThreadHeap; | 420 static ThreadHeap* s_mainThreadHeap; |
| 417 | 421 |
| 418 friend class ThreadState; | 422 friend class ThreadState; |
| 419 }; | 423 }; |
| 420 | 424 |
| 421 template<typename T> | 425 template<typename T> |
| 422 struct IsEagerlyFinalizedType { | 426 struct IsEagerlyFinalizedType { |
| 423 STATIC_ONLY(IsEagerlyFinalizedType); | 427 STATIC_ONLY(IsEagerlyFinalizedType); |
| 424 private: | 428 private: |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object) | 624 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object) |
| 621 { | 625 { |
| 622 T** cell = reinterpret_cast<T**>(object); | 626 T** cell = reinterpret_cast<T**>(object); |
| 623 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) | 627 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) |
| 624 *cell = nullptr; | 628 *cell = nullptr; |
| 625 } | 629 } |
| 626 | 630 |
| 627 } // namespace blink | 631 } // namespace blink |
| 628 | 632 |
| 629 #endif // Heap_h | 633 #endif // Heap_h |
| OLD | NEW |