Commit 71df56fd authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[cleanup][object] Use field_address instead of FIELD_ADDR macro

From `FIELD_ADDR(*this, abc)`, to `field_address(abc)`;

Bug: v8:10933
Change-Id: I49c3b19db3ca05947fbe7113642a85ba59da6cef
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2491029Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70705}
parent a6a301b7
......@@ -242,7 +242,7 @@ int Code::InstructionSize() const {
}
Address Code::raw_instruction_start() const {
return FIELD_ADDR(*this, kHeaderSize);
return field_address(kHeaderSize);
}
Address Code::InstructionStart() const {
......
......@@ -20,11 +20,11 @@ namespace internal {
TQ_OBJECT_CONSTRUCTORS_IMPL(EmbedderDataArray)
Address EmbedderDataArray::slots_start() {
return FIELD_ADDR(*this, OffsetOfElementAt(0));
return field_address(OffsetOfElementAt(0));
}
Address EmbedderDataArray::slots_end() {
return FIELD_ADDR(*this, OffsetOfElementAt(length()));
return field_address(OffsetOfElementAt(length()));
}
} // namespace internal
......
......@@ -37,8 +37,8 @@ INT32_ACCESSORS(FeedbackMetadata, closure_feedback_cell_count,
kFeedbackCellCountOffset)
int32_t FeedbackMetadata::synchronized_slot_count() const {
return base::Acquire_Load(reinterpret_cast<const base::Atomic32*>(
FIELD_ADDR(*this, kSlotCountOffset)));
return base::Acquire_Load(
reinterpret_cast<const base::Atomic32*>(field_address(kSlotCountOffset)));
}
int32_t FeedbackMetadata::get(int index) const {
......
......@@ -394,8 +394,7 @@ void FixedDoubleArray::MoveElements(Isolate* isolate, int dst_index,
int src_index, int len,
WriteBarrierMode mode) {
DCHECK_EQ(SKIP_WRITE_BARRIER, mode);
double* data_start =
reinterpret_cast<double*>(FIELD_ADDR(*this, kHeaderSize));
double* data_start = reinterpret_cast<double*>(field_address(kHeaderSize));
MemMove(data_start + dst_index, data_start + src_index, len * kDoubleSize);
}
......@@ -529,14 +528,14 @@ void ByteArray::set(int index, byte value) {
void ByteArray::copy_in(int index, const byte* buffer, int length) {
DCHECK(index >= 0 && length >= 0 && length <= kMaxInt - index &&
index + length <= this->length());
Address dst_addr = FIELD_ADDR(*this, kHeaderSize + index * kCharSize);
Address dst_addr = field_address(kHeaderSize + index * kCharSize);
memcpy(reinterpret_cast<void*>(dst_addr), buffer, length);
}
void ByteArray::copy_out(int index, byte* buffer, int length) {
DCHECK(index >= 0 && length >= 0 && length <= kMaxInt - index &&
index + length <= this->length());
Address src_addr = FIELD_ADDR(*this, kHeaderSize + index * kCharSize);
Address src_addr = field_address(kHeaderSize + index * kCharSize);
memcpy(buffer, reinterpret_cast<void*>(src_addr), length);
}
......
......@@ -362,7 +362,7 @@ void JSObject::RawFastDoublePropertyAsBitsAtPut(FieldIndex index,
// Double unboxing is enabled only on 64-bit platforms without pointer
// compression.
DCHECK_EQ(kDoubleSize, kTaggedSize);
Address field_addr = FIELD_ADDR(*this, index.offset());
Address field_addr = field_address(index.offset());
base::Relaxed_Store(reinterpret_cast<base::AtomicWord*>(field_addr),
static_cast<base::AtomicWord>(bits));
}
......
......@@ -661,11 +661,11 @@ void Object::WriteExternalPointerField(size_t offset, Isolate* isolate,
}
ObjectSlot HeapObject::RawField(int byte_offset) const {
return ObjectSlot(FIELD_ADDR(*this, byte_offset));
return ObjectSlot(field_address(byte_offset));
}
MaybeObjectSlot HeapObject::RawMaybeWeakField(int byte_offset) const {
return MaybeObjectSlot(FIELD_ADDR(*this, byte_offset));
return MaybeObjectSlot(field_address(byte_offset));
}
MapWord MapWord::FromMap(const Map map) { return MapWord(map.ptr()); }
......@@ -925,7 +925,7 @@ AllocationAlignment HeapObject::RequiredAlignment(Map map) {
}
Address HeapObject::GetFieldAddress(int field_offset) const {
return FIELD_ADDR(*this, field_offset);
return field_address(field_offset);
}
// static
......
......@@ -478,8 +478,7 @@ class SmallOrderedHashTable : public HeapObject {
}
Address GetHashTableStartAddress(int capacity) const {
return FIELD_ADDR(*this,
DataTableStartOffset() + DataTableSizeFor(capacity));
return field_address(DataTableStartOffset() + DataTableSizeFor(capacity));
}
void SetFirstEntry(int bucket, byte value) {
......
......@@ -57,7 +57,7 @@ void PreparseData::set(int index, byte value) {
void PreparseData::copy_in(int index, const byte* buffer, int length) {
DCHECK(index >= 0 && length >= 0 && length <= kMaxInt - index &&
index + length <= this->data_length());
Address dst_addr = FIELD_ADDR(*this, kDataStartOffset + index * kByteSize);
Address dst_addr = field_address(kDataStartOffset + index * kByteSize);
memcpy(reinterpret_cast<void*>(dst_addr), buffer, length);
}
......
......@@ -26,12 +26,12 @@ namespace internal {
int String::synchronized_length() const {
return base::AsAtomic32::Acquire_Load(
reinterpret_cast<const int32_t*>(FIELD_ADDR(*this, kLengthOffset)));
reinterpret_cast<const int32_t*>(field_address(kLengthOffset)));
}
void String::synchronized_set_length(int value) {
base::AsAtomic32::Release_Store(
reinterpret_cast<int32_t*>(FIELD_ADDR(*this, kLengthOffset)), value);
reinterpret_cast<int32_t*>(field_address(kLengthOffset)), value);
}
TQ_OBJECT_CONSTRUCTORS_IMPL(String)
......@@ -554,7 +554,7 @@ void SeqOneByteString::SeqOneByteStringSet(int index, uint16_t value) {
}
Address SeqOneByteString::GetCharsAddress() {
return FIELD_ADDR(*this, kHeaderSize);
return field_address(kHeaderSize);
}
uint8_t* SeqOneByteString::GetChars(const DisallowHeapAllocation& no_gc) {
......@@ -563,12 +563,12 @@ uint8_t* SeqOneByteString::GetChars(const DisallowHeapAllocation& no_gc) {
}
Address SeqTwoByteString::GetCharsAddress() {
return FIELD_ADDR(*this, kHeaderSize);
return field_address(kHeaderSize);
}
uc16* SeqTwoByteString::GetChars(const DisallowHeapAllocation& no_gc) {
USE(no_gc);
return reinterpret_cast<uc16*>(FIELD_ADDR(*this, kHeaderSize));
return reinterpret_cast<uc16*>(GetCharsAddress());
}
uint16_t SeqTwoByteString::Get(int index) {
......
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