CodeGenAllocators.cpp 1.2 KB

123456789101112131415161718192021222324252627
  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. #include "BackEnd.h"
  6. CodeGenAllocators::CodeGenAllocators(AllocationPolicyManager * policyManager, Js::ScriptContext * scriptContext)
  7. : pageAllocator(policyManager, Js::Configuration::Global.flags, PageAllocatorType_BGJIT,
  8. (AutoSystemInfo::Data.IsLowMemoryProcess() ?
  9. PageAllocator::DefaultLowMaxFreePageCount :
  10. PageAllocator::DefaultMaxFreePageCount))
  11. , allocator(L"NativeCode", &pageAllocator, Js::Throw::OutOfMemory)
  12. , emitBufferManager(policyManager, &allocator, scriptContext, L"JIT code buffer", ALLOC_XDATA)
  13. #if !_M_X64_OR_ARM64 && _CONTROL_FLOW_GUARD
  14. , canCreatePreReservedSegment(false)
  15. #endif
  16. #ifdef PERF_COUNTERS
  17. , staticNativeCodeData(0)
  18. #endif
  19. {
  20. }
  21. CodeGenAllocators::~CodeGenAllocators()
  22. {
  23. PERF_COUNTER_SUB(Code, StaticNativeCodeDataSize, staticNativeCodeData);
  24. PERF_COUNTER_SUB(Code, TotalNativeCodeDataSize, staticNativeCodeData);
  25. }