chromium/v8/src/heap/cppgc/object-start-bitmap.h

// 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 V8_HEAP_CPPGC_OBJECT_START_BITMAP_H_
#define V8_HEAP_CPPGC_OBJECT_START_BITMAP_H_

#include <limits.h>
#include <stdint.h>

#include <array>

#include "include/cppgc/internal/write-barrier.h"
#include "src/base/atomic-utils.h"
#include "src/base/bits.h"
#include "src/base/macros.h"
#include "src/heap/cppgc/globals.h"
#include "src/heap/cppgc/heap-object-header.h"

namespace cppgc {
namespace internal {

// A bitmap for recording object starts. Objects have to be allocated at
// minimum granularity of kGranularity.
//
// Depends on internals such as:
// - kBlinkPageSize
// - kAllocationGranularity
//
// ObjectStartBitmap supports concurrent reads from multiple threads but
// only a single mutator thread can write to it. ObjectStartBitmap relies on
// being allocated inside the same normal page.
class V8_EXPORT_PRIVATE ObjectStartBitmap {};

ObjectStartBitmap::ObjectStartBitmap() {}

template <AccessMode mode>
HeapObjectHeader* ObjectStartBitmap::FindHeader(
    ConstAddress address_maybe_pointing_to_the_middle_of_object) const {}

template <AccessMode mode>
void ObjectStartBitmap::SetBit(ConstAddress header_address) {}

template <AccessMode mode>
void ObjectStartBitmap::ClearBit(ConstAddress header_address) {}

template <AccessMode mode>
bool ObjectStartBitmap::CheckBit(ConstAddress header_address) const {}

template <AccessMode mode>
void ObjectStartBitmap::store(size_t cell_index, uint8_t value) {}

template <AccessMode mode>
uint8_t ObjectStartBitmap::load(size_t cell_index) const {}

void ObjectStartBitmap::ObjectStartIndexAndBit(ConstAddress header_address,
                                               size_t* cell_index,
                                               size_t* bit) const {}

template <typename Callback>
inline void ObjectStartBitmap::Iterate(Callback callback) const {}

void ObjectStartBitmap::MarkAsFullyPopulated() {}

void ObjectStartBitmap::Clear() {}

// A platform aware version of ObjectStartBitmap to provide platform specific
// optimizations (e.g. Use non-atomic stores on ARMv7 when not marking).
class V8_EXPORT_PRIVATE PlatformAwareObjectStartBitmap
    : public ObjectStartBitmap {};

// static
template <AccessMode mode>
bool PlatformAwareObjectStartBitmap::ShouldForceNonAtomic() {}

template <AccessMode mode>
void PlatformAwareObjectStartBitmap::SetBit(ConstAddress header_address) {}

template <AccessMode mode>
void PlatformAwareObjectStartBitmap::ClearBit(ConstAddress header_address) {}

}  // namespace internal
}  // namespace cppgc

#endif  // V8_HEAP_CPPGC_OBJECT_START_BITMAP_H_