| 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 24 matching lines...) Expand all Loading... |
| 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/ThreadState.h" | 38 #include "platform/heap/ThreadState.h" |
| 39 #include "platform/heap/Visitor.h" | 39 #include "platform/heap/Visitor.h" |
| 40 #include "wtf/AddressSanitizer.h" | 40 #include "wtf/AddressSanitizer.h" |
| 41 #include "wtf/Allocator.h" | 41 #include "wtf/Allocator.h" |
| 42 #include "wtf/Assertions.h" | 42 #include "wtf/Assertions.h" |
| 43 #include "wtf/Atomics.h" | 43 #include "wtf/Atomics.h" |
| 44 #include "wtf/Forward.h" | 44 #include "wtf/Forward.h" |
| 45 #include <memory> | |
| 46 | 45 |
| 47 namespace blink { | 46 namespace blink { |
| 48 | 47 |
| 49 class PLATFORM_EXPORT HeapAllocHooks { | 48 class PLATFORM_EXPORT HeapAllocHooks { |
| 50 public: | 49 public: |
| 51 // TODO(hajimehoshi): Pass a type name of the allocated object. | 50 // TODO(hajimehoshi): Pass a type name of the allocated object. |
| 52 typedef void AllocationHook(Address, size_t, const char*); | 51 typedef void AllocationHook(Address, size_t, const char*); |
| 53 typedef void FreeHook(Address); | 52 typedef void FreeHook(Address); |
| 54 | 53 |
| 55 static void setAllocationHook(AllocationHook* hook) { m_allocationHook = hoo
k; } | 54 static void setAllocationHook(AllocationHook* hook) { m_allocationHook = hoo
k; } |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 void resetHeapCounters(); | 396 void resetHeapCounters(); |
| 398 | 397 |
| 399 static int arenaIndexForObjectSize(size_t); | 398 static int arenaIndexForObjectSize(size_t); |
| 400 static bool isNormalArenaIndex(int); | 399 static bool isNormalArenaIndex(int); |
| 401 | 400 |
| 402 void decommitCallbackStacks(); | 401 void decommitCallbackStacks(); |
| 403 | 402 |
| 404 RecursiveMutex m_threadAttachMutex; | 403 RecursiveMutex m_threadAttachMutex; |
| 405 ThreadStateSet m_threads; | 404 ThreadStateSet m_threads; |
| 406 ThreadHeapStats m_stats; | 405 ThreadHeapStats m_stats; |
| 407 std::unique_ptr<RegionTree> m_regionTree; | 406 OwnPtr<RegionTree> m_regionTree; |
| 408 std::unique_ptr<HeapDoesNotContainCache> m_heapDoesNotContainCache; | 407 OwnPtr<HeapDoesNotContainCache> m_heapDoesNotContainCache; |
| 409 std::unique_ptr<SafePointBarrier> m_safePointBarrier; | 408 OwnPtr<SafePointBarrier> m_safePointBarrier; |
| 410 std::unique_ptr<FreePagePool> m_freePagePool; | 409 OwnPtr<FreePagePool> m_freePagePool; |
| 411 std::unique_ptr<OrphanedPagePool> m_orphanedPagePool; | 410 OwnPtr<OrphanedPagePool> m_orphanedPagePool; |
| 412 std::unique_ptr<CallbackStack> m_markingStack; | 411 OwnPtr<CallbackStack> m_markingStack; |
| 413 std::unique_ptr<CallbackStack> m_postMarkingCallbackStack; | 412 OwnPtr<CallbackStack> m_postMarkingCallbackStack; |
| 414 std::unique_ptr<CallbackStack> m_globalWeakCallbackStack; | 413 OwnPtr<CallbackStack> m_globalWeakCallbackStack; |
| 415 std::unique_ptr<CallbackStack> m_ephemeronStack; | 414 OwnPtr<CallbackStack> m_ephemeronStack; |
| 416 BlinkGC::GCReason m_lastGCReason; | 415 BlinkGC::GCReason m_lastGCReason; |
| 417 | 416 |
| 418 static ThreadHeap* s_mainThreadHeap; | 417 static ThreadHeap* s_mainThreadHeap; |
| 419 | 418 |
| 420 friend class ThreadState; | 419 friend class ThreadState; |
| 421 }; | 420 }; |
| 422 | 421 |
| 423 template<typename T> | 422 template<typename T> |
| 424 struct IsEagerlyFinalizedType { | 423 struct IsEagerlyFinalizedType { |
| 425 STATIC_ONLY(IsEagerlyFinalizedType); | 424 STATIC_ONLY(IsEagerlyFinalizedType); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object) | 621 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object) |
| 623 { | 622 { |
| 624 T** cell = reinterpret_cast<T**>(object); | 623 T** cell = reinterpret_cast<T**>(object); |
| 625 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) | 624 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) |
| 626 *cell = nullptr; | 625 *cell = nullptr; |
| 627 } | 626 } |
| 628 | 627 |
| 629 } // namespace blink | 628 } // namespace blink |
| 630 | 629 |
| 631 #endif // Heap_h | 630 #endif // Heap_h |
| OLD | NEW |