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 { ...@@ -2010,7 +2010,6 @@ class Heap {
friend class AlwaysAllocateScope; friend class AlwaysAllocateScope;
friend class ArrayBufferCollector; friend class ArrayBufferCollector;
friend class ConcurrentMarking; friend class ConcurrentMarking;
friend class EphemeronHashTableMarkingTask;
friend class GCCallbacksScope; friend class GCCallbacksScope;
friend class GCTracer; friend class GCTracer;
friend class MemoryController; friend class MemoryController;
......
...@@ -906,7 +906,6 @@ class MarkCompactCollector final : public MarkCompactCollectorBase { ...@@ -906,7 +906,6 @@ class MarkCompactCollector final : public MarkCompactCollectorBase {
// used, so it is okay if this counter overflows and wraps around. // used, so it is okay if this counter overflows and wraps around.
unsigned epoch_ = 0; unsigned epoch_ = 0;
friend class EphemeronHashTableMarkingTask;
friend class FullEvacuator; friend class FullEvacuator;
friend class Heap; friend class Heap;
friend class RecordMigratedSlotVisitor; friend class RecordMigratedSlotVisitor;
......
...@@ -161,6 +161,19 @@ ResultType HeapVisitor<ResultType, ConcreteVisitor>::VisitFreeSpace( ...@@ -161,6 +161,19 @@ ResultType HeapVisitor<ResultType, ConcreteVisitor>::VisitFreeSpace(
return static_cast<ResultType>(object->size()); 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> template <typename ConcreteVisitor>
int NewSpaceVisitor<ConcreteVisitor>::VisitNativeContext(Map map, int NewSpaceVisitor<ConcreteVisitor>::VisitNativeContext(Map map,
NativeContext object) { NativeContext object) {
...@@ -191,19 +204,6 @@ int NewSpaceVisitor<ConcreteVisitor>::VisitWeakCell(Map map, ...@@ -191,19 +204,6 @@ int NewSpaceVisitor<ConcreteVisitor>::VisitWeakCell(Map map,
return 0; 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 internal
} // namespace v8 } // namespace v8
......
...@@ -31,7 +31,7 @@ bool FullObjectSlot::contains_value(Address raw_value) const { ...@@ -31,7 +31,7 @@ bool FullObjectSlot::contains_value(Address raw_value) const {
return base::AsAtomicPointer::Relaxed_Load(location()) == raw_value; 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(); } void FullObjectSlot::store(Object value) const { *location() = value->ptr(); }
...@@ -61,7 +61,7 @@ Object FullObjectSlot::Release_CompareAndSwap(Object old, Object target) const { ...@@ -61,7 +61,7 @@ Object FullObjectSlot::Release_CompareAndSwap(Object old, Object target) const {
// FullMaybeObjectSlot implementation. // FullMaybeObjectSlot implementation.
// //
MaybeObject FullMaybeObjectSlot::operator*() const { const MaybeObject FullMaybeObjectSlot::operator*() const {
return MaybeObject(*location()); return MaybeObject(*location());
} }
...@@ -86,7 +86,7 @@ void FullMaybeObjectSlot::Release_CompareAndSwap(MaybeObject old, ...@@ -86,7 +86,7 @@ void FullMaybeObjectSlot::Release_CompareAndSwap(MaybeObject old,
// FullHeapObjectSlot implementation. // FullHeapObjectSlot implementation.
// //
HeapObjectReference FullHeapObjectSlot::operator*() const { const HeapObjectReference FullHeapObjectSlot::operator*() const {
return HeapObjectReference(*location()); return HeapObjectReference(*location());
} }
......
...@@ -110,7 +110,7 @@ class FullObjectSlot ...@@ -110,7 +110,7 @@ class FullObjectSlot
// raw value. // raw value.
inline bool contains_value(Address raw_value) const; inline bool contains_value(Address raw_value) const;
inline Object operator*() const; inline const Object operator*() const;
inline void store(Object value) const; inline void store(Object value) const;
inline Object Acquire_Load() const; inline Object Acquire_Load() const;
...@@ -143,7 +143,7 @@ class FullMaybeObjectSlot ...@@ -143,7 +143,7 @@ class FullMaybeObjectSlot
explicit FullMaybeObjectSlot(SlotBase<T, TData, kSlotDataSize> slot) explicit FullMaybeObjectSlot(SlotBase<T, TData, kSlotDataSize> slot)
: SlotBase(slot.address()) {} : SlotBase(slot.address()) {}
inline MaybeObject operator*() const; inline const MaybeObject operator*() const;
inline void store(MaybeObject value) const; inline void store(MaybeObject value) const;
inline MaybeObject Relaxed_Load() const; inline MaybeObject Relaxed_Load() const;
...@@ -169,7 +169,7 @@ class FullHeapObjectSlot ...@@ -169,7 +169,7 @@ class FullHeapObjectSlot
explicit FullHeapObjectSlot(SlotBase<T, TData, kSlotDataSize> slot) explicit FullHeapObjectSlot(SlotBase<T, TData, kSlotDataSize> slot)
: SlotBase(slot.address()) {} : SlotBase(slot.address()) {}
inline HeapObjectReference operator*() const; inline const HeapObjectReference operator*() const;
inline void store(HeapObjectReference value) const; inline void store(HeapObjectReference value) const;
inline HeapObject ToHeapObject() 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