Home | History | Annotate | Download | only in base
      1 // Copyright 2017 the V8 project authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef V8_BASE_PAGE_ALLOCATOR_H_
      6 #define V8_BASE_PAGE_ALLOCATOR_H_
      7 
      8 #include "include/v8-platform.h"
      9 #include "src/base/base-export.h"
     10 #include "src/base/compiler-specific.h"
     11 
     12 namespace v8 {
     13 namespace base {
     14 
     15 class V8_BASE_EXPORT PageAllocator
     16     : public NON_EXPORTED_BASE(::v8::PageAllocator) {
     17  public:
     18   virtual ~PageAllocator() = default;
     19 
     20   size_t AllocatePageSize() override;
     21 
     22   size_t CommitPageSize() override;
     23 
     24   void SetRandomMmapSeed(int64_t seed) override;
     25 
     26   void* GetRandomMmapAddr() override;
     27 
     28   void* AllocatePages(void* address, size_t size, size_t alignment,
     29                       PageAllocator::Permission access) override;
     30 
     31   bool FreePages(void* address, size_t size) override;
     32 
     33   bool ReleasePages(void* address, size_t size, size_t new_size) override;
     34 
     35   bool SetPermissions(void* address, size_t size,
     36                       PageAllocator::Permission access) override;
     37 };
     38 
     39 }  // namespace base
     40 }  // namespace v8
     41 #endif  // V8_BASE_PAGE_ALLOCATOR_H_
     42