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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 return reinterpret_cast<ThreadState*>(s_mainThreadStateStorage); | 312 return reinterpret_cast<ThreadState*>(s_mainThreadStateStorage); |
313 } | 313 } |
314 | 314 |
315 bool isMainThread() const { return this == mainThreadState(); } | 315 bool isMainThread() const { return this == mainThreadState(); } |
316 bool checkThread() const | 316 bool checkThread() const |
317 { | 317 { |
318 ASSERT(m_thread == currentThread()); | 318 ASSERT(m_thread == currentThread()); |
319 return true; | 319 return true; |
320 } | 320 } |
321 | 321 |
322 void didV8GC(); | 322 void didV8MajorGC(bool forceGC); |
323 | 323 |
324 void performIdleGC(double deadlineSeconds); | 324 void performIdleGC(double deadlineSeconds); |
325 void performIdleLazySweep(double deadlineSeconds); | 325 void performIdleLazySweep(double deadlineSeconds); |
326 | 326 |
327 void scheduleIdleGC(); | 327 void scheduleIdleGC(); |
328 void scheduleIdleLazySweep(); | 328 void scheduleIdleLazySweep(); |
329 void schedulePreciseGC(); | 329 void schedulePreciseGC(); |
330 void scheduleGCIfNeeded(); | 330 void scheduleGCIfNeeded(); |
331 void setGCState(GCState); | 331 void setGCState(GCState); |
332 GCState gcState() const; | 332 GCState gcState() const; |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); | 649 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); |
650 void clearSafePointScopeMarker() | 650 void clearSafePointScopeMarker() |
651 { | 651 { |
652 m_safePointStackCopy.clear(); | 652 m_safePointStackCopy.clear(); |
653 m_safePointScopeMarker = nullptr; | 653 m_safePointScopeMarker = nullptr; |
654 } | 654 } |
655 | 655 |
656 // shouldSchedule{Precise,Idle}GC and shouldForceConservativeGC | 656 // shouldSchedule{Precise,Idle}GC and shouldForceConservativeGC |
657 // implement the heuristics that are used to determine when to collect garba
ge. | 657 // implement the heuristics that are used to determine when to collect garba
ge. |
658 // If shouldForceConservativeGC returns true, we force the garbage | 658 // If shouldForceConservativeGC returns true, we force the garbage |
659 // collection immediately. Otherwise, if shouldGC returns true, we | 659 // collection immediately. Otherwise, if should*GC() returns true, we |
660 // record that we should garbage collect the next time we return | 660 // record that we should garbage collect the next time we return |
661 // to the event loop. If both return false, we don't need to | 661 // to the event loop. If both return false, we don't need to |
662 // collect garbage at this point. | 662 // collect garbage at this point. |
663 bool shouldScheduleIdleGC(); | 663 bool shouldScheduleIdleGC(); |
664 bool shouldSchedulePreciseGC(); | 664 bool shouldSchedulePreciseGC(); |
665 bool shouldForceConservativeGC(); | 665 bool shouldForceConservativeGC(); |
| 666 |
| 667 // Internal helper for shouldForceConservativeGC() and didV8MajorGC(); |
| 668 // returns true iff an urgent conservative GC is needed to try to |
| 669 // relieve memory pressure. |
| 670 bool shouldForceMemoryPressureGC(); |
| 671 |
666 void runScheduledGC(StackState); | 672 void runScheduledGC(StackState); |
667 | 673 |
668 void eagerSweep(); | 674 void eagerSweep(); |
669 | 675 |
670 #if defined(ADDRESS_SANITIZER) | 676 #if defined(ADDRESS_SANITIZER) |
671 void poisonEagerHeap(Poisoning); | 677 void poisonEagerHeap(Poisoning); |
672 void poisonAllHeaps(); | 678 void poisonAllHeaps(); |
673 #endif | 679 #endif |
674 | 680 |
675 // When ThreadState is detaching from non-main thread its | 681 // When ThreadState is detaching from non-main thread its |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 }; | 777 }; |
772 | 778 |
773 template<> class ThreadStateFor<AnyThread> { | 779 template<> class ThreadStateFor<AnyThread> { |
774 public: | 780 public: |
775 static ThreadState* state() { return ThreadState::current(); } | 781 static ThreadState* state() { return ThreadState::current(); } |
776 }; | 782 }; |
777 | 783 |
778 } // namespace blink | 784 } // namespace blink |
779 | 785 |
780 #endif // ThreadState_h | 786 #endif // ThreadState_h |
OLD | NEW |