Line data Source code
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 : PageAllocator();
19 115872 : ~PageAllocator() override = default;
20 :
21 10474349 : size_t AllocatePageSize() override { return allocate_page_size_; }
22 :
23 26807774 : size_t CommitPageSize() override { return commit_page_size_; }
24 :
25 : void SetRandomMmapSeed(int64_t seed) override;
26 :
27 : void* GetRandomMmapAddr() override;
28 :
29 : void* AllocatePages(void* address, size_t size, size_t alignment,
30 : PageAllocator::Permission access) override;
31 :
32 : bool FreePages(void* address, size_t size) override;
33 :
34 : bool ReleasePages(void* address, size_t size, size_t new_size) override;
35 :
36 : bool SetPermissions(void* address, size_t size,
37 : PageAllocator::Permission access) override;
38 :
39 : bool DiscardSystemPages(void* address, size_t size) override;
40 :
41 : private:
42 : const size_t allocate_page_size_;
43 : const size_t commit_page_size_;
44 : };
45 :
46 : } // namespace base
47 : } // namespace v8
48 : #endif // V8_BASE_PAGE_ALLOCATOR_H_
|