v8  8.4.371 (node 14.15.5)
V8 is Google's open source JavaScript engine
api-constants.h
Go to the documentation of this file.
1 // Copyright 2020 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 INCLUDE_CPPGC_INTERNAL_API_CONSTANTS_H_
6 #define INCLUDE_CPPGC_INTERNAL_API_CONSTANTS_H_
7 
8 #include <stddef.h>
9 #include <stdint.h>
10 
11 #include "v8config.h" // NOLINT(build/include_directory)
12 
13 namespace cppgc {
14 namespace internal {
15 
16 // Embedders should not rely on this code!
17 
18 // Internal constants to avoid exposing internal types on the API surface.
19 namespace api_constants {
20 // Offset of the uint16_t bitfield from the payload contaning the
21 // in-construction bit. This is subtracted from the payload pointer to get
22 // to the right bitfield.
23 static constexpr size_t kFullyConstructedBitFieldOffsetFromPayload =
24  2 * sizeof(uint16_t);
25 // Mask for in-construction bit.
26 static constexpr size_t kFullyConstructedBitMask = size_t{1};
27 
28 // Page constants used to align pointers to page begin.
29 static constexpr size_t kPageSize = size_t{1} << 17;
30 static constexpr size_t kPageAlignment = kPageSize;
31 static constexpr size_t kPageBaseMask = ~(kPageAlignment - 1);
32 static constexpr size_t kGuardPageSize = 4096;
33 
34 // Offset of the Heap backref.
35 static constexpr size_t kHeapOffset = 0;
36 
37 static constexpr size_t kLargeObjectSizeThreshold = kPageSize / 2;
38 
39 } // namespace api_constants
40 
41 } // namespace internal
42 } // namespace cppgc
43 
44 #endif // INCLUDE_CPPGC_INTERNAL_API_CONSTANTS_H_