Commit 35b9776f authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[heap] Move AccessMode out from MarkBit into globals

Bug: 
Change-Id: I5ea0e072c3ac100a6f3bed62a9a4d2c11d2b7c9a
Reviewed-on: https://chromium-review.googlesource.com/533414
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45920}
parent 4a2d0155
......@@ -520,6 +520,8 @@ const int kSpaceTagMask = (1 << kSpaceTagSize) - 1;
enum AllocationAlignment { kWordAligned, kDoubleAligned, kDoubleUnaligned };
enum class AccessMode { ATOMIC, NON_ATOMIC };
// Possible outcomes for decisions.
enum class Decision : uint8_t { kUnknown, kTrue, kFalse };
......
......@@ -52,7 +52,7 @@ class ConcurrentMarkingVisitor final
: deque_(deque) {}
bool ShouldVisit(HeapObject* object) override {
return ObjectMarking::GreyToBlack<MarkBit::AccessMode::ATOMIC>(
return ObjectMarking::GreyToBlack<AccessMode::ATOMIC>(
object, marking_state(object));
}
......@@ -175,8 +175,8 @@ class ConcurrentMarkingVisitor final
MemoryChunk* chunk = MemoryChunk::FromAddress(object->address());
CHECK_NE(chunk->synchronized_heap(), nullptr);
#endif
if (ObjectMarking::WhiteToGrey<MarkBit::AccessMode::ATOMIC>(
object, marking_state(object))) {
if (ObjectMarking::WhiteToGrey<AccessMode::ATOMIC>(object,
marking_state(object))) {
deque_->Push(object, MarkingThread::kConcurrent, TargetDeque::kShared);
}
}
......
......@@ -69,7 +69,7 @@ class V8_EXPORT_PRIVATE IncrementalMarking {
// Transfers color including live byte count, requiring properly set up
// objects.
template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC>
template <AccessMode access_mode = AccessMode::NON_ATOMIC>
V8_INLINE void TransferColor(HeapObject* from, HeapObject* to) {
if (ObjectMarking::IsBlack<access_mode>(to, marking_state(to))) {
DCHECK(black_allocation());
......@@ -182,9 +182,9 @@ class V8_EXPORT_PRIVATE IncrementalMarking {
#endif
#ifdef V8_CONCURRENT_MARKING
static const MarkBit::AccessMode kAtomicity = MarkBit::AccessMode::ATOMIC;
static const AccessMode kAtomicity = AccessMode::ATOMIC;
#else
static const MarkBit::AccessMode kAtomicity = MarkBit::AccessMode::NON_ATOMIC;
static const AccessMode kAtomicity = AccessMode::NON_ATOMIC;
#endif
void FinalizeSweeping();
......
......@@ -13,10 +13,10 @@ namespace v8 {
namespace internal {
void MarkCompactCollector::PushBlack(HeapObject* obj) {
DCHECK((ObjectMarking::IsBlack<MarkBit::NON_ATOMIC>(
DCHECK((ObjectMarking::IsBlack<AccessMode::NON_ATOMIC>(
obj, MarkingState::Internal(obj))));
if (!marking_deque()->Push(obj)) {
ObjectMarking::BlackToGrey<MarkBit::NON_ATOMIC>(
ObjectMarking::BlackToGrey<AccessMode::NON_ATOMIC>(
obj, MarkingState::Internal(obj));
}
}
......@@ -29,7 +29,7 @@ void MarkCompactCollector::UnshiftBlack(HeapObject* obj) {
}
void MarkCompactCollector::MarkObject(HeapObject* obj) {
if (ObjectMarking::WhiteToBlack<MarkBit::NON_ATOMIC>(
if (ObjectMarking::WhiteToBlack<AccessMode::NON_ATOMIC>(
obj, MarkingState::Internal(obj))) {
PushBlack(obj);
}
......
......@@ -1245,7 +1245,7 @@ class MarkCompactCollector::RootMarkingVisitor : public ObjectVisitor,
HeapObject* object = HeapObject::cast(*p);
if (ObjectMarking::WhiteToBlack<MarkBit::NON_ATOMIC>(
if (ObjectMarking::WhiteToBlack<AccessMode::NON_ATOMIC>(
object, MarkingState::Internal(object))) {
Map* map = object->map();
// Mark the map pointer and body, and push them on the marking stack.
......@@ -1585,7 +1585,7 @@ class YoungGenerationMigrationObserver final : public MigrationObserver {
if (heap_->incremental_marking()->IsMarking()) {
DCHECK(ObjectMarking::IsWhite(
dst, mark_compact_collector_->marking_state(dst)));
heap_->incremental_marking()->TransferColor<MarkBit::ATOMIC>(src, dst);
heap_->incremental_marking()->TransferColor<AccessMode::ATOMIC>(src, dst);
}
}
......@@ -2042,7 +2042,7 @@ void MarkCompactCollector::EmptyMarkingDeque() {
DCHECK(!object->IsFiller());
DCHECK(object->IsHeapObject());
DCHECK(heap()->Contains(object));
DCHECK(!(ObjectMarking::IsWhite<MarkBit::NON_ATOMIC>(
DCHECK(!(ObjectMarking::IsWhite<AccessMode::NON_ATOMIC>(
object, MarkingState::Internal(object))));
Map* map = object->map();
......@@ -2276,8 +2276,8 @@ class YoungGenerationMarkingVisitor final
}
inline void MarkObjectViaMarkingDeque(HeapObject* object) {
if (ObjectMarking::WhiteToGrey<MarkBit::ATOMIC>(object,
marking_state(object))) {
if (ObjectMarking::WhiteToGrey<AccessMode::ATOMIC>(object,
marking_state(object))) {
// Marking deque overflow is unsupported for the young generation.
CHECK(marking_deque_.Push(object));
}
......@@ -2290,11 +2290,11 @@ class YoungGenerationMarkingVisitor final
Object* target = *p;
if (heap_->InNewSpace(target)) {
HeapObject* target_object = HeapObject::cast(target);
if (ObjectMarking::WhiteToGrey<MarkBit::ATOMIC>(
if (ObjectMarking::WhiteToGrey<AccessMode::ATOMIC>(
target_object, marking_state(target_object))) {
const int size = Visit(target_object);
marking_state(target_object)
.IncrementLiveBytes<MarkBit::ATOMIC>(size);
.IncrementLiveBytes<AccessMode::ATOMIC>(size);
}
}
}
......@@ -2332,7 +2332,7 @@ class MinorMarkCompactCollector::RootMarkingVisitor : public RootVisitor {
if (!collector_->heap()->InNewSpace(object)) return;
if (ObjectMarking::WhiteToGrey<MarkBit::NON_ATOMIC>(
if (ObjectMarking::WhiteToGrey<AccessMode::NON_ATOMIC>(
object, marking_state(object))) {
collector_->main_marking_visitor()->Visit(object);
collector_->EmptyMarkingDeque();
......@@ -2391,7 +2391,7 @@ class YoungGenerationMarkingTask : public ItemParallelJob::Task {
void MarkObject(Object* object) {
if (!collector_->heap()->InNewSpace(object)) return;
HeapObject* heap_object = HeapObject::cast(object);
if (ObjectMarking::WhiteToGrey<MarkBit::ATOMIC>(
if (ObjectMarking::WhiteToGrey<AccessMode::ATOMIC>(
heap_object, collector_->marking_state(heap_object))) {
const int size = visitor_.Visit(heap_object);
IncrementLiveBytes(heap_object, size);
......@@ -2429,7 +2429,7 @@ class YoungGenerationMarkingTask : public ItemParallelJob::Task {
void FlushLiveBytes() {
for (auto pair : local_live_bytes_) {
collector_->marking_state(pair.first)
.IncrementLiveBytes<MarkBit::ATOMIC>(pair.second);
.IncrementLiveBytes<AccessMode::ATOMIC>(pair.second);
}
}
......@@ -2710,10 +2710,10 @@ void MinorMarkCompactCollector::EmptyMarkingDeque() {
DCHECK(!object->IsFiller());
DCHECK(object->IsHeapObject());
DCHECK(heap()->Contains(object));
DCHECK(!(ObjectMarking::IsWhite<MarkBit::NON_ATOMIC>(
DCHECK(!(ObjectMarking::IsWhite<AccessMode::NON_ATOMIC>(
object, marking_state(object))));
DCHECK((ObjectMarking::IsGrey<AccessMode::NON_ATOMIC>(
object, marking_state(object))));
DCHECK((ObjectMarking::IsGrey<MarkBit::NON_ATOMIC>(object,
marking_state(object))));
main_marking_visitor()->Visit(object);
}
DCHECK(local_marking_deque.IsEmpty());
......
......@@ -55,34 +55,34 @@ class ObjectMarking : public AllStatic {
return Marking::Color(ObjectMarking::MarkBitFrom(obj, state));
}
template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC>
template <AccessMode access_mode = AccessMode::NON_ATOMIC>
V8_INLINE static bool IsImpossible(HeapObject* obj,
const MarkingState& state) {
return Marking::IsImpossible<access_mode>(MarkBitFrom(obj, state));
}
template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC>
template <AccessMode access_mode = AccessMode::NON_ATOMIC>
V8_INLINE static bool IsBlack(HeapObject* obj, const MarkingState& state) {
return Marking::IsBlack<access_mode>(MarkBitFrom(obj, state));
}
template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC>
template <AccessMode access_mode = AccessMode::NON_ATOMIC>
V8_INLINE static bool IsWhite(HeapObject* obj, const MarkingState& state) {
return Marking::IsWhite<access_mode>(MarkBitFrom(obj, state));
}
template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC>
template <AccessMode access_mode = AccessMode::NON_ATOMIC>
V8_INLINE static bool IsGrey(HeapObject* obj, const MarkingState& state) {
return Marking::IsGrey<access_mode>(MarkBitFrom(obj, state));
}
template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC>
template <AccessMode access_mode = AccessMode::NON_ATOMIC>
V8_INLINE static bool IsBlackOrGrey(HeapObject* obj,
const MarkingState& state) {
return Marking::IsBlackOrGrey<access_mode>(MarkBitFrom(obj, state));
}
template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC>
template <AccessMode access_mode = AccessMode::NON_ATOMIC>
V8_INLINE static bool BlackToGrey(HeapObject* obj,
const MarkingState& state) {
MarkBit markbit = MarkBitFrom(obj, state);
......@@ -91,20 +91,20 @@ class ObjectMarking : public AllStatic {
return true;
}
template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC>
template <AccessMode access_mode = AccessMode::NON_ATOMIC>
V8_INLINE static bool WhiteToGrey(HeapObject* obj,
const MarkingState& state) {
return Marking::WhiteToGrey<access_mode>(MarkBitFrom(obj, state));
}
template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC>
template <AccessMode access_mode = AccessMode::NON_ATOMIC>
V8_INLINE static bool WhiteToBlack(HeapObject* obj,
const MarkingState& state) {
return ObjectMarking::WhiteToGrey<access_mode>(obj, state) &&
ObjectMarking::GreyToBlack<access_mode>(obj, state);
}
template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC>
template <AccessMode access_mode = AccessMode::NON_ATOMIC>
V8_INLINE static bool GreyToBlack(HeapObject* obj,
const MarkingState& state) {
MarkBit markbit = MarkBitFrom(obj, state);
......
......@@ -25,17 +25,18 @@ void Bitmap::SetRange(uint32_t start_index, uint32_t end_index) {
if (start_cell_index != end_cell_index) {
// Firstly, fill all bits from the start address to the end of the first
// cell with 1s.
SetBitsInCell<MarkBit::ATOMIC>(start_cell_index, ~(start_index_mask - 1));
SetBitsInCell<AccessMode::ATOMIC>(start_cell_index,
~(start_index_mask - 1));
// Then fill all in between cells with 1s.
base::Atomic32* cell_base = reinterpret_cast<base::Atomic32*>(cells());
for (unsigned int i = start_cell_index + 1; i < end_cell_index; i++) {
base::Relaxed_Store(cell_base + i, ~0u);
}
// Finally, fill all bits until the end address in the last cell with 1s.
SetBitsInCell<MarkBit::ATOMIC>(end_cell_index, (end_index_mask - 1));
SetBitsInCell<AccessMode::ATOMIC>(end_cell_index, (end_index_mask - 1));
} else {
SetBitsInCell<MarkBit::ATOMIC>(start_cell_index,
end_index_mask - start_index_mask);
SetBitsInCell<AccessMode::ATOMIC>(start_cell_index,
end_index_mask - start_index_mask);
}
// This fence prevents re-ordering of publishing stores with the mark-
// bit setting stores.
......@@ -52,17 +53,18 @@ void Bitmap::ClearRange(uint32_t start_index, uint32_t end_index) {
if (start_cell_index != end_cell_index) {
// Firstly, fill all bits from the start address to the end of the first
// cell with 0s.
ClearBitsInCell<MarkBit::ATOMIC>(start_cell_index, ~(start_index_mask - 1));
ClearBitsInCell<AccessMode::ATOMIC>(start_cell_index,
~(start_index_mask - 1));
// Then fill all in between cells with 0s.
base::Atomic32* cell_base = reinterpret_cast<base::Atomic32*>(cells());
for (unsigned int i = start_cell_index + 1; i < end_cell_index; i++) {
base::Relaxed_Store(cell_base + i, 0);
}
// Finally, set all bits until the end address in the last cell with 0s.
ClearBitsInCell<MarkBit::ATOMIC>(end_cell_index, (end_index_mask - 1));
ClearBitsInCell<AccessMode::ATOMIC>(end_cell_index, (end_index_mask - 1));
} else {
ClearBitsInCell<MarkBit::ATOMIC>(start_cell_index,
(end_index_mask - start_index_mask));
ClearBitsInCell<AccessMode::ATOMIC>(start_cell_index,
(end_index_mask - start_index_mask));
}
// This fence prevents re-ordering of publishing stores with the mark-
// bit clearing stores.
......
......@@ -16,8 +16,6 @@ class MarkBit {
typedef uint32_t CellType;
STATIC_ASSERT(sizeof(CellType) == sizeof(base::Atomic32));
enum AccessMode { ATOMIC, NON_ATOMIC };
inline MarkBit(base::Atomic32* cell, CellType mask) : cell_(cell) {
mask_ = static_cast<base::Atomic32>(mask);
}
......@@ -40,15 +38,15 @@ class MarkBit {
// The function returns true if it succeeded to
// transition the bit from 0 to 1.
template <AccessMode mode = NON_ATOMIC>
template <AccessMode mode = AccessMode::NON_ATOMIC>
inline bool Set();
template <AccessMode mode = NON_ATOMIC>
template <AccessMode mode = AccessMode::NON_ATOMIC>
inline bool Get();
// The function returns true if it succeeded to
// transition the bit from 1 to 0.
template <AccessMode mode = NON_ATOMIC>
template <AccessMode mode = AccessMode::NON_ATOMIC>
inline bool Clear();
base::Atomic32* cell_;
......@@ -60,14 +58,14 @@ class MarkBit {
};
template <>
inline bool MarkBit::Set<MarkBit::NON_ATOMIC>() {
inline bool MarkBit::Set<AccessMode::NON_ATOMIC>() {
base::Atomic32 old_value = *cell_;
*cell_ = old_value | mask_;
return (old_value & mask_) == 0;
}
template <>
inline bool MarkBit::Set<MarkBit::ATOMIC>() {
inline bool MarkBit::Set<AccessMode::ATOMIC>() {
base::Atomic32 old_value;
base::Atomic32 new_value;
do {
......@@ -80,24 +78,24 @@ inline bool MarkBit::Set<MarkBit::ATOMIC>() {
}
template <>
inline bool MarkBit::Get<MarkBit::NON_ATOMIC>() {
inline bool MarkBit::Get<AccessMode::NON_ATOMIC>() {
return (base::Relaxed_Load(cell_) & mask_) != 0;
}
template <>
inline bool MarkBit::Get<MarkBit::ATOMIC>() {
inline bool MarkBit::Get<AccessMode::ATOMIC>() {
return (base::Acquire_Load(cell_) & mask_) != 0;
}
template <>
inline bool MarkBit::Clear<MarkBit::NON_ATOMIC>() {
inline bool MarkBit::Clear<AccessMode::NON_ATOMIC>() {
base::Atomic32 old_value = *cell_;
*cell_ = old_value & ~mask_;
return (old_value & mask_) == mask_;
}
template <>
inline bool MarkBit::Clear<MarkBit::ATOMIC>() {
inline bool MarkBit::Clear<AccessMode::ATOMIC>() {
base::Atomic32 old_value;
base::Atomic32 new_value;
do {
......@@ -169,12 +167,12 @@ class V8_EXPORT_PRIVATE Bitmap {
// Clears bits in the given cell. The mask specifies bits to clear: if a
// bit is set in the mask then the corresponding bit is cleared in the cell.
template <MarkBit::AccessMode mode = MarkBit::NON_ATOMIC>
template <AccessMode mode = AccessMode::NON_ATOMIC>
void ClearBitsInCell(uint32_t cell_index, uint32_t mask);
// Sets bits in the given cell. The mask specifies bits to set: if a
// bit is set in the mask then the corresponding bit is set in the cell.
template <MarkBit::AccessMode mode = MarkBit::NON_ATOMIC>
template <AccessMode mode = AccessMode::NON_ATOMIC>
void SetBitsInCell(uint32_t cell_index, uint32_t mask);
// Sets all bits in the range [start_index, end_index). The cells at the
......@@ -199,14 +197,14 @@ class V8_EXPORT_PRIVATE Bitmap {
};
template <>
inline void Bitmap::SetBitsInCell<MarkBit::NON_ATOMIC>(uint32_t cell_index,
uint32_t mask) {
inline void Bitmap::SetBitsInCell<AccessMode::NON_ATOMIC>(uint32_t cell_index,
uint32_t mask) {
cells()[cell_index] |= mask;
}
template <>
inline void Bitmap::SetBitsInCell<MarkBit::ATOMIC>(uint32_t cell_index,
uint32_t mask) {
inline void Bitmap::SetBitsInCell<AccessMode::ATOMIC>(uint32_t cell_index,
uint32_t mask) {
base::Atomic32* cell =
reinterpret_cast<base::Atomic32*>(cells() + cell_index);
base::Atomic32 old_value;
......@@ -219,14 +217,14 @@ inline void Bitmap::SetBitsInCell<MarkBit::ATOMIC>(uint32_t cell_index,
}
template <>
inline void Bitmap::ClearBitsInCell<MarkBit::NON_ATOMIC>(uint32_t cell_index,
uint32_t mask) {
inline void Bitmap::ClearBitsInCell<AccessMode::NON_ATOMIC>(uint32_t cell_index,
uint32_t mask) {
cells()[cell_index] &= ~mask;
}
template <>
inline void Bitmap::ClearBitsInCell<MarkBit::ATOMIC>(uint32_t cell_index,
uint32_t mask) {
inline void Bitmap::ClearBitsInCell<AccessMode::ATOMIC>(uint32_t cell_index,
uint32_t mask) {
base::Atomic32* cell =
reinterpret_cast<base::Atomic32*>(cells() + cell_index);
base::Atomic32 old_value;
......@@ -246,9 +244,9 @@ class Marking : public AllStatic {
// Impossible markbits: 01
static const char* kImpossibleBitPattern;
template <MarkBit::AccessMode mode = MarkBit::NON_ATOMIC>
template <AccessMode mode = AccessMode::NON_ATOMIC>
INLINE(static bool IsImpossible(MarkBit mark_bit)) {
if (mode == MarkBit::NON_ATOMIC) {
if (mode == AccessMode::NON_ATOMIC) {
return !mark_bit.Get<mode>() && mark_bit.Next().Get<mode>();
}
// If we are in concurrent mode we can only tell if an object has the
......@@ -264,14 +262,14 @@ class Marking : public AllStatic {
// Black markbits: 11
static const char* kBlackBitPattern;
template <MarkBit::AccessMode mode = MarkBit::NON_ATOMIC>
template <AccessMode mode = AccessMode::NON_ATOMIC>
INLINE(static bool IsBlack(MarkBit mark_bit)) {
return mark_bit.Get<mode>() && mark_bit.Next().Get<mode>();
}
// White markbits: 00 - this is required by the mark bit clearer.
static const char* kWhiteBitPattern;
template <MarkBit::AccessMode mode = MarkBit::NON_ATOMIC>
template <AccessMode mode = AccessMode::NON_ATOMIC>
INLINE(static bool IsWhite(MarkBit mark_bit)) {
DCHECK(!IsImpossible(mark_bit));
return !mark_bit.Get<mode>();
......@@ -279,21 +277,21 @@ class Marking : public AllStatic {
// Grey markbits: 10
static const char* kGreyBitPattern;
template <MarkBit::AccessMode mode = MarkBit::NON_ATOMIC>
template <AccessMode mode = AccessMode::NON_ATOMIC>
INLINE(static bool IsGrey(MarkBit mark_bit)) {
return mark_bit.Get<mode>() && !mark_bit.Next().Get<mode>();
}
// IsBlackOrGrey assumes that the first bit is set for black or grey
// objects.
template <MarkBit::AccessMode mode = MarkBit::NON_ATOMIC>
template <AccessMode mode = AccessMode::NON_ATOMIC>
INLINE(static bool IsBlackOrGrey(MarkBit mark_bit)) {
return mark_bit.Get<mode>();
}
template <MarkBit::AccessMode mode = MarkBit::NON_ATOMIC>
template <AccessMode mode = AccessMode::NON_ATOMIC>
INLINE(static void MarkWhite(MarkBit markbit)) {
STATIC_ASSERT(mode == MarkBit::NON_ATOMIC);
STATIC_ASSERT(mode == AccessMode::NON_ATOMIC);
markbit.Clear<mode>();
markbit.Next().Clear<mode>();
}
......@@ -301,30 +299,30 @@ class Marking : public AllStatic {
// Warning: this method is not safe in general in concurrent scenarios.
// If you know that nobody else will change the bits on the given location
// then you may use it.
template <MarkBit::AccessMode mode = MarkBit::NON_ATOMIC>
template <AccessMode mode = AccessMode::NON_ATOMIC>
INLINE(static void MarkBlack(MarkBit markbit)) {
markbit.Set<mode>();
markbit.Next().Set<mode>();
}
template <MarkBit::AccessMode mode = MarkBit::NON_ATOMIC>
template <AccessMode mode = AccessMode::NON_ATOMIC>
INLINE(static bool BlackToGrey(MarkBit markbit)) {
STATIC_ASSERT(mode == MarkBit::NON_ATOMIC);
STATIC_ASSERT(mode == AccessMode::NON_ATOMIC);
DCHECK(IsBlack(markbit));
return markbit.Next().Clear<mode>();
}
template <MarkBit::AccessMode mode = MarkBit::NON_ATOMIC>
template <AccessMode mode = AccessMode::NON_ATOMIC>
INLINE(static bool WhiteToGrey(MarkBit markbit)) {
return markbit.Set<mode>();
}
template <MarkBit::AccessMode mode = MarkBit::NON_ATOMIC>
template <AccessMode mode = AccessMode::NON_ATOMIC>
INLINE(static bool WhiteToBlack(MarkBit markbit)) {
return markbit.Set<mode>() && markbit.Next().Set<mode>();
}
template <MarkBit::AccessMode mode = MarkBit::NON_ATOMIC>
template <AccessMode mode = AccessMode::NON_ATOMIC>
INLINE(static bool GreyToBlack(MarkBit markbit)) {
return markbit.Get<mode>() && markbit.Next().Set<mode>();
}
......
......@@ -1591,7 +1591,7 @@ void PagedSpace::Verify(ObjectVisitor* visitor) {
end_of_previous_object = object->address() + size;
}
CHECK_LE(black_size,
MarkingState::Internal(page).live_bytes<MarkBit::ATOMIC>());
MarkingState::Internal(page).live_bytes<AccessMode::ATOMIC>());
}
CHECK(allocation_pointer_found_in_space);
}
......
......@@ -684,7 +684,7 @@ class MarkingState {
MarkingState(Bitmap* bitmap, intptr_t* live_bytes)
: bitmap_(bitmap), live_bytes_(live_bytes) {}
template <MarkBit::AccessMode mode = MarkBit::NON_ATOMIC>
template <AccessMode mode = AccessMode::NON_ATOMIC>
inline void IncrementLiveBytes(intptr_t by) const;
void SetLiveBytes(intptr_t value) const {
......@@ -698,7 +698,7 @@ class MarkingState {
Bitmap* bitmap() const { return bitmap_; }
template <MarkBit::AccessMode mode = MarkBit::NON_ATOMIC>
template <AccessMode mode = AccessMode::NON_ATOMIC>
inline intptr_t live_bytes() const;
private:
......@@ -707,24 +707,24 @@ class MarkingState {
};
template <>
inline void MarkingState::IncrementLiveBytes<MarkBit::NON_ATOMIC>(
inline void MarkingState::IncrementLiveBytes<AccessMode::NON_ATOMIC>(
intptr_t by) const {
*live_bytes_ += by;
}
template <>
inline void MarkingState::IncrementLiveBytes<MarkBit::ATOMIC>(
inline void MarkingState::IncrementLiveBytes<AccessMode::ATOMIC>(
intptr_t by) const {
reinterpret_cast<base::AtomicNumber<intptr_t>*>(live_bytes_)->Increment(by);
}
template <>
inline intptr_t MarkingState::live_bytes<MarkBit::NON_ATOMIC>() const {
inline intptr_t MarkingState::live_bytes<AccessMode::NON_ATOMIC>() const {
return *live_bytes_;
}
template <>
inline intptr_t MarkingState::live_bytes<MarkBit::ATOMIC>() const {
inline intptr_t MarkingState::live_bytes<AccessMode::ATOMIC>() const {
return reinterpret_cast<base::AtomicNumber<intptr_t>*>(live_bytes_)->Value();
}
......
......@@ -22,7 +22,7 @@ TEST(Marking, TransitionWhiteBlackWhite) {
MarkBit mark_bit = bitmap->MarkBitFromIndex(position[i]);
CHECK(Marking::IsWhite(mark_bit));
CHECK(!Marking::IsImpossible(mark_bit));
Marking::WhiteToBlack<MarkBit::NON_ATOMIC>(mark_bit);
Marking::WhiteToBlack<AccessMode::NON_ATOMIC>(mark_bit);
CHECK(Marking::IsBlack(mark_bit));
CHECK(!Marking::IsImpossible(mark_bit));
Marking::MarkWhite(mark_bit);
......@@ -43,11 +43,11 @@ TEST(Marking, TransitionWhiteGreyBlackGrey) {
CHECK(Marking::IsWhite(mark_bit));
CHECK(!Marking::IsBlackOrGrey(mark_bit));
CHECK(!Marking::IsImpossible(mark_bit));
Marking::WhiteToGrey<MarkBit::NON_ATOMIC>(mark_bit);
Marking::WhiteToGrey<AccessMode::NON_ATOMIC>(mark_bit);
CHECK(Marking::IsGrey(mark_bit));
CHECK(Marking::IsBlackOrGrey(mark_bit));
CHECK(!Marking::IsImpossible(mark_bit));
Marking::GreyToBlack<MarkBit::NON_ATOMIC>(mark_bit);
Marking::GreyToBlack<AccessMode::NON_ATOMIC>(mark_bit);
CHECK(Marking::IsBlack(mark_bit));
CHECK(Marking::IsBlackOrGrey(mark_bit));
CHECK(!Marking::IsImpossible(mark_bit));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment