diff options
author | Michaël Zasso <targos@protonmail.com> | 2022-09-21 13:28:42 +0200 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2022-10-11 07:24:33 +0200 |
commit | 6bd756d7c6dfb7dc25daee329ad70df68c14223e (patch) | |
tree | af93818c545f5bd04cafd4a0c19817e19a475641 /deps/v8/src/heap/cppgc/page-memory.h | |
parent | 624dadb00706a9fc08f919ac72941cdaba7e3ec9 (diff) | |
download | node-new-6bd756d7c6dfb7dc25daee329ad70df68c14223e.tar.gz |
deps: update V8 to 10.7.193.13
PR-URL: https://github.com/nodejs/node/pull/44741
Fixes: https://github.com/nodejs/node/issues/44650
Fixes: https://github.com/nodejs/node/issues/37472
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'deps/v8/src/heap/cppgc/page-memory.h')
-rw-r--r-- | deps/v8/src/heap/cppgc/page-memory.h | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/deps/v8/src/heap/cppgc/page-memory.h b/deps/v8/src/heap/cppgc/page-memory.h index 5006b9121b..8200c77378 100644 --- a/deps/v8/src/heap/cppgc/page-memory.h +++ b/deps/v8/src/heap/cppgc/page-memory.h @@ -82,11 +82,9 @@ class V8_EXPORT_PRIVATE PageMemoryRegion { virtual void UnprotectForTesting() = 0; protected: - PageMemoryRegion(PageAllocator&, FatalOutOfMemoryHandler&, MemoryRegion, - bool); + PageMemoryRegion(PageAllocator&, MemoryRegion, bool); PageAllocator& allocator_; - FatalOutOfMemoryHandler& oom_handler_; const MemoryRegion reserved_region_; const bool is_large_; }; @@ -110,7 +108,8 @@ class V8_EXPORT_PRIVATE NormalPageMemoryRegion final : public PageMemoryRegion { // Allocates a normal page at |writeable_base| address. Changes page // protection. - void Allocate(Address writeable_base); + // Returns true when the allocation was successful and false otherwise. + V8_WARN_UNUSED_RESULT bool TryAllocate(Address writeable_base); // Frees a normal page at at |writeable_base| address. Changes page // protection. @@ -178,33 +177,32 @@ class V8_EXPORT_PRIVATE PageMemoryRegionTree final { // capabilities. class V8_EXPORT_PRIVATE NormalPageMemoryPool final { public: - static constexpr size_t kNumPoolBuckets = 16; - using Result = std::pair<NormalPageMemoryRegion*, Address>; NormalPageMemoryPool(); ~NormalPageMemoryPool(); - void Add(size_t, NormalPageMemoryRegion*, Address); - Result Take(size_t); + void Add(NormalPageMemoryRegion*, Address); + Result Take(); private: - std::vector<Result> pool_[kNumPoolBuckets]; + std::vector<Result> pool_; }; // A backend that is used for allocating and freeing normal and large pages. // -// Internally maintaints a set of PageMemoryRegions. The backend keeps its used +// Internally maintains a set of PageMemoryRegions. The backend keeps its used // regions alive. class V8_EXPORT_PRIVATE PageBackend final { public: - PageBackend(PageAllocator&, FatalOutOfMemoryHandler&); + PageBackend(PageAllocator& normal_page_allocator, + PageAllocator& large_page_allocator, FatalOutOfMemoryHandler&); ~PageBackend(); // Allocates a normal page from the backend. // // Returns the writeable base of the region. - Address AllocateNormalPageMemory(size_t); + Address TryAllocateNormalPageMemory(); // Returns normal page memory back to the backend. Expects the // |writeable_base| returned by |AllocateNormalMemory()|. @@ -213,7 +211,7 @@ class V8_EXPORT_PRIVATE PageBackend final { // Allocates a large page from the backend. // // Returns the writeable base of the region. - Address AllocateLargePageMemory(size_t size); + Address TryAllocateLargePageMemory(size_t size); // Returns large page memory back to the backend. Expects the |writeable_base| // returned by |AllocateLargePageMemory()|. @@ -230,7 +228,8 @@ class V8_EXPORT_PRIVATE PageBackend final { private: // Guards against concurrent uses of `Lookup()`. mutable v8::base::Mutex mutex_; - PageAllocator& allocator_; + PageAllocator& normal_page_allocator_; + PageAllocator& large_page_allocator_; FatalOutOfMemoryHandler& oom_handler_; NormalPageMemoryPool page_pool_; PageMemoryRegionTree page_memory_region_tree_; |