Commit 33dadf96 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[objects] Remove redundant FIELD_ADDR_CONST

Since the switch of Address from byte* to uintptr_t, we technically
cannot differentiate between constant field addresses and non-constant
ones.
Thus remove the FIELD_ADDR_CONST macro, and use the identical
FIELD_ADDR instead.

R=jkummerow@chromium.org

Bug: v8:7570
Change-Id: Iea4dde36b42c6d0f0ea80a965806f1dbd7adcd39
Reviewed-on: https://chromium-review.googlesource.com/1032746Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52879}
parent ba616de1
......@@ -22,7 +22,7 @@ INT32_ACCESSORS(FeedbackMetadata, slot_count, kSlotCountOffset)
int32_t FeedbackMetadata::synchronized_slot_count() const {
return base::Acquire_Load(reinterpret_cast<const base::Atomic32*>(
FIELD_ADDR_CONST(this, kSlotCountOffset)));
FIELD_ADDR(this, kSlotCountOffset)));
}
// static
......
......@@ -3575,17 +3575,14 @@ void HeapNumber::HeapNumberPrint(std::ostream& os) { // NOLINT
#define FIELD_ADDR(p, offset) \
(reinterpret_cast<byte*>(p) + offset - kHeapObjectTag)
#define FIELD_ADDR_CONST(p, offset) \
(reinterpret_cast<const byte*>(p) + offset - kHeapObjectTag)
#define READ_INT32_FIELD(p, offset) \
(*reinterpret_cast<const int32_t*>(FIELD_ADDR_CONST(p, offset)))
(*reinterpret_cast<const int32_t*>(FIELD_ADDR(p, offset)))
#define READ_INT64_FIELD(p, offset) \
(*reinterpret_cast<const int64_t*>(FIELD_ADDR_CONST(p, offset)))
(*reinterpret_cast<const int64_t*>(FIELD_ADDR(p, offset)))
#define READ_BYTE_FIELD(p, offset) \
(*reinterpret_cast<const byte*>(FIELD_ADDR_CONST(p, offset)))
(*reinterpret_cast<const byte*>(FIELD_ADDR(p, offset)))
String* JSReceiver::class_name() {
if (IsFunction()) return GetHeap()->Function_string();
......@@ -19563,7 +19560,6 @@ MaybeHandle<Name> FunctionTemplateInfo::TryGetCachedPropertyName(
}
#undef FIELD_ADDR
#undef FIELD_ADDR_CONST
#undef READ_INT32_FIELD
#undef READ_INT64_FIELD
#undef READ_BYTE_FIELD
......
......@@ -63,7 +63,7 @@ class BigIntBase : public HeapObject {
inline digit_t digit(int n) const {
SLOW_DCHECK(0 <= n && n < length());
Address address = FIELD_ADDR_CONST(this, kDigitsOffset + n * kDigitSize);
Address address = FIELD_ADDR(this, kDigitsOffset + n * kDigitSize);
return *reinterpret_cast<digit_t*>(address);
}
......
......@@ -234,7 +234,7 @@ int Code::InstructionSize() const {
}
Address Code::raw_instruction_start() const {
return FIELD_ADDR_CONST(this, kHeaderSize);
return FIELD_ADDR(this, kHeaderSize);
}
Address Code::InstructionStart() const {
......@@ -273,7 +273,7 @@ void Code::set_unwinding_info_size(int value) {
Address Code::unwinding_info_start() const {
DCHECK(has_unwinding_info());
return FIELD_ADDR_CONST(this, GetUnwindingInfoSizeOffset()) + kInt64Size;
return FIELD_ADDR(this, GetUnwindingInfoSizeOffset()) + kInt64Size;
}
Address Code::unwinding_info_end() const {
......
......@@ -26,7 +26,6 @@
#undef BIT_FIELD_ACCESSORS
#undef TYPE_CHECKER
#undef FIELD_ADDR
#undef FIELD_ADDR_CONST
#undef READ_FIELD
#undef READ_WEAK_FIELD
#undef ACQUIRE_READ_FIELD
......
......@@ -148,26 +148,23 @@
#define FIELD_ADDR(p, offset) \
(reinterpret_cast<Address>(p) + offset - kHeapObjectTag)
#define FIELD_ADDR_CONST(p, offset) \
(reinterpret_cast<Address>(p) + offset - kHeapObjectTag)
#define READ_FIELD(p, offset) \
(*reinterpret_cast<Object* const*>(FIELD_ADDR_CONST(p, offset)))
(*reinterpret_cast<Object* const*>(FIELD_ADDR(p, offset)))
#define READ_WEAK_FIELD(p, offset) \
(*reinterpret_cast<MaybeObject* const*>(FIELD_ADDR_CONST(p, offset)))
(*reinterpret_cast<MaybeObject* const*>(FIELD_ADDR(p, offset)))
#define ACQUIRE_READ_FIELD(p, offset) \
reinterpret_cast<Object*>(base::Acquire_Load( \
reinterpret_cast<const base::AtomicWord*>(FIELD_ADDR_CONST(p, offset))))
reinterpret_cast<const base::AtomicWord*>(FIELD_ADDR(p, offset))))
#define RELAXED_READ_FIELD(p, offset) \
reinterpret_cast<Object*>(base::Relaxed_Load( \
reinterpret_cast<const base::AtomicWord*>(FIELD_ADDR_CONST(p, offset))))
reinterpret_cast<const base::AtomicWord*>(FIELD_ADDR(p, offset))))
#define RELAXED_READ_WEAK_FIELD(p, offset) \
reinterpret_cast<MaybeObject*>(base::Relaxed_Load( \
reinterpret_cast<const base::AtomicWord*>(FIELD_ADDR_CONST(p, offset))))
reinterpret_cast<const base::AtomicWord*>(FIELD_ADDR(p, offset))))
#ifdef V8_CONCURRENT_MARKING
#define WRITE_FIELD(p, offset, value) \
......@@ -225,24 +222,23 @@
value); \
}
#define READ_DOUBLE_FIELD(p, offset) \
ReadDoubleValue(FIELD_ADDR_CONST(p, offset))
#define READ_DOUBLE_FIELD(p, offset) ReadDoubleValue(FIELD_ADDR(p, offset))
#define WRITE_DOUBLE_FIELD(p, offset, value) \
WriteDoubleValue(FIELD_ADDR(p, offset), value)
#define READ_INT_FIELD(p, offset) \
(*reinterpret_cast<const int*>(FIELD_ADDR_CONST(p, offset)))
(*reinterpret_cast<const int*>(FIELD_ADDR(p, offset)))
#define WRITE_INT_FIELD(p, offset, value) \
(*reinterpret_cast<int*>(FIELD_ADDR(p, offset)) = value)
#define RELAXED_READ_INTPTR_FIELD(p, offset) \
static_cast<intptr_t>(base::Relaxed_Load( \
reinterpret_cast<const base::AtomicWord*>(FIELD_ADDR_CONST(p, offset))))
reinterpret_cast<const base::AtomicWord*>(FIELD_ADDR(p, offset))))
#define READ_INTPTR_FIELD(p, offset) \
(*reinterpret_cast<const intptr_t*>(FIELD_ADDR_CONST(p, offset)))
(*reinterpret_cast<const intptr_t*>(FIELD_ADDR(p, offset)))
#define RELAXED_WRITE_INTPTR_FIELD(p, offset, value) \
base::Relaxed_Store( \
......@@ -253,7 +249,7 @@
(*reinterpret_cast<intptr_t*>(FIELD_ADDR(p, offset)) = value)
#define READ_UINT8_FIELD(p, offset) \
(*reinterpret_cast<const uint8_t*>(FIELD_ADDR_CONST(p, offset)))
(*reinterpret_cast<const uint8_t*>(FIELD_ADDR(p, offset)))
#define WRITE_UINT8_FIELD(p, offset, value) \
(*reinterpret_cast<uint8_t*>(FIELD_ADDR(p, offset)) = value)
......@@ -263,63 +259,63 @@
static_cast<base::Atomic8>(value));
#define READ_INT8_FIELD(p, offset) \
(*reinterpret_cast<const int8_t*>(FIELD_ADDR_CONST(p, offset)))
(*reinterpret_cast<const int8_t*>(FIELD_ADDR(p, offset)))
#define RELAXED_READ_INT8_FIELD(p, offset) \
static_cast<int8_t>(base::Relaxed_Load( \
reinterpret_cast<const base::Atomic8*>(FIELD_ADDR_CONST(p, offset))))
reinterpret_cast<const base::Atomic8*>(FIELD_ADDR(p, offset))))
#define WRITE_INT8_FIELD(p, offset, value) \
(*reinterpret_cast<int8_t*>(FIELD_ADDR(p, offset)) = value)
#define READ_UINT16_FIELD(p, offset) \
(*reinterpret_cast<const uint16_t*>(FIELD_ADDR_CONST(p, offset)))
(*reinterpret_cast<const uint16_t*>(FIELD_ADDR(p, offset)))
#define WRITE_UINT16_FIELD(p, offset, value) \
(*reinterpret_cast<uint16_t*>(FIELD_ADDR(p, offset)) = value)
#define READ_INT16_FIELD(p, offset) \
(*reinterpret_cast<const int16_t*>(FIELD_ADDR_CONST(p, offset)))
(*reinterpret_cast<const int16_t*>(FIELD_ADDR(p, offset)))
#define WRITE_INT16_FIELD(p, offset, value) \
(*reinterpret_cast<int16_t*>(FIELD_ADDR(p, offset)) = value)
#define READ_UINT32_FIELD(p, offset) \
(*reinterpret_cast<const uint32_t*>(FIELD_ADDR_CONST(p, offset)))
(*reinterpret_cast<const uint32_t*>(FIELD_ADDR(p, offset)))
#define WRITE_UINT32_FIELD(p, offset, value) \
(*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset)) = value)
#define READ_INT32_FIELD(p, offset) \
(*reinterpret_cast<const int32_t*>(FIELD_ADDR_CONST(p, offset)))
(*reinterpret_cast<const int32_t*>(FIELD_ADDR(p, offset)))
#define WRITE_INT32_FIELD(p, offset, value) \
(*reinterpret_cast<int32_t*>(FIELD_ADDR(p, offset)) = value)
#define READ_FLOAT_FIELD(p, offset) \
(*reinterpret_cast<const float*>(FIELD_ADDR_CONST(p, offset)))
(*reinterpret_cast<const float*>(FIELD_ADDR(p, offset)))
#define WRITE_FLOAT_FIELD(p, offset, value) \
(*reinterpret_cast<float*>(FIELD_ADDR(p, offset)) = value)
#define READ_UINT64_FIELD(p, offset) \
(*reinterpret_cast<const uint64_t*>(FIELD_ADDR_CONST(p, offset)))
(*reinterpret_cast<const uint64_t*>(FIELD_ADDR(p, offset)))
#define WRITE_UINT64_FIELD(p, offset, value) \
(*reinterpret_cast<uint64_t*>(FIELD_ADDR(p, offset)) = value)
#define READ_INT64_FIELD(p, offset) \
(*reinterpret_cast<const int64_t*>(FIELD_ADDR_CONST(p, offset)))
(*reinterpret_cast<const int64_t*>(FIELD_ADDR(p, offset)))
#define WRITE_INT64_FIELD(p, offset, value) \
(*reinterpret_cast<int64_t*>(FIELD_ADDR(p, offset)) = value)
#define READ_BYTE_FIELD(p, offset) \
(*reinterpret_cast<const byte*>(FIELD_ADDR_CONST(p, offset)))
(*reinterpret_cast<const byte*>(FIELD_ADDR(p, offset)))
#define RELAXED_READ_BYTE_FIELD(p, offset) \
static_cast<byte>(base::Relaxed_Load( \
reinterpret_cast<const base::Atomic8*>(FIELD_ADDR_CONST(p, offset))))
reinterpret_cast<const base::Atomic8*>(FIELD_ADDR(p, offset))))
#define WRITE_BYTE_FIELD(p, offset, value) \
(*reinterpret_cast<byte*>(FIELD_ADDR(p, offset)) = value)
......
......@@ -31,7 +31,7 @@ CAST_ACCESSOR(WasmTableObject)
ACCESSORS(holder, name, type, offset)
#define READ_PRIMITIVE_FIELD(p, type, offset) \
(*reinterpret_cast<type const*>(FIELD_ADDR_CONST(p, offset)))
(*reinterpret_cast<type const*>(FIELD_ADDR(p, offset)))
#define WRITE_PRIMITIVE_FIELD(p, type, offset, value) \
(*reinterpret_cast<type*>(FIELD_ADDR(p, offset)) = value)
......
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