2020-04-09 07:18:50 +00:00
|
|
|
// Copyright 2020 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 INCLUDE_CPPGC_INTERNAL_ACCESSORS_H_
|
|
|
|
#define INCLUDE_CPPGC_INTERNAL_ACCESSORS_H_
|
|
|
|
|
|
|
|
#include "include/cppgc/internal/api-constants.h"
|
|
|
|
|
|
|
|
namespace cppgc {
|
2020-04-09 09:25:41 +00:00
|
|
|
|
|
|
|
class Heap;
|
|
|
|
|
2020-04-09 07:18:50 +00:00
|
|
|
namespace internal {
|
|
|
|
|
|
|
|
inline cppgc::Heap* GetHeapFromPayload(const void* payload) {
|
2020-04-09 09:25:41 +00:00
|
|
|
return *reinterpret_cast<cppgc::Heap**>(
|
2020-04-09 07:18:50 +00:00
|
|
|
(reinterpret_cast<uintptr_t>(payload) & api_constants::kPageBaseMask) +
|
|
|
|
api_constants::kHeapOffset);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace cppgc
|
|
|
|
|
|
|
|
#endif // INCLUDE_CPPGC_INTERNAL_ACCESSORS_H_
|