RecyclerPageAllocator.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. namespace Memory
  6. {
  7. class HeapInfo;
  8. class RecyclerPageAllocator : public IdleDecommitPageAllocator
  9. {
  10. public:
  11. RecyclerPageAllocator(HeapInfo * heapInfo, AllocationPolicyManager * policyManager,
  12. Js::ConfigFlagsTable& flagTable, uint maxFreePageCount, uint maxAllocPageCount = PageAllocator::DefaultMaxAllocPageCount, bool enableWriteBarrier = false);
  13. #if ENABLE_CONCURRENT_GC
  14. #ifdef RECYCLER_WRITE_WATCH
  15. void EnableWriteWatch();
  16. bool ResetWriteWatch();
  17. #endif
  18. #endif
  19. static uint const DefaultPrimePageCount = 0x1000; // 16MB
  20. #if ENABLE_CONCURRENT_GC
  21. #ifdef RECYCLER_WRITE_WATCH
  22. #if DBG
  23. size_t GetWriteWatchPageCount();
  24. #endif
  25. private:
  26. static bool ResetWriteWatch(DListBase<PageSegment> * segmentList);
  27. template <typename T>
  28. static bool ResetAllWriteWatch(DListBase<T> * segmentList);
  29. #if DBG
  30. static size_t GetWriteWatchPageCount(DListBase<PageSegment> * segmentList);
  31. template <typename T>
  32. static size_t GetAllWriteWatchPageCount(DListBase<T> * segmentList);
  33. #endif
  34. #endif
  35. #endif
  36. private:
  37. #if ENABLE_BACKGROUND_PAGE_ZEROING
  38. ZeroPageQueue zeroPageQueue;
  39. #endif
  40. HeapInfo * heapInfo;
  41. bool IsMemProtectMode();
  42. };
  43. }