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 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 // iteration). | 859 // iteration). |
860 static void pushPostMarkingCallback(void*, TraceCallback); | 860 static void pushPostMarkingCallback(void*, TraceCallback); |
861 | 861 |
862 // Add a weak pointer callback to the weak callback work list. General | 862 // Add a weak pointer callback to the weak callback work list. General |
863 // object pointer callbacks are added to a thread local weak callback work | 863 // object pointer callbacks are added to a thread local weak callback work |
864 // list and the callback is called on the thread that owns the object, with | 864 // list and the callback is called on the thread that owns the object, with |
865 // the closure pointer as an argument. Most of the time, the closure and | 865 // the closure pointer as an argument. Most of the time, the closure and |
866 // the containerObject can be the same thing, but the containerObject is | 866 // the containerObject can be the same thing, but the containerObject is |
867 // constrained to be on the heap, since the heap is used to identify the | 867 // constrained to be on the heap, since the heap is used to identify the |
868 // correct thread. | 868 // correct thread. |
869 static void pushWeakPointerCallback(void* closure, void* containerObject, We
akPointerCallback); | 869 static void pushThreadLocalWeakCallback(void* closure, void* containerObject
, WeakCallback); |
870 | 870 |
871 // Similar to the more general pushWeakPointerCallback, but cell | 871 // Similar to the more general pushThreadLocalWeakCallback, but cell |
872 // pointer callbacks are added to a static callback work list and the weak | 872 // pointer callbacks are added to a static callback work list and the weak |
873 // callback is performed on the thread performing garbage collection. This | 873 // callback is performed on the thread performing garbage collection. This |
874 // is OK because cells are just cleared and no deallocation can happen. | 874 // is OK because cells are just cleared and no deallocation can happen. |
875 static void pushWeakCellPointerCallback(void** cell, WeakPointerCallback); | 875 static void pushGlobalWeakCallback(void** cell, WeakCallback); |
876 | 876 |
877 // Pop the top of a marking stack and call the callback with the visitor | 877 // Pop the top of a marking stack and call the callback with the visitor |
878 // and the object. Returns false when there is nothing more to do. | 878 // and the object. Returns false when there is nothing more to do. |
879 static bool popAndInvokeTraceCallback(Visitor*); | 879 static bool popAndInvokeTraceCallback(Visitor*); |
880 | 880 |
881 // Remove an item from the post-marking callback stack and call | 881 // Remove an item from the post-marking callback stack and call |
882 // the callback with the visitor and the object pointer. Returns | 882 // the callback with the visitor and the object pointer. Returns |
883 // false when there is nothing more to do. | 883 // false when there is nothing more to do. |
884 static bool popAndInvokePostMarkingCallback(Visitor*); | 884 static bool popAndInvokePostMarkingCallback(Visitor*); |
885 | 885 |
886 // Remove an item from the weak callback work list and call the callback | 886 // Remove an item from the weak callback work list and call the callback |
887 // with the visitor and the closure pointer. Returns false when there is | 887 // with the visitor and the closure pointer. Returns false when there is |
888 // nothing more to do. | 888 // nothing more to do. |
889 static bool popAndInvokeWeakPointerCallback(Visitor*); | 889 static bool popAndInvokeGlobalWeakCallback(Visitor*); |
890 | 890 |
891 // Register an ephemeron table for fixed-point iteration. | 891 // Register an ephemeron table for fixed-point iteration. |
892 static void registerWeakTable(void* containerObject, EphemeronCallback, Ephe
meronCallback); | 892 static void registerWeakTable(void* containerObject, EphemeronCallback, Ephe
meronCallback); |
893 #if ENABLE(ASSERT) | 893 #if ENABLE(ASSERT) |
894 static bool weakTableRegistered(const void*); | 894 static bool weakTableRegistered(const void*); |
895 #endif | 895 #endif |
896 | 896 |
897 static inline size_t allocationSizeFromSize(size_t size) | 897 static inline size_t allocationSizeFromSize(size_t size) |
898 { | 898 { |
899 // Check the size before computing the actual allocation size. The | 899 // Check the size before computing the actual allocation size. The |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 RegionTree* m_left; | 1014 RegionTree* m_left; |
1015 RegionTree* m_right; | 1015 RegionTree* m_right; |
1016 }; | 1016 }; |
1017 | 1017 |
1018 // Reset counters that track live and allocated-since-last-GC sizes. | 1018 // Reset counters that track live and allocated-since-last-GC sizes. |
1019 static void resetHeapCounters(); | 1019 static void resetHeapCounters(); |
1020 | 1020 |
1021 static Visitor* s_markingVisitor; | 1021 static Visitor* s_markingVisitor; |
1022 static CallbackStack* s_markingStack; | 1022 static CallbackStack* s_markingStack; |
1023 static CallbackStack* s_postMarkingCallbackStack; | 1023 static CallbackStack* s_postMarkingCallbackStack; |
1024 static CallbackStack* s_weakCallbackStack; | 1024 static CallbackStack* s_globalWeakCallbackStack; |
1025 static CallbackStack* s_ephemeronStack; | 1025 static CallbackStack* s_ephemeronStack; |
1026 static HeapDoesNotContainCache* s_heapDoesNotContainCache; | 1026 static HeapDoesNotContainCache* s_heapDoesNotContainCache; |
1027 static bool s_shutdownCalled; | 1027 static bool s_shutdownCalled; |
1028 static bool s_lastGCWasConservative; | 1028 static bool s_lastGCWasConservative; |
1029 static FreePagePool* s_freePagePool; | 1029 static FreePagePool* s_freePagePool; |
1030 static OrphanedPagePool* s_orphanedPagePool; | 1030 static OrphanedPagePool* s_orphanedPagePool; |
1031 static RegionTree* s_regionTree; | 1031 static RegionTree* s_regionTree; |
1032 static size_t s_allocatedSpace; | 1032 static size_t s_allocatedSpace; |
1033 static size_t s_allocatedObjectSize; | 1033 static size_t s_allocatedObjectSize; |
1034 static size_t s_markedObjectSize; | 1034 static size_t s_markedObjectSize; |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 size_t copySize = previousHeader->payloadSize(); | 1273 size_t copySize = previousHeader->payloadSize(); |
1274 if (copySize > size) | 1274 if (copySize > size) |
1275 copySize = size; | 1275 copySize = size; |
1276 memcpy(address, previous, copySize); | 1276 memcpy(address, previous, copySize); |
1277 return address; | 1277 return address; |
1278 } | 1278 } |
1279 | 1279 |
1280 } // namespace blink | 1280 } // namespace blink |
1281 | 1281 |
1282 #endif // Heap_h | 1282 #endif // Heap_h |
OLD | NEW |