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