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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 static ThreadState* mainThreadState() | 315 static ThreadState* mainThreadState() |
316 { | 316 { |
317 return reinterpret_cast<ThreadState*>(s_mainThreadStateStorage); | 317 return reinterpret_cast<ThreadState*>(s_mainThreadStateStorage); |
318 } | 318 } |
319 | 319 |
320 bool isMainThread() const { return this == mainThreadState(); } | 320 bool isMainThread() const { return this == mainThreadState(); } |
321 #if ENABLE(ASSERT) | 321 #if ENABLE(ASSERT) |
322 bool checkThread() const { return m_thread == currentThread(); } | 322 bool checkThread() const { return m_thread == currentThread(); } |
323 #endif | 323 #endif |
324 | 324 |
325 void didV8MajorGC(); | |
326 | |
327 void performIdleGC(double deadlineSeconds); | 325 void performIdleGC(double deadlineSeconds); |
328 void performIdleLazySweep(double deadlineSeconds); | 326 void performIdleLazySweep(double deadlineSeconds); |
329 | 327 |
330 void scheduleIdleGC(); | 328 void scheduleIdleGC(); |
331 void scheduleIdleLazySweep(); | 329 void scheduleIdleLazySweep(); |
332 void schedulePreciseGC(); | 330 void schedulePreciseGC(); |
333 void schedulePageNavigationGCIfNeeded(float estimatedRemovalRatio); | 331 void schedulePageNavigationGCIfNeeded(float estimatedRemovalRatio); |
334 void schedulePageNavigationGC(); | 332 void schedulePageNavigationGC(); |
335 void scheduleGCIfNeeded(); | 333 void scheduleGCIfNeeded(); |
336 void setGCState(GCState); | 334 void setGCState(GCState); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 #endif | 473 #endif |
476 | 474 |
477 // A region of PersistentNodes allocated on the given thread. | 475 // A region of PersistentNodes allocated on the given thread. |
478 PersistentRegion* persistentRegion() const { return m_persistentRegion.get()
; } | 476 PersistentRegion* persistentRegion() const { return m_persistentRegion.get()
; } |
479 // A region of PersistentNodes not owned by any particular thread. | 477 // A region of PersistentNodes not owned by any particular thread. |
480 static CrossThreadPersistentRegion& crossThreadPersistentRegion(); | 478 static CrossThreadPersistentRegion& crossThreadPersistentRegion(); |
481 | 479 |
482 // TODO(haraken): Currently CrossThreadPersistent handles are not counted. | 480 // TODO(haraken): Currently CrossThreadPersistent handles are not counted. |
483 // This wouldn't be a big deal because # of CrossThreadPersistents is small, | 481 // This wouldn't be a big deal because # of CrossThreadPersistents is small, |
484 // but should be fixed. | 482 // but should be fixed. |
485 void persistentAllocated() | 483 void wrapperAllocated() |
486 { | 484 { |
487 ++m_persistentAllocated; | 485 ++m_wrapperAllocated; |
488 } | 486 } |
489 void persistentFreed() | 487 void wrapperFreed() |
490 { | 488 { |
491 ++m_persistentFreed; | 489 ++m_wrapperFreed; |
492 } | 490 } |
493 void updatePersistentCounters(); | 491 void updateWrapperCounters(); |
494 | 492 |
495 // Visit local thread stack and trace all pointers conservatively. | 493 // Visit local thread stack and trace all pointers conservatively. |
496 void visitStack(Visitor*); | 494 void visitStack(Visitor*); |
497 | 495 |
498 // Visit the asan fake stack frame corresponding to a slot on the | 496 // Visit the asan fake stack frame corresponding to a slot on the |
499 // real machine stack if there is one. | 497 // real machine stack if there is one. |
500 void visitAsanFakeStackForPointer(Visitor*, Address); | 498 void visitAsanFakeStackForPointer(Visitor*, Address); |
501 | 499 |
502 // Visit all persistents allocated on this thread. | 500 // Visit all persistents allocated on this thread. |
503 void visitPersistents(Visitor*); | 501 void visitPersistents(Visitor*); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 bool shouldScheduleIdleGC(); | 689 bool shouldScheduleIdleGC(); |
692 bool shouldSchedulePreciseGC(); | 690 bool shouldSchedulePreciseGC(); |
693 bool shouldForceConservativeGC(); | 691 bool shouldForceConservativeGC(); |
694 // estimatedRemovalRatio is the estimated ratio of objects that will be no | 692 // estimatedRemovalRatio is the estimated ratio of objects that will be no |
695 // longer necessary due to the navigation. | 693 // longer necessary due to the navigation. |
696 bool shouldSchedulePageNavigationGC(float estimatedRemovalRatio); | 694 bool shouldSchedulePageNavigationGC(float estimatedRemovalRatio); |
697 | 695 |
698 // Internal helper for GC policy handling code. Returns true if | 696 // Internal helper for GC policy handling code. Returns true if |
699 // an urgent conservative GC is now needed due to memory pressure. | 697 // an urgent conservative GC is now needed due to memory pressure. |
700 bool shouldForceMemoryPressureGC(); | 698 bool shouldForceMemoryPressureGC(); |
701 size_t estimatedLiveObjectSize(); | 699 double partitionAllocGrowingRate(); |
702 size_t currentObjectSize(); | 700 double heapGrowingRate(); |
| 701 bool judgeGCThreshold(size_t allocatedObjectSizeThreshold, double heapGrowin
gRateThreshold, double partitionAllocGrowingRateThreshold); |
703 | 702 |
704 void runScheduledGC(StackState); | 703 void runScheduledGC(StackState); |
705 | 704 |
706 void eagerSweep(); | 705 void eagerSweep(); |
707 | 706 |
708 #if defined(ADDRESS_SANITIZER) | 707 #if defined(ADDRESS_SANITIZER) |
709 void poisonEagerHeap(Poisoning); | 708 void poisonEagerHeap(Poisoning); |
710 void poisonAllHeaps(); | 709 void poisonAllHeaps(); |
711 #endif | 710 #endif |
712 | 711 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 StackState m_stackState; | 758 StackState m_stackState; |
760 intptr_t* m_startOfStack; | 759 intptr_t* m_startOfStack; |
761 intptr_t* m_endOfStack; | 760 intptr_t* m_endOfStack; |
762 void* m_safePointScopeMarker; | 761 void* m_safePointScopeMarker; |
763 Vector<Address> m_safePointStackCopy; | 762 Vector<Address> m_safePointStackCopy; |
764 bool m_atSafePoint; | 763 bool m_atSafePoint; |
765 InterruptorVector m_interruptors; | 764 InterruptorVector m_interruptors; |
766 bool m_sweepForbidden; | 765 bool m_sweepForbidden; |
767 size_t m_noAllocationCount; | 766 size_t m_noAllocationCount; |
768 size_t m_gcForbiddenCount; | 767 size_t m_gcForbiddenCount; |
769 int m_persistentAllocated; | 768 int m_wrapperAllocated; |
770 int m_persistentFreed; | 769 int m_wrapperFreed; |
771 BaseHeap* m_heaps[NumberOfHeaps]; | 770 BaseHeap* m_heaps[NumberOfHeaps]; |
772 | 771 |
773 int m_vectorBackingHeapIndex; | 772 int m_vectorBackingHeapIndex; |
774 size_t m_heapAges[NumberOfHeaps]; | 773 size_t m_heapAges[NumberOfHeaps]; |
775 size_t m_currentHeapAges; | 774 size_t m_currentHeapAges; |
776 | 775 |
777 bool m_isTerminating; | 776 bool m_isTerminating; |
778 GarbageCollectedMixinConstructorMarker* m_gcMixinMarker; | 777 GarbageCollectedMixinConstructorMarker* m_gcMixinMarker; |
779 | 778 |
780 bool m_shouldFlushHeapDoesNotContainCache; | 779 bool m_shouldFlushHeapDoesNotContainCache; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 }; | 818 }; |
820 | 819 |
821 template<> class ThreadStateFor<AnyThread> { | 820 template<> class ThreadStateFor<AnyThread> { |
822 public: | 821 public: |
823 static ThreadState* state() { return ThreadState::current(); } | 822 static ThreadState* state() { return ThreadState::current(); } |
824 }; | 823 }; |
825 | 824 |
826 } // namespace blink | 825 } // namespace blink |
827 | 826 |
828 #endif // ThreadState_h | 827 #endif // ThreadState_h |
OLD | NEW |