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