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