| 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 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 ConservativeGC, | 911 ConservativeGC, |
| 912 ForcedGC, | 912 ForcedGC, |
| 913 NumberOfGCReason | 913 NumberOfGCReason |
| 914 }; | 914 }; |
| 915 static const char* gcReasonString(GCReason); | 915 static const char* gcReasonString(GCReason); |
| 916 static void collectGarbage(ThreadState::StackState, ThreadState::GCType, GCR
eason); | 916 static void collectGarbage(ThreadState::StackState, ThreadState::GCType, GCR
eason); |
| 917 static void collectGarbageForTerminatingThread(ThreadState*); | 917 static void collectGarbageForTerminatingThread(ThreadState*); |
| 918 static void collectAllGarbage(); | 918 static void collectAllGarbage(); |
| 919 | 919 |
| 920 static void processMarkingStack(Visitor*); | 920 static void processMarkingStack(Visitor*); |
| 921 static void processEphemerons(Visitor*); |
| 921 static void postMarkingProcessing(Visitor*); | 922 static void postMarkingProcessing(Visitor*); |
| 922 static void globalWeakProcessing(Visitor*); | 923 static void globalWeakProcessing(Visitor*); |
| 923 static void setForcePreciseGCForTesting(); | 924 static void setForcePreciseGCForTesting(); |
| 924 | 925 |
| 925 static void preGC(); | 926 static void preGC(); |
| 926 static void postGC(ThreadState::GCType); | 927 static void postGC(ThreadState::GCType); |
| 927 | 928 |
| 928 // Conservatively checks whether an address is a pointer in any of the | 929 // Conservatively checks whether an address is a pointer in any of the |
| 929 // thread heaps. If so marks the object pointed to as live. | 930 // thread heaps. If so marks the object pointed to as live. |
| 930 static Address checkAndMarkPointer(Visitor*, Address); | 931 static Address checkAndMarkPointer(Visitor*, Address); |
| 931 | 932 |
| 932 #if ENABLE(GC_PROFILING) | 933 #if ENABLE(GC_PROFILING) |
| 933 // Dump the path to specified object on the next GC. This method is to be | 934 // Dump the path to specified object on the next GC. This method is to be |
| 934 // invoked from GDB. | 935 // invoked from GDB. |
| 935 static void dumpPathToObjectOnNextGC(void* p); | 936 static void dumpPathToObjectOnNextGC(void* p); |
| 936 | 937 |
| 937 // Forcibly find GCInfo of the object at Address. This is slow and should | 938 // Forcibly find GCInfo of the object at Address. This is slow and should |
| 938 // only be used for debug purposes. It involves finding the heap page and | 939 // only be used for debug purposes. It involves finding the heap page and |
| 939 // scanning the heap page for an object header. | 940 // scanning the heap page for an object header. |
| 940 static const GCInfo* findGCInfo(Address); | 941 static const GCInfo* findGCInfo(Address); |
| 941 | 942 |
| 942 static String createBacktraceString(); | 943 static String createBacktraceString(); |
| 943 #endif | 944 #endif |
| 944 | 945 |
| 945 static size_t objectPayloadSizeForTesting(); | 946 static size_t objectPayloadSizeForTesting(); |
| 946 | 947 |
| 947 static void flushHeapDoesNotContainCache(); | 948 static void flushHeapDoesNotContainCache(); |
| 948 | 949 |
| 949 // Return true if the last GC found a pointer into a heap page | |
| 950 // during conservative scanning. | |
| 951 static bool lastGCWasConservative() { return s_lastGCWasConservative; } | |
| 952 | |
| 953 static FreePagePool* freePagePool() { return s_freePagePool; } | 950 static FreePagePool* freePagePool() { return s_freePagePool; } |
| 954 static OrphanedPagePool* orphanedPagePool() { return s_orphanedPagePool; } | 951 static OrphanedPagePool* orphanedPagePool() { return s_orphanedPagePool; } |
| 955 | 952 |
| 956 // This look-up uses the region search tree and a negative contains cache to | 953 // This look-up uses the region search tree and a negative contains cache to |
| 957 // provide an efficient mapping from arbitrary addresses to the containing | 954 // provide an efficient mapping from arbitrary addresses to the containing |
| 958 // heap-page if one exists. | 955 // heap-page if one exists. |
| 959 static BasePage* lookup(Address); | 956 static BasePage* lookup(Address); |
| 960 static void addPageMemoryRegion(PageMemoryRegion*); | 957 static void addPageMemoryRegion(PageMemoryRegion*); |
| 961 static void removePageMemoryRegion(PageMemoryRegion*); | 958 static void removePageMemoryRegion(PageMemoryRegion*); |
| 962 | 959 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1008 // Reset counters that track live and allocated-since-last-GC sizes. | 1005 // Reset counters that track live and allocated-since-last-GC sizes. |
| 1009 static void resetHeapCounters(); | 1006 static void resetHeapCounters(); |
| 1010 | 1007 |
| 1011 static Visitor* s_markingVisitor; | 1008 static Visitor* s_markingVisitor; |
| 1012 static CallbackStack* s_markingStack; | 1009 static CallbackStack* s_markingStack; |
| 1013 static CallbackStack* s_postMarkingCallbackStack; | 1010 static CallbackStack* s_postMarkingCallbackStack; |
| 1014 static CallbackStack* s_globalWeakCallbackStack; | 1011 static CallbackStack* s_globalWeakCallbackStack; |
| 1015 static CallbackStack* s_ephemeronStack; | 1012 static CallbackStack* s_ephemeronStack; |
| 1016 static HeapDoesNotContainCache* s_heapDoesNotContainCache; | 1013 static HeapDoesNotContainCache* s_heapDoesNotContainCache; |
| 1017 static bool s_shutdownCalled; | 1014 static bool s_shutdownCalled; |
| 1018 static bool s_lastGCWasConservative; | |
| 1019 static FreePagePool* s_freePagePool; | 1015 static FreePagePool* s_freePagePool; |
| 1020 static OrphanedPagePool* s_orphanedPagePool; | 1016 static OrphanedPagePool* s_orphanedPagePool; |
| 1021 static RegionTree* s_regionTree; | 1017 static RegionTree* s_regionTree; |
| 1022 static size_t s_allocatedSpace; | 1018 static size_t s_allocatedSpace; |
| 1023 static size_t s_allocatedObjectSize; | 1019 static size_t s_allocatedObjectSize; |
| 1024 static size_t s_markedObjectSize; | 1020 static size_t s_markedObjectSize; |
| 1025 static size_t s_estimatedLiveObjectSize; | 1021 static size_t s_estimatedLiveObjectSize; |
| 1026 static size_t s_externalObjectSizeAtLastGC; | 1022 static size_t s_externalObjectSizeAtLastGC; |
| 1027 static double s_estimatedMarkingTimePerByte; | 1023 static double s_estimatedMarkingTimePerByte; |
| 1028 | 1024 |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1293 size_t copySize = previousHeader->payloadSize(); | 1289 size_t copySize = previousHeader->payloadSize(); |
| 1294 if (copySize > size) | 1290 if (copySize > size) |
| 1295 copySize = size; | 1291 copySize = size; |
| 1296 memcpy(address, previous, copySize); | 1292 memcpy(address, previous, copySize); |
| 1297 return address; | 1293 return address; |
| 1298 } | 1294 } |
| 1299 | 1295 |
| 1300 } // namespace blink | 1296 } // namespace blink |
| 1301 | 1297 |
| 1302 #endif // Heap_h | 1298 #endif // Heap_h |
| OLD | NEW |