| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 , m_noAllocationCount(0) | 91 , m_noAllocationCount(0) |
| 92 , m_gcForbiddenCount(0) | 92 , m_gcForbiddenCount(0) |
| 93 , m_accumulatedSweepingTime(0) | 93 , m_accumulatedSweepingTime(0) |
| 94 , m_vectorBackingArenaIndex(BlinkGC::Vector1ArenaIndex) | 94 , m_vectorBackingArenaIndex(BlinkGC::Vector1ArenaIndex) |
| 95 , m_currentArenaAges(0) | 95 , m_currentArenaAges(0) |
| 96 , m_perThreadHeapEnabled(perThreadHeapEnabled) | 96 , m_perThreadHeapEnabled(perThreadHeapEnabled) |
| 97 , m_isTerminating(false) | 97 , m_isTerminating(false) |
| 98 , m_gcMixinMarker(nullptr) | 98 , m_gcMixinMarker(nullptr) |
| 99 , m_shouldFlushHeapDoesNotContainCache(false) | 99 , m_shouldFlushHeapDoesNotContainCache(false) |
| 100 , m_gcState(NoGCScheduled) | 100 , m_gcState(NoGCScheduled) |
| 101 , m_threadLocalWeakCallbackStack(CallbackStack::create()) |
| 101 , m_isolate(nullptr) | 102 , m_isolate(nullptr) |
| 102 , m_traceDOMWrappers(nullptr) | 103 , m_traceDOMWrappers(nullptr) |
| 103 , m_invalidateDeadObjectsInWrappersMarkingDeque(nullptr) | 104 , m_invalidateDeadObjectsInWrappersMarkingDeque(nullptr) |
| 104 #if defined(ADDRESS_SANITIZER) | 105 #if defined(ADDRESS_SANITIZER) |
| 105 , m_asanFakeStack(__asan_get_current_fake_stack()) | 106 , m_asanFakeStack(__asan_get_current_fake_stack()) |
| 106 #endif | 107 #endif |
| 107 #if defined(LEAK_SANITIZER) | 108 #if defined(LEAK_SANITIZER) |
| 108 , m_disabledStaticPersistentsRegistration(0) | 109 , m_disabledStaticPersistentsRegistration(0) |
| 109 #endif | 110 #endif |
| 110 , m_allocatedObjectSize(0) | 111 , m_allocatedObjectSize(0) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 128 } | 129 } |
| 129 ASSERT(m_heap); | 130 ASSERT(m_heap); |
| 130 m_heap->attach(this); | 131 m_heap->attach(this); |
| 131 | 132 |
| 132 for (int arenaIndex = 0; arenaIndex < BlinkGC::LargeObjectArenaIndex; arenaI
ndex++) | 133 for (int arenaIndex = 0; arenaIndex < BlinkGC::LargeObjectArenaIndex; arenaI
ndex++) |
| 133 m_arenas[arenaIndex] = new NormalPageArena(this, arenaIndex); | 134 m_arenas[arenaIndex] = new NormalPageArena(this, arenaIndex); |
| 134 m_arenas[BlinkGC::LargeObjectArenaIndex] = new LargeObjectArena(this, BlinkG
C::LargeObjectArenaIndex); | 135 m_arenas[BlinkGC::LargeObjectArenaIndex] = new LargeObjectArena(this, BlinkG
C::LargeObjectArenaIndex); |
| 135 | 136 |
| 136 m_likelyToBePromptlyFreed = wrapArrayUnique(new int[likelyToBePromptlyFreedA
rraySize]); | 137 m_likelyToBePromptlyFreed = wrapArrayUnique(new int[likelyToBePromptlyFreedA
rraySize]); |
| 137 clearArenaAges(); | 138 clearArenaAges(); |
| 138 | |
| 139 // There is little use of weak references and collections off the main threa
d; | |
| 140 // use a much lower initial block reservation. | |
| 141 size_t initialBlockSize = isMainThread() ? CallbackStack::kDefaultBlockSize
: CallbackStack::kMinimalBlockSize; | |
| 142 m_threadLocalWeakCallbackStack = new CallbackStack(initialBlockSize); | |
| 143 } | 139 } |
| 144 | 140 |
| 145 ThreadState::~ThreadState() | 141 ThreadState::~ThreadState() |
| 146 { | 142 { |
| 147 ASSERT(checkThread()); | 143 ASSERT(checkThread()); |
| 148 delete m_threadLocalWeakCallbackStack; | |
| 149 m_threadLocalWeakCallbackStack = nullptr; | |
| 150 for (int i = 0; i < BlinkGC::NumberOfArenas; ++i) | 144 for (int i = 0; i < BlinkGC::NumberOfArenas; ++i) |
| 151 delete m_arenas[i]; | 145 delete m_arenas[i]; |
| 152 | 146 |
| 153 **s_threadSpecific = nullptr; | 147 **s_threadSpecific = nullptr; |
| 154 if (isMainThread()) { | 148 if (isMainThread()) { |
| 155 s_mainThreadStackStart = 0; | 149 s_mainThreadStackStart = 0; |
| 156 s_mainThreadUnderestimatedStackSize = 0; | 150 s_mainThreadUnderestimatedStackSize = 0; |
| 157 } | 151 } |
| 158 } | 152 } |
| 159 | 153 |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 // safepoint barrier mutexes etc, which can additionally delay | 950 // safepoint barrier mutexes etc, which can additionally delay |
| 957 // a thread. Enough so that another thread may initiate | 951 // a thread. Enough so that another thread may initiate |
| 958 // a new GC before this has happened. | 952 // a new GC before this has happened. |
| 959 // | 953 // |
| 960 // In which case the parked thread's ThreadState will have unprocessed | 954 // In which case the parked thread's ThreadState will have unprocessed |
| 961 // entries on its local weak callback stack when that later GC goes | 955 // entries on its local weak callback stack when that later GC goes |
| 962 // ahead. Clear out and invalidate the stack now, as the thread | 956 // ahead. Clear out and invalidate the stack now, as the thread |
| 963 // should only process callbacks that's found to be reachable by | 957 // should only process callbacks that's found to be reachable by |
| 964 // the latest GC, when it eventually gets to next perform | 958 // the latest GC, when it eventually gets to next perform |
| 965 // thread-local weak processing. | 959 // thread-local weak processing. |
| 966 m_threadLocalWeakCallbackStack->clear(); | 960 m_threadLocalWeakCallbackStack->decommit(); |
| 961 m_threadLocalWeakCallbackStack->commit(); |
| 967 } | 962 } |
| 968 | 963 |
| 969 void ThreadState::postGC(BlinkGC::GCType gcType) | 964 void ThreadState::postGC(BlinkGC::GCType gcType) |
| 970 { | 965 { |
| 971 if (RuntimeEnabledFeatures::traceWrappablesEnabled() | 966 if (RuntimeEnabledFeatures::traceWrappablesEnabled() |
| 972 && m_invalidateDeadObjectsInWrappersMarkingDeque) { | 967 && m_invalidateDeadObjectsInWrappersMarkingDeque) { |
| 973 m_invalidateDeadObjectsInWrappersMarkingDeque(m_isolate); | 968 m_invalidateDeadObjectsInWrappersMarkingDeque(m_isolate); |
| 974 } | 969 } |
| 975 | 970 |
| 976 ASSERT(isInGC()); | 971 ASSERT(isInGC()); |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1533 threadDump->AddScalar("dead_count", "objects", totalDeadCount); | 1528 threadDump->AddScalar("dead_count", "objects", totalDeadCount); |
| 1534 threadDump->AddScalar("live_size", "bytes", totalLiveSize); | 1529 threadDump->AddScalar("live_size", "bytes", totalLiveSize); |
| 1535 threadDump->AddScalar("dead_size", "bytes", totalDeadSize); | 1530 threadDump->AddScalar("dead_size", "bytes", totalDeadSize); |
| 1536 | 1531 |
| 1537 base::trace_event::MemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvide
r::instance()->createMemoryAllocatorDumpForCurrentGC(heapsDumpName); | 1532 base::trace_event::MemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvide
r::instance()->createMemoryAllocatorDumpForCurrentGC(heapsDumpName); |
| 1538 base::trace_event::MemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvi
der::instance()->createMemoryAllocatorDumpForCurrentGC(classesDumpName); | 1533 base::trace_event::MemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvi
der::instance()->createMemoryAllocatorDumpForCurrentGC(classesDumpName); |
| 1539 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->AddOwners
hipEdge(classesDump->guid(), heapsDump->guid()); | 1534 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->AddOwners
hipEdge(classesDump->guid(), heapsDump->guid()); |
| 1540 } | 1535 } |
| 1541 | 1536 |
| 1542 } // namespace blink | 1537 } // namespace blink |
| OLD | NEW |