Commit dc7ce21a authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by V8 LUCI CQ

[cleanup] Use the relaxed load/store tags in RELAXED_SMI_ACCESSORS

Similar to removing synchronized_ from the object macros[1], we can do
it for RELAXED_SMI_ACCESSORS and use the corresponding relaxed tags.

Bug: v8:7790
Change-Id: Iafc0ed9587e30df0b83565b2976522c4aa634c63
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2880535Reviewed-by: 's avatarDominik Inführ <dinfuehr@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74465}
parent 63289611
......@@ -48,7 +48,7 @@ FreeSpace FreeListCategory::SearchForNodeInList(size_t minimum_size,
for (FreeSpace cur_node = top(); !cur_node.is_null();
cur_node = cur_node.next()) {
DCHECK(Page::FromHeapObject(cur_node)->CanAllocate());
size_t size = cur_node.size();
size_t size = cur_node.size(kRelaxedLoad);
if (size >= minimum_size) {
DCHECK_GE(available_, size);
UpdateCountersAfterAllocation(size);
......@@ -510,7 +510,7 @@ size_t FreeListCategory::SumFreeList() {
->isolate()
->root(RootIndex::kFreeSpaceMap)
.ptr()));
sum += cur.relaxed_read_size();
sum += cur.size(kRelaxedLoad);
cur = cur.next();
}
return sum;
......
......@@ -3082,7 +3082,7 @@ HeapObject CreateFillerObjectAtImpl(ReadOnlyRoots roots, Address addr, int size,
DCHECK_GT(size, 2 * kTaggedSize);
filler.set_map_after_allocation(roots.unchecked_free_space_map(),
SKIP_WRITE_BARRIER);
FreeSpace::cast(filler).relaxed_write_size(size);
FreeSpace::cast(filler).set_size(size, kRelaxedStore);
if (clear_memory_mode == ClearFreedMemoryMode::kClearFreedMemory) {
MemsetTagged(ObjectSlot(addr) + 2, Object(kClearedFreeMemoryValue),
(size / kTaggedSize) - 2);
......
......@@ -168,7 +168,7 @@ ResultType HeapVisitor<ResultType, ConcreteVisitor>::VisitFreeSpace(
if (visitor->ShouldVisitMapPointer()) {
visitor->VisitMapPointer(object);
}
return static_cast<ResultType>(object.size());
return static_cast<ResultType>(object.size(kRelaxedLoad));
}
template <typename ConcreteVisitor>
......
......@@ -23,7 +23,7 @@ TQ_OBJECT_CONSTRUCTORS_IMPL(FreeSpace)
RELAXED_SMI_ACCESSORS(FreeSpace, size, kSizeOffset)
int FreeSpace::Size() { return size(); }
int FreeSpace::Size() { return size(kRelaxedLoad); }
FreeSpace FreeSpace::next() {
DCHECK(IsValid());
......@@ -53,7 +53,7 @@ bool FreeSpace::IsValid() {
CHECK_IMPLIES(!map_slot().contains_map_value(free_space_map.ptr()),
!heap->deserialization_complete() &&
map_slot().contains_map_value(kNullAddress));
CHECK_LE(kNextOffset + kTaggedSize, relaxed_read_size());
CHECK_LE(kNextOffset + kTaggedSize, size(kRelaxedLoad));
return true;
}
......
......@@ -23,8 +23,7 @@ namespace internal {
class FreeSpace : public TorqueGeneratedFreeSpace<FreeSpace, HeapObject> {
public:
// [size]: size of the free space including the header.
inline int relaxed_read_size() const;
inline void relaxed_write_size(int value);
DECL_RELAXED_SMI_ACCESSORS(size)
inline int Size();
......
......@@ -62,6 +62,7 @@
#undef SMI_ACCESSORS_CHECKED
#undef SMI_ACCESSORS
#undef SYNCHRONIZED_SMI_ACCESSORS
#undef DECL_RELAXED_SMI_ACCESSORS
#undef RELAXED_SMI_ACCESSORS
#undef BOOL_GETTER
#undef BOOL_ACCESSORS
......
......@@ -333,12 +333,16 @@
TaggedField<Smi, offset>::Release_Store(*this, Smi::FromInt(value)); \
}
#define DECL_RELAXED_SMI_ACCESSORS(name) \
inline int name(RelaxedLoadTag) const; \
inline void set_##name(int value, RelaxedStoreTag);
#define RELAXED_SMI_ACCESSORS(holder, name, offset) \
int holder::relaxed_read_##name() const { \
int holder::name(RelaxedLoadTag) const { \
Smi value = TaggedField<Smi, offset>::Relaxed_Load(*this); \
return value.value(); \
} \
void holder::relaxed_write_##name(int value) { \
void holder::set_##name(int value, RelaxedStoreTag) { \
TaggedField<Smi, offset>::Relaxed_Store(*this, Smi::FromInt(value)); \
}
......
......@@ -2061,7 +2061,7 @@ void HeapObject::HeapObjectShortPrint(std::ostream& os) {
os << "<FeedbackVector[" << FeedbackVector::cast(*this).length() << "]>";
break;
case FREE_SPACE_TYPE:
os << "<FreeSpace[" << FreeSpace::cast(*this).size() << "]>";
os << "<FreeSpace[" << FreeSpace::cast(*this).size(kRelaxedLoad) << "]>";
break;
case PREPARSE_DATA_TYPE: {
......@@ -2284,7 +2284,7 @@ int HeapObject::SizeFromMap(Map map) const {
BytecodeArray::unchecked_cast(*this).synchronized_length());
}
if (instance_type == FREE_SPACE_TYPE) {
return FreeSpace::unchecked_cast(*this).relaxed_read_size();
return FreeSpace::unchecked_cast(*this).size(kRelaxedLoad);
}
if (instance_type == STRING_TYPE ||
instance_type == INTERNALIZED_STRING_TYPE) {
......
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