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_
|
|
|
|
|
2020-04-20 18:19:29 +00:00
|
|
|
#include "cppgc/internal/api-constants.h"
|
2020-04-09 07:18:50 +00:00
|
|
|
|
|
|
|
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-27 23:24:31 +00:00
|
|
|
((reinterpret_cast<uintptr_t>(payload) & api_constants::kPageBaseMask) +
|
|
|
|
api_constants::kGuardPageSize) +
|
2020-04-09 07:18:50 +00:00
|
|
|
api_constants::kHeapOffset);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace cppgc
|
|
|
|
|
|
|
|
#endif // INCLUDE_CPPGC_INTERNAL_ACCESSORS_H_
|