Commit e7063b3d authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[GC] Small clean-ups

- const return type on Full{,Maybe,Heap}ObjectSlot::operator*
- Removed stale friend declarations
- Moved a method to the right section

Bug: v8:8557
Change-Id: I0bd3efdb96a7d997b4404d3a247bea55b083d611
Reviewed-on: https://chromium-review.googlesource.com/c/1467781Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59546}
parent 44483152
......@@ -2010,7 +2010,6 @@ class Heap {
friend class AlwaysAllocateScope;
friend class ArrayBufferCollector;
friend class ConcurrentMarking;
friend class EphemeronHashTableMarkingTask;
friend class GCCallbacksScope;
friend class GCTracer;
friend class MemoryController;
......
......@@ -906,7 +906,6 @@ class MarkCompactCollector final : public MarkCompactCollectorBase {
// used, so it is okay if this counter overflows and wraps around.
unsigned epoch_ = 0;
friend class EphemeronHashTableMarkingTask;
friend class FullEvacuator;
friend class Heap;
friend class RecordMigratedSlotVisitor;
......
......@@ -161,6 +161,19 @@ ResultType HeapVisitor<ResultType, ConcreteVisitor>::VisitFreeSpace(
return static_cast<ResultType>(object->size());
}
template <typename ResultType, typename ConcreteVisitor>
ResultType HeapVisitor<ResultType, ConcreteVisitor>::VisitWeakArray(
Map map, HeapObject object) {
ConcreteVisitor* visitor = static_cast<ConcreteVisitor*>(this);
if (!visitor->ShouldVisit(object)) return ResultType();
int size = WeakArrayBodyDescriptor::SizeOf(map, object);
if (visitor->ShouldVisitMapPointer()) {
visitor->VisitMapPointer(object, object->map_slot());
}
WeakArrayBodyDescriptor::IterateBody(map, object, size, visitor);
return size;
}
template <typename ConcreteVisitor>
int NewSpaceVisitor<ConcreteVisitor>::VisitNativeContext(Map map,
NativeContext object) {
......@@ -191,19 +204,6 @@ int NewSpaceVisitor<ConcreteVisitor>::VisitWeakCell(Map map,
return 0;
}
template <typename ResultType, typename ConcreteVisitor>
ResultType HeapVisitor<ResultType, ConcreteVisitor>::VisitWeakArray(
Map map, HeapObject object) {
ConcreteVisitor* visitor = static_cast<ConcreteVisitor*>(this);
if (!visitor->ShouldVisit(object)) return ResultType();
int size = WeakArrayBodyDescriptor::SizeOf(map, object);
if (visitor->ShouldVisitMapPointer()) {
visitor->VisitMapPointer(object, object->map_slot());
}
WeakArrayBodyDescriptor::IterateBody(map, object, size, visitor);
return size;
}
} // namespace internal
} // namespace v8
......
......@@ -31,7 +31,7 @@ bool FullObjectSlot::contains_value(Address raw_value) const {
return base::AsAtomicPointer::Relaxed_Load(location()) == raw_value;
}
Object FullObjectSlot::operator*() const { return Object(*location()); }
const Object FullObjectSlot::operator*() const { return Object(*location()); }
void FullObjectSlot::store(Object value) const { *location() = value->ptr(); }
......@@ -61,7 +61,7 @@ Object FullObjectSlot::Release_CompareAndSwap(Object old, Object target) const {
// FullMaybeObjectSlot implementation.
//
MaybeObject FullMaybeObjectSlot::operator*() const {
const MaybeObject FullMaybeObjectSlot::operator*() const {
return MaybeObject(*location());
}
......@@ -86,7 +86,7 @@ void FullMaybeObjectSlot::Release_CompareAndSwap(MaybeObject old,
// FullHeapObjectSlot implementation.
//
HeapObjectReference FullHeapObjectSlot::operator*() const {
const HeapObjectReference FullHeapObjectSlot::operator*() const {
return HeapObjectReference(*location());
}
......
......@@ -110,7 +110,7 @@ class FullObjectSlot
// raw value.
inline bool contains_value(Address raw_value) const;
inline Object operator*() const;
inline const Object operator*() const;
inline void store(Object value) const;
inline Object Acquire_Load() const;
......@@ -143,7 +143,7 @@ class FullMaybeObjectSlot
explicit FullMaybeObjectSlot(SlotBase<T, TData, kSlotDataSize> slot)
: SlotBase(slot.address()) {}
inline MaybeObject operator*() const;
inline const MaybeObject operator*() const;
inline void store(MaybeObject value) const;
inline MaybeObject Relaxed_Load() const;
......@@ -169,7 +169,7 @@ class FullHeapObjectSlot
explicit FullHeapObjectSlot(SlotBase<T, TData, kSlotDataSize> slot)
: SlotBase(slot.address()) {}
inline HeapObjectReference operator*() const;
inline const HeapObjectReference operator*() const;
inline void store(HeapObjectReference value) const;
inline HeapObject ToHeapObject() const;
......
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