| 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 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 template<typename T> static Address reallocate(void* previous, size_t); | 912 template<typename T> static Address reallocate(void* previous, size_t); |
| 913 | 913 |
| 914 static void collectGarbage(ThreadState::StackState, ThreadState::CauseOfGC =
ThreadState::NormalGC); | 914 static void collectGarbage(ThreadState::StackState, ThreadState::CauseOfGC =
ThreadState::NormalGC); |
| 915 static void collectGarbageForTerminatingThread(ThreadState*); | 915 static void collectGarbageForTerminatingThread(ThreadState*); |
| 916 static void collectAllGarbage(); | 916 static void collectAllGarbage(); |
| 917 template<CallbackInvocationMode Mode> static void processMarkingStack(); | 917 template<CallbackInvocationMode Mode> static void processMarkingStack(); |
| 918 static void postMarkingProcessing(); | 918 static void postMarkingProcessing(); |
| 919 static void globalWeakProcessing(); | 919 static void globalWeakProcessing(); |
| 920 static void setForcePreciseGCForTesting(); | 920 static void setForcePreciseGCForTesting(); |
| 921 | 921 |
| 922 static void prepareForGC(); | 922 static void preGC(); |
| 923 static void postGC(); |
| 923 | 924 |
| 924 // Conservatively checks whether an address is a pointer in any of the threa
d | 925 // Conservatively checks whether an address is a pointer in any of the threa
d |
| 925 // heaps. If so marks the object pointed to as live. | 926 // heaps. If so marks the object pointed to as live. |
| 926 static Address checkAndMarkPointer(Visitor*, Address); | 927 static Address checkAndMarkPointer(Visitor*, Address); |
| 927 | 928 |
| 928 #if ENABLE(GC_PROFILE_MARKING) | 929 #if ENABLE(GC_PROFILE_MARKING) |
| 929 // Dump the path to specified object on the next GC. This method is to be in
voked from GDB. | 930 // Dump the path to specified object on the next GC. This method is to be in
voked from GDB. |
| 930 static void dumpPathToObjectOnNextGC(void* p); | 931 static void dumpPathToObjectOnNextGC(void* p); |
| 931 | 932 |
| 932 // Forcibly find GCInfo of the object at Address. | 933 // Forcibly find GCInfo of the object at Address. |
| 933 // This is slow and should only be used for debug purposes. | 934 // This is slow and should only be used for debug purposes. |
| 934 // It involves finding the heap page and scanning the heap page for an objec
t header. | 935 // It involves finding the heap page and scanning the heap page for an objec
t header. |
| 935 static const GCInfo* findGCInfo(Address); | 936 static const GCInfo* findGCInfo(Address); |
| 936 | 937 |
| 937 static String createBacktraceString(); | 938 static String createBacktraceString(); |
| 938 #endif | 939 #endif |
| 939 | 940 |
| 940 static size_t objectPayloadSizeForTesting(); | 941 static size_t objectPayloadSizeForTesting(); |
| 941 | 942 |
| 942 static void flushHeapDoesNotContainCache(); | 943 static void flushHeapDoesNotContainCache(); |
| 943 | 944 |
| 944 // Return true if the last GC found a pointer into a heap page | 945 // Return true if the last GC found a pointer into a heap page |
| 945 // during conservative scanning. | 946 // during conservative scanning. |
| 946 static bool lastGCWasConservative() { return s_lastGCWasConservative; } | 947 static bool lastGCWasConservative() { return s_lastGCWasConservative; } |
| 947 | 948 |
| 949 static void enterGC() { ASSERT(!s_inGC); s_inGC = true; } |
| 950 static void leaveGC() { ASSERT(s_inGC); s_inGC = false; } |
| 951 static bool isInGC() { return s_inGC; } |
| 952 |
| 948 static FreePagePool* freePagePool() { return s_freePagePool; } | 953 static FreePagePool* freePagePool() { return s_freePagePool; } |
| 949 static OrphanedPagePool* orphanedPagePool() { return s_orphanedPagePool; } | 954 static OrphanedPagePool* orphanedPagePool() { return s_orphanedPagePool; } |
| 950 | 955 |
| 951 // This look-up uses the region search tree and a negative contains cache to | 956 // This look-up uses the region search tree and a negative contains cache to |
| 952 // provide an efficient mapping from arbitrary addresses to the containing | 957 // provide an efficient mapping from arbitrary addresses to the containing |
| 953 // heap-page if one exists. | 958 // heap-page if one exists. |
| 954 static BaseHeapPage* lookup(Address); | 959 static BaseHeapPage* lookup(Address); |
| 955 static void addPageMemoryRegion(PageMemoryRegion*); | 960 static void addPageMemoryRegion(PageMemoryRegion*); |
| 956 static void removePageMemoryRegion(PageMemoryRegion*); | 961 static void removePageMemoryRegion(PageMemoryRegion*); |
| 957 | 962 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 977 } | 982 } |
| 978 PageMemoryRegion* lookup(Address); | 983 PageMemoryRegion* lookup(Address); |
| 979 static void add(RegionTree*, RegionTree**); | 984 static void add(RegionTree*, RegionTree**); |
| 980 static void remove(PageMemoryRegion*, RegionTree**); | 985 static void remove(PageMemoryRegion*, RegionTree**); |
| 981 private: | 986 private: |
| 982 PageMemoryRegion* m_region; | 987 PageMemoryRegion* m_region; |
| 983 RegionTree* m_left; | 988 RegionTree* m_left; |
| 984 RegionTree* m_right; | 989 RegionTree* m_right; |
| 985 }; | 990 }; |
| 986 | 991 |
| 987 static void resetAllocatedObjectSize() { ASSERT(ThreadState::isAnyThreadInGC
()); s_allocatedObjectSize = 0; } | 992 static void resetAllocatedObjectSize() { ASSERT(Heap::isInGC()); s_allocated
ObjectSize = 0; } |
| 988 static void resetMarkedObjectSize() { ASSERT(ThreadState::isAnyThreadInGC())
; s_markedObjectSize = 0; } | 993 static void resetMarkedObjectSize() { ASSERT(Heap::isInGC()); s_markedObject
Size = 0; } |
| 989 | 994 |
| 990 static Visitor* s_markingVisitor; | 995 static Visitor* s_markingVisitor; |
| 991 static CallbackStack* s_markingStack; | 996 static CallbackStack* s_markingStack; |
| 992 static CallbackStack* s_postMarkingCallbackStack; | 997 static CallbackStack* s_postMarkingCallbackStack; |
| 993 static CallbackStack* s_weakCallbackStack; | 998 static CallbackStack* s_weakCallbackStack; |
| 994 static CallbackStack* s_ephemeronStack; | 999 static CallbackStack* s_ephemeronStack; |
| 995 static HeapDoesNotContainCache* s_heapDoesNotContainCache; | 1000 static HeapDoesNotContainCache* s_heapDoesNotContainCache; |
| 996 static bool s_shutdownCalled; | 1001 static bool s_shutdownCalled; |
| 997 static bool s_lastGCWasConservative; | 1002 static bool s_lastGCWasConservative; |
| 1003 static bool s_inGC; |
| 998 static FreePagePool* s_freePagePool; | 1004 static FreePagePool* s_freePagePool; |
| 999 static OrphanedPagePool* s_orphanedPagePool; | 1005 static OrphanedPagePool* s_orphanedPagePool; |
| 1000 static RegionTree* s_regionTree; | 1006 static RegionTree* s_regionTree; |
| 1001 static size_t s_allocatedSpace; | 1007 static size_t s_allocatedSpace; |
| 1002 static size_t s_allocatedObjectSize; | 1008 static size_t s_allocatedObjectSize; |
| 1003 static size_t s_markedObjectSize; | 1009 static size_t s_markedObjectSize; |
| 1004 friend class ThreadState; | 1010 friend class ThreadState; |
| 1005 }; | 1011 }; |
| 1006 | 1012 |
| 1007 // The NoAllocationScope class is used in debug mode to catch unwanted | 1013 // The NoAllocationScope class is used in debug mode to catch unwanted |
| (...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2340 template<typename T, size_t inlineCapacity> | 2346 template<typename T, size_t inlineCapacity> |
| 2341 struct GCInfoTrait<HeapVector<T, inlineCapacity> > : public GCInfoTrait<Vector<T
, inlineCapacity, HeapAllocator> > { }; | 2347 struct GCInfoTrait<HeapVector<T, inlineCapacity> > : public GCInfoTrait<Vector<T
, inlineCapacity, HeapAllocator> > { }; |
| 2342 template<typename T, size_t inlineCapacity> | 2348 template<typename T, size_t inlineCapacity> |
| 2343 struct GCInfoTrait<HeapDeque<T, inlineCapacity> > : public GCInfoTrait<Deque<T,
inlineCapacity, HeapAllocator> > { }; | 2349 struct GCInfoTrait<HeapDeque<T, inlineCapacity> > : public GCInfoTrait<Deque<T,
inlineCapacity, HeapAllocator> > { }; |
| 2344 template<typename T, typename U, typename V> | 2350 template<typename T, typename U, typename V> |
| 2345 struct GCInfoTrait<HeapHashCountedSet<T, U, V> > : public GCInfoTrait<HashCounte
dSet<T, U, V, HeapAllocator> > { }; | 2351 struct GCInfoTrait<HeapHashCountedSet<T, U, V> > : public GCInfoTrait<HashCounte
dSet<T, U, V, HeapAllocator> > { }; |
| 2346 | 2352 |
| 2347 } // namespace blink | 2353 } // namespace blink |
| 2348 | 2354 |
| 2349 #endif // Heap_h | 2355 #endif // Heap_h |
| OLD | NEW |