v8 12.4.254 (node 22.4.1)
V8 is Google's open source JavaScript engine
Loading...
Searching...
No Matches
base-page-handle.h
Go to the documentation of this file.
1// Copyright 2022 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_BASE_PAGE_HANDLE_H_
6#define INCLUDE_CPPGC_INTERNAL_BASE_PAGE_HANDLE_H_
7
8#include "cppgc/heap-handle.h"
11#include "v8config.h" // NOLINT(build/include_directory)
12
13namespace cppgc {
14namespace internal {
15
16// The class is needed in the header to allow for fast access to HeapHandle in
17// the write barrier.
19 public:
20 static V8_INLINE BasePageHandle* FromPayload(void* payload) {
21 return reinterpret_cast<BasePageHandle*>(
22 (reinterpret_cast<uintptr_t>(payload) &
23 ~(api_constants::kPageSize - 1)) +
25 }
26 static V8_INLINE const BasePageHandle* FromPayload(const void* payload) {
27 return FromPayload(const_cast<void*>(payload));
28 }
29
31 const HeapHandle& heap_handle() const { return heap_handle_; }
32
33 protected:
35 CPPGC_DCHECK(reinterpret_cast<uintptr_t>(this) % api_constants::kPageSize ==
37 }
38
40};
41
42} // namespace internal
43} // namespace cppgc
44
45#endif // INCLUDE_CPPGC_INTERNAL_BASE_PAGE_HANDLE_H_
static V8_INLINE const BasePageHandle * FromPayload(const void *payload)
const HeapHandle & heap_handle() const
BasePageHandle(HeapHandle &heap_handle)
static V8_INLINE BasePageHandle * FromPayload(void *payload)
#define CPPGC_DCHECK(condition)
Definition logging.h:36
#define V8_INLINE
Definition v8config.h:477