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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 , m_persistents(adoptPtr(new PersistentAnchor())) | 307 , m_persistents(adoptPtr(new PersistentAnchor())) |
308 , m_startOfStack(reinterpret_cast<intptr_t*>(getStackStart())) | 308 , m_startOfStack(reinterpret_cast<intptr_t*>(getStackStart())) |
309 , m_endOfStack(reinterpret_cast<intptr_t*>(getStackStart())) | 309 , m_endOfStack(reinterpret_cast<intptr_t*>(getStackStart())) |
310 , m_safePointScopeMarker(nullptr) | 310 , m_safePointScopeMarker(nullptr) |
311 , m_atSafePoint(false) | 311 , m_atSafePoint(false) |
312 , m_interruptors() | 312 , m_interruptors() |
313 , m_didV8GCAfterLastGC(false) | 313 , m_didV8GCAfterLastGC(false) |
314 , m_sweepForbidden(false) | 314 , m_sweepForbidden(false) |
315 , m_noAllocationCount(0) | 315 , m_noAllocationCount(0) |
316 , m_isTerminating(false) | 316 , m_isTerminating(false) |
| 317 , m_lazySweepToggle(false) |
317 , m_shouldFlushHeapDoesNotContainCache(false) | 318 , m_shouldFlushHeapDoesNotContainCache(false) |
318 , m_collectionRate(1.0) | 319 , m_collectionRate(1.0) |
319 , m_gcState(NoGCScheduled) | 320 , m_gcState(NoGCScheduled) |
320 , m_traceDOMWrappers(nullptr) | 321 , m_traceDOMWrappers(nullptr) |
321 #if defined(ADDRESS_SANITIZER) | 322 #if defined(ADDRESS_SANITIZER) |
322 , m_asanFakeStack(__asan_get_current_fake_stack()) | 323 , m_asanFakeStack(__asan_get_current_fake_stack()) |
323 #endif | 324 #endif |
324 { | 325 { |
325 checkThread(); | 326 checkThread(); |
326 ASSERT(!**s_threadSpecific); | 327 ASSERT(!**s_threadSpecific); |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 } | 901 } |
901 } | 902 } |
902 | 903 |
903 void ThreadState::preGC() | 904 void ThreadState::preGC() |
904 { | 905 { |
905 ASSERT(!isInGC()); | 906 ASSERT(!isInGC()); |
906 setGCState(GCRunning); | 907 setGCState(GCRunning); |
907 makeConsistentForSweeping(); | 908 makeConsistentForSweeping(); |
908 prepareRegionTree(); | 909 prepareRegionTree(); |
909 flushHeapDoesNotContainCacheIfNeeded(); | 910 flushHeapDoesNotContainCacheIfNeeded(); |
| 911 m_lazySweepToggle = !m_lazySweepToggle; |
910 if (isMainThread()) | 912 if (isMainThread()) |
911 m_allocatedObjectSizeBeforeGC = Heap::allocatedObjectSize() + Heap::mark
edObjectSize(); | 913 m_allocatedObjectSizeBeforeGC = Heap::allocatedObjectSize() + Heap::mark
edObjectSize(); |
912 } | 914 } |
913 | 915 |
914 void ThreadState::postGC(GCType gcType) | 916 void ThreadState::postGC(GCType gcType) |
915 { | 917 { |
916 ASSERT(isInGC()); | 918 ASSERT(isInGC()); |
917 setGCState(gcType == GCWithSweep ? EagerSweepScheduled : LazySweepScheduled)
; | 919 setGCState(gcType == GCWithSweep ? EagerSweepScheduled : LazySweepScheduled)
; |
918 for (int i = 0; i < NumberOfHeaps; i++) | 920 for (int i = 0; i < NumberOfHeaps; i++) |
919 m_heaps[i]->prepareForSweep(); | 921 m_heaps[i]->prepareForSweep(); |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 return gcInfo; | 1178 return gcInfo; |
1177 } | 1179 } |
1178 } | 1180 } |
1179 if (needLockForIteration) | 1181 if (needLockForIteration) |
1180 threadAttachMutex().unlock(); | 1182 threadAttachMutex().unlock(); |
1181 return nullptr; | 1183 return nullptr; |
1182 } | 1184 } |
1183 #endif | 1185 #endif |
1184 | 1186 |
1185 } // namespace blink | 1187 } // namespace blink |
OLD | NEW |