v8/include/cppgc/internal/accessors.h
Anton Bikineev 22f80fc176 cppgc: Introduce heap object structure classes
This adds the following:
1) Heap object structure classes: RawHeap, BaseArena and BasePage.
   - freelist
   - linear allocation block
2) ObjectAllocator, a class responsible for object (and page) allocation.

The design doc with UML design: https://bit.ly/2VVTcqc

User defined arenas are followup.

Bug: chromium:1056170
Change-Id: I69a82974bd08e3cf3da90041b1628297cc890891
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2167392
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67425}
2020-04-28 10:21:11 +00:00

27 lines
711 B
C++

// 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 "cppgc/internal/api-constants.h"
namespace cppgc {
class Heap;
namespace internal {
inline cppgc::Heap* GetHeapFromPayload(const void* payload) {
return *reinterpret_cast<cppgc::Heap**>(
((reinterpret_cast<uintptr_t>(payload) & api_constants::kPageBaseMask) +
api_constants::kGuardPageSize) +
api_constants::kHeapOffset);
}
} // namespace internal
} // namespace cppgc
#endif // INCLUDE_CPPGC_INTERNAL_ACCESSORS_H_