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