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 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
852 // iteration). | 852 // iteration). |
853 static void pushPostMarkingCallback(void*, TraceCallback); | 853 static void pushPostMarkingCallback(void*, TraceCallback); |
854 | 854 |
855 // Add a weak pointer callback to the weak callback work list. General | 855 // Add a weak pointer callback to the weak callback work list. General |
856 // object pointer callbacks are added to a thread local weak callback work | 856 // object pointer callbacks are added to a thread local weak callback work |
857 // list and the callback is called on the thread that owns the object, with | 857 // list and the callback is called on the thread that owns the object, with |
858 // the closure pointer as an argument. Most of the time, the closure and | 858 // the closure pointer as an argument. Most of the time, the closure and |
859 // the containerObject can be the same thing, but the containerObject is | 859 // the containerObject can be the same thing, but the containerObject is |
860 // constrained to be on the heap, since the heap is used to identify the | 860 // constrained to be on the heap, since the heap is used to identify the |
861 // correct thread. | 861 // correct thread. |
862 static void pushWeakPointerCallback(void* closure, void* containerObject, We akPointerCallback); | 862 static void pushThreadLocalWeakCallback(void* closure, void* containerObject , WeakPointerCallback); |
sof
2015/05/22 09:07:48
Wouldn't it make sense to rename WeakPointerCallba
haraken
2015/05/22 10:07:08
Done.
| |
863 | 863 |
864 // Similar to the more general pushWeakPointerCallback, but cell | 864 // Similar to the more general pushThreadLocalWeakCallback, but cell |
865 // pointer callbacks are added to a static callback work list and the weak | 865 // pointer callbacks are added to a static callback work list and the weak |
866 // callback is performed on the thread performing garbage collection. This | 866 // callback is performed on the thread performing garbage collection. This |
867 // is OK because cells are just cleared and no deallocation can happen. | 867 // is OK because cells are just cleared and no deallocation can happen. |
868 static void pushWeakCellPointerCallback(void** cell, WeakPointerCallback); | 868 static void pushGlobalWeakCallback(void** cell, WeakPointerCallback); |
869 | 869 |
870 // Pop the top of a marking stack and call the callback with the visitor | 870 // Pop the top of a marking stack and call the callback with the visitor |
871 // and the object. Returns false when there is nothing more to do. | 871 // and the object. Returns false when there is nothing more to do. |
872 static bool popAndInvokeTraceCallback(Visitor*); | 872 static bool popAndInvokeTraceCallback(Visitor*); |
873 | 873 |
874 // Remove an item from the post-marking callback stack and call | 874 // Remove an item from the post-marking callback stack and call |
875 // the callback with the visitor and the object pointer. Returns | 875 // the callback with the visitor and the object pointer. Returns |
876 // false when there is nothing more to do. | 876 // false when there is nothing more to do. |
877 static bool popAndInvokePostMarkingCallback(Visitor*); | 877 static bool popAndInvokePostMarkingCallback(Visitor*); |
878 | 878 |
879 // Remove an item from the weak callback work list and call the callback | 879 // Remove an item from the weak callback work list and call the callback |
880 // with the visitor and the closure pointer. Returns false when there is | 880 // with the visitor and the closure pointer. Returns false when there is |
881 // nothing more to do. | 881 // nothing more to do. |
882 static bool popAndInvokeWeakPointerCallback(Visitor*); | 882 static bool popAndInvokeGlobalWeakCallback(Visitor*); |
883 | 883 |
884 // Register an ephemeron table for fixed-point iteration. | 884 // Register an ephemeron table for fixed-point iteration. |
885 static void registerWeakTable(void* containerObject, EphemeronCallback, Ephe meronCallback); | 885 static void registerWeakTable(void* containerObject, EphemeronCallback, Ephe meronCallback); |
886 #if ENABLE(ASSERT) | 886 #if ENABLE(ASSERT) |
887 static bool weakTableRegistered(const void*); | 887 static bool weakTableRegistered(const void*); |
888 #endif | 888 #endif |
889 | 889 |
890 static inline size_t allocationSizeFromSize(size_t size) | 890 static inline size_t allocationSizeFromSize(size_t size) |
891 { | 891 { |
892 // Check the size before computing the actual allocation size. The | 892 // Check the size before computing the actual allocation size. The |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1007 RegionTree* m_left; | 1007 RegionTree* m_left; |
1008 RegionTree* m_right; | 1008 RegionTree* m_right; |
1009 }; | 1009 }; |
1010 | 1010 |
1011 // Reset counters that track live and allocated-since-last-GC sizes. | 1011 // Reset counters that track live and allocated-since-last-GC sizes. |
1012 static void resetHeapCounters(); | 1012 static void resetHeapCounters(); |
1013 | 1013 |
1014 static Visitor* s_markingVisitor; | 1014 static Visitor* s_markingVisitor; |
1015 static CallbackStack* s_markingStack; | 1015 static CallbackStack* s_markingStack; |
1016 static CallbackStack* s_postMarkingCallbackStack; | 1016 static CallbackStack* s_postMarkingCallbackStack; |
1017 static CallbackStack* s_weakCallbackStack; | 1017 static CallbackStack* s_globalWeakCallbackStack; |
1018 static CallbackStack* s_ephemeronStack; | 1018 static CallbackStack* s_ephemeronStack; |
1019 static HeapDoesNotContainCache* s_heapDoesNotContainCache; | 1019 static HeapDoesNotContainCache* s_heapDoesNotContainCache; |
1020 static bool s_shutdownCalled; | 1020 static bool s_shutdownCalled; |
1021 static bool s_lastGCWasConservative; | 1021 static bool s_lastGCWasConservative; |
1022 static FreePagePool* s_freePagePool; | 1022 static FreePagePool* s_freePagePool; |
1023 static OrphanedPagePool* s_orphanedPagePool; | 1023 static OrphanedPagePool* s_orphanedPagePool; |
1024 static RegionTree* s_regionTree; | 1024 static RegionTree* s_regionTree; |
1025 static size_t s_allocatedSpace; | 1025 static size_t s_allocatedSpace; |
1026 static size_t s_allocatedObjectSize; | 1026 static size_t s_allocatedObjectSize; |
1027 static size_t s_markedObjectSize; | 1027 static size_t s_markedObjectSize; |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1266 size_t copySize = previousHeader->payloadSize(); | 1266 size_t copySize = previousHeader->payloadSize(); |
1267 if (copySize > size) | 1267 if (copySize > size) |
1268 copySize = size; | 1268 copySize = size; |
1269 memcpy(address, previous, copySize); | 1269 memcpy(address, previous, copySize); |
1270 return address; | 1270 return address; |
1271 } | 1271 } |
1272 | 1272 |
1273 } // namespace blink | 1273 } // namespace blink |
1274 | 1274 |
1275 #endif // Heap_h | 1275 #endif // Heap_h |
OLD | NEW |