CodeGenAllocators.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  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. template<typename TAlloc, typename TPreReservedAlloc>
  7. CodeGenAllocators<TAlloc, TPreReservedAlloc>::CodeGenAllocators(AllocationPolicyManager * policyManager, Js::ScriptContext * scriptContext, CustomHeap::CodePageAllocators<TAlloc, TPreReservedAlloc> * codePageAllocators, HANDLE processHandle)
  8. : pageAllocator(policyManager, Js::Configuration::Global.flags, PageAllocatorType_BGJIT, 0)
  9. , allocator(_u("NativeCode"), &pageAllocator, Js::Throw::OutOfMemory)
  10. , emitBufferManager(&allocator, codePageAllocators, scriptContext, _u("JIT code buffer"), processHandle)
  11. #if !_M_X64_OR_ARM64 && _CONTROL_FLOW_GUARD
  12. , canCreatePreReservedSegment(false)
  13. #endif
  14. {
  15. }
  16. template<typename TAlloc, typename TPreReservedAlloc>
  17. CodeGenAllocators<TAlloc, TPreReservedAlloc>::~CodeGenAllocators()
  18. {
  19. }
  20. #if DBG
  21. template<typename TAlloc, typename TPreReservedAlloc>
  22. void
  23. CodeGenAllocators<TAlloc, TPreReservedAlloc>::ClearConcurrentThreadId()
  24. {
  25. this->pageAllocator.ClearConcurrentThreadId();
  26. }
  27. #endif
  28. template class CodeGenAllocators<VirtualAllocWrapper, PreReservedVirtualAllocWrapper>;
  29. #if ENABLE_OOP_NATIVE_CODEGEN
  30. template class CodeGenAllocators<SectionAllocWrapper, PreReservedSectionAllocWrapper>;
  31. #endif