v8  8.4.371 (node 14.15.5)
V8 is Google's open source JavaScript engine
accessors.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_ACCESSORS_H_
6 #define INCLUDE_CPPGC_INTERNAL_ACCESSORS_H_
7 
8 #include "cppgc/internal/api-constants.h"
9 
10 namespace cppgc {
11 
12 class Heap;
13 
14 namespace internal {
15 
16 inline cppgc::Heap* GetHeapFromPayload(const void* payload) {
17  return *reinterpret_cast<cppgc::Heap**>(
18  ((reinterpret_cast<uintptr_t>(payload) & api_constants::kPageBaseMask) +
19  api_constants::kGuardPageSize) +
20  api_constants::kHeapOffset);
21 }
22 
23 } // namespace internal
24 } // namespace cppgc
25 
26 #endif // INCLUDE_CPPGC_INTERNAL_ACCESSORS_H_