chromium/v8/src/base/virtual-address-space.h

// Copyright 2021 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.

#ifndef V8_BASE_VIRTUAL_ADDRESS_SPACE_H_
#define V8_BASE_VIRTUAL_ADDRESS_SPACE_H_

#include "include/v8-platform.h"
#include "src/base/base-export.h"
#include "src/base/compiler-specific.h"
#include "src/base/platform/platform.h"
#include "src/base/region-allocator.h"

namespace v8 {
namespace base {

Address;
constexpr Address kNullAddress =;

class VirtualAddressSubspace;

/*
 * Common parent class to implement deletion of subspaces.
 */
class VirtualAddressSpaceBase
    : public NON_EXPORTED_BASE(::v8::VirtualAddressSpace) {};

/*
 * Helper routine to determine whether one set of page permissions (the lhs) is
 * a subset of another one (the rhs).
 */
V8_BASE_EXPORT bool IsSubset(PagePermissions lhs, PagePermissions rhs);

/*
 * The virtual address space of the current process. Conceptionally, there
 * should only be one such "root" instance. However, in practice there is no
 * issue with having multiple instances as the actual resources are managed by
 * the OS kernel.
 */
class V8_BASE_EXPORT VirtualAddressSpace : public VirtualAddressSpaceBase {};

/*
 * A subspace of a parent virtual address space. This represents a reserved
 * contiguous region of virtual address space in the current process.
 */
class V8_BASE_EXPORT VirtualAddressSubspace : public VirtualAddressSpaceBase {};

}  // namespace base
}  // namespace v8
#endif  // V8_BASE_VIRTUAL_ADDRESS_SPACE_H_