%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
// Copyright 2020 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "src/heap/cppgc/virtual-memory.h" #include "include/cppgc/platform.h" #include "src/base/macros.h" namespace cppgc { namespace internal { VirtualMemory::VirtualMemory(PageAllocator* page_allocator, size_t size, size_t alignment, void* hint) : page_allocator_(page_allocator) { DCHECK_NOT_NULL(page_allocator); DCHECK(IsAligned(size, page_allocator->CommitPageSize())); const size_t page_size = page_allocator_->AllocatePageSize(); start_ = page_allocator->AllocatePages(hint, RoundUp(size, page_size), RoundUp(alignment, page_size), PageAllocator::kNoAccess); if (start_) { size_ = RoundUp(size, page_size); } } VirtualMemory::~VirtualMemory() V8_NOEXCEPT { if (IsReserved()) { page_allocator_->FreePages(start_, size_); } } VirtualMemory::VirtualMemory(VirtualMemory&& other) V8_NOEXCEPT : page_allocator_(std::move(other.page_allocator_)), start_(std::move(other.start_)), size_(std::move(other.size_)) { other.Reset(); } VirtualMemory& VirtualMemory::operator=(VirtualMemory&& other) V8_NOEXCEPT { DCHECK(!IsReserved()); page_allocator_ = std::move(other.page_allocator_); start_ = std::move(other.start_); size_ = std::move(other.size_); other.Reset(); return *this; } void VirtualMemory::Reset() { start_ = nullptr; size_ = 0; } } // namespace internal } // namespace cppgc