v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
memory-chunk-constants.h
Go to the documentation of this file.
1// Copyright 2024 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_HEAP_MEMORY_CHUNK_CONSTANTS_H_
6#define V8_HEAP_MEMORY_CHUNK_CONSTANTS_H_
7
9#include "src/base/bits.h"
10#include "src/common/globals.h"
11
12namespace v8 {
13namespace internal {
14
16 public:
17#ifdef V8_ENABLE_SANDBOX
18 static constexpr size_t kPagesInMainCage =
19 kPtrComprCageReservationSize / kRegularPageSize;
20 static constexpr size_t kPagesInCodeCage =
22 static constexpr size_t kPagesInTrustedCage =
23 kMaximalTrustedRangeSize / kRegularPageSize;
24
25 static constexpr size_t kMainCageMetadataOffset = 0;
26 static constexpr size_t kTrustedSpaceMetadataOffset =
27 kMainCageMetadataOffset + kPagesInMainCage;
28 static constexpr size_t kCodeRangeMetadataOffset =
29 kTrustedSpaceMetadataOffset + kPagesInTrustedCage;
30
31 static constexpr size_t kMetadataPointerTableSizeLog2 = base::bits::BitWidth(
32 kPagesInMainCage + kPagesInCodeCage + kPagesInTrustedCage);
33 static constexpr size_t kMetadataPointerTableSize =
34 1 << kMetadataPointerTableSizeLog2;
35 static constexpr size_t kMetadataPointerTableSizeMask =
36 kMetadataPointerTableSize - 1;
37#endif // V8_ENABLE_SANDBOX
38};
39
40} // namespace internal
41} // namespace v8
42
43#endif // V8_HEAP_MEMORY_CHUNK_CONSTANTS_H_
constexpr int kRegularPageSize
constexpr size_t kMaximalCodeRangeSize
Definition globals.h:508
#define V8_EXPORT_PRIVATE
Definition macros.h:460