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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 GCWithoutSweep, // Lazy sweeping is scheduled. | 189 GCWithoutSweep, // Lazy sweeping is scheduled. |
190 ThreadTerminationGC, // A thread-local GC scheduled before the thread sh
utdown. | 190 ThreadTerminationGC, // A thread-local GC scheduled before the thread sh
utdown. |
191 }; | 191 }; |
192 | 192 |
193 // See setGCState() for possible state transitions. | 193 // See setGCState() for possible state transitions. |
194 enum GCState { | 194 enum GCState { |
195 NoGCScheduled, | 195 NoGCScheduled, |
196 IdleGCScheduled, | 196 IdleGCScheduled, |
197 PreciseGCScheduled, | 197 PreciseGCScheduled, |
198 FullGCScheduled, | 198 FullGCScheduled, |
199 StoppingOtherThreads, | |
200 GCRunning, | 199 GCRunning, |
201 EagerSweepScheduled, | 200 EagerSweepScheduled, |
202 LazySweepScheduled, | 201 LazySweepScheduled, |
203 Sweeping, | 202 Sweeping, |
204 SweepingAndIdleGCScheduled, | 203 SweepingAndIdleGCScheduled, |
205 SweepingAndPreciseGCScheduled, | 204 SweepingAndPreciseGCScheduled, |
206 }; | 205 }; |
207 | 206 |
208 // The NoAllocationScope class is used in debug mode to catch unwanted | 207 // The NoAllocationScope class is used in debug mode to catch unwanted |
209 // allocations. E.g. allocations during GC. | 208 // allocations. E.g. allocations during GC. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 void completeSweep(); | 348 void completeSweep(); |
350 void postSweep(); | 349 void postSweep(); |
351 | 350 |
352 // Support for disallowing allocation. Mainly used for sanity | 351 // Support for disallowing allocation. Mainly used for sanity |
353 // checks asserts. | 352 // checks asserts. |
354 bool isAllocationAllowed() const { return !isAtSafePoint() && !m_noAllocatio
nCount; } | 353 bool isAllocationAllowed() const { return !isAtSafePoint() && !m_noAllocatio
nCount; } |
355 void enterNoAllocationScope() { m_noAllocationCount++; } | 354 void enterNoAllocationScope() { m_noAllocationCount++; } |
356 void leaveNoAllocationScope() { m_noAllocationCount--; } | 355 void leaveNoAllocationScope() { m_noAllocationCount--; } |
357 bool isGCForbidden() const { return m_gcForbiddenCount; } | 356 bool isGCForbidden() const { return m_gcForbiddenCount; } |
358 void enterGCForbiddenScope() { m_gcForbiddenCount++; } | 357 void enterGCForbiddenScope() { m_gcForbiddenCount++; } |
359 void leaveGCForbiddenScope() { m_gcForbiddenCount--; } | 358 void leaveGCForbiddenScope() |
| 359 { |
| 360 ASSERT(m_gcForbiddenCount > 0); |
| 361 m_gcForbiddenCount--; |
| 362 } |
360 bool sweepForbidden() const { return m_sweepForbidden; } | 363 bool sweepForbidden() const { return m_sweepForbidden; } |
361 | 364 |
362 void prepareRegionTree(); | 365 void prepareRegionTree(); |
363 void flushHeapDoesNotContainCacheIfNeeded(); | 366 void flushHeapDoesNotContainCacheIfNeeded(); |
364 | 367 |
365 // Safepoint related functionality. | 368 // Safepoint related functionality. |
366 // | 369 // |
367 // When a thread attempts to perform GC it needs to stop all other threads | 370 // When a thread attempts to perform GC it needs to stop all other threads |
368 // that use the heap or at least guarantee that they will not touch any | 371 // that use the heap or at least guarantee that they will not touch any |
369 // heap allocated object until GC is complete. | 372 // heap allocated object until GC is complete. |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 // constructed. | 559 // constructed. |
557 void enterGCForbiddenScopeIfNeeded(GarbageCollectedMixinConstructorMarker* g
cMixinMarker) | 560 void enterGCForbiddenScopeIfNeeded(GarbageCollectedMixinConstructorMarker* g
cMixinMarker) |
558 { | 561 { |
559 if (!m_gcMixinMarker) { | 562 if (!m_gcMixinMarker) { |
560 enterGCForbiddenScope(); | 563 enterGCForbiddenScope(); |
561 m_gcMixinMarker = gcMixinMarker; | 564 m_gcMixinMarker = gcMixinMarker; |
562 } | 565 } |
563 } | 566 } |
564 void leaveGCForbiddenScopeIfNeeded(GarbageCollectedMixinConstructorMarker* g
cMixinMarker) | 567 void leaveGCForbiddenScopeIfNeeded(GarbageCollectedMixinConstructorMarker* g
cMixinMarker) |
565 { | 568 { |
566 ASSERT(m_gcForbiddenCount > 0); | |
567 if (m_gcMixinMarker == gcMixinMarker) { | 569 if (m_gcMixinMarker == gcMixinMarker) { |
568 leaveGCForbiddenScope(); | 570 leaveGCForbiddenScope(); |
569 m_gcMixinMarker = nullptr; | 571 m_gcMixinMarker = nullptr; |
570 } | 572 } |
571 } | 573 } |
572 | 574 |
573 // vectorBackingHeap() returns a heap that the vector allocation should use. | 575 // vectorBackingHeap() returns a heap that the vector allocation should use. |
574 // We have four vector heaps and want to choose the best heap here. | 576 // We have four vector heaps and want to choose the best heap here. |
575 // | 577 // |
576 // The goal is to improve the succession rate where expand and | 578 // The goal is to improve the succession rate where expand and |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 }; | 744 }; |
743 | 745 |
744 template<> class ThreadStateFor<AnyThread> { | 746 template<> class ThreadStateFor<AnyThread> { |
745 public: | 747 public: |
746 static ThreadState* state() { return ThreadState::current(); } | 748 static ThreadState* state() { return ThreadState::current(); } |
747 }; | 749 }; |
748 | 750 |
749 } // namespace blink | 751 } // namespace blink |
750 | 752 |
751 #endif // ThreadState_h | 753 #endif // ThreadState_h |
OLD | NEW |