Commit cfdf4218 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[cleanup] Remove ExternalReference::fixed_typed_array_base_data_offset

... which always contains constant value.

Bug: v8:8834
Change-Id: I27af24d07371b112d48eaab4d3a782a74af5fb20
Reviewed-on: https://chromium-review.googlesource.com/c/1487611Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59864}
parent 6070e74d
......@@ -119,9 +119,6 @@ TNode<JSArrayBuffer> TypedArrayBuiltinsAssembler::AllocateEmptyOnHeapBuffer(
TNode<FixedTypedArrayBase> TypedArrayBuiltinsAssembler::AllocateOnHeapElements(
TNode<Map> map, TNode<IntPtrT> total_size, TNode<Number> length) {
static const intptr_t fta_base_data_offset =
FixedTypedArrayBase::kDataOffset - kHeapObjectTag;
CSA_ASSERT(this, IntPtrGreaterThanOrEqual(total_size, IntPtrConstant(0)));
// Allocate a FixedTypedArray and set the length, base pointer and external
......@@ -141,10 +138,10 @@ TNode<FixedTypedArrayBase> TypedArrayBuiltinsAssembler::AllocateOnHeapElements(
StoreObjectFieldNoWriteBarrier(elements, FixedArray::kLengthOffset, length);
StoreObjectFieldNoWriteBarrier(
elements, FixedTypedArrayBase::kBasePointerOffset, elements);
StoreObjectFieldNoWriteBarrier(elements,
FixedTypedArrayBase::kExternalPointerOffset,
IntPtrConstant(fta_base_data_offset),
MachineType::PointerRepresentation());
StoreObjectFieldNoWriteBarrier(
elements, FixedTypedArrayBase::kExternalPointerOffset,
IntPtrConstant(FixedTypedArrayBase::ExternalPointerValueForOnHeapArray()),
MachineType::PointerRepresentation());
return CAST(elements);
}
......
......@@ -2007,11 +2007,10 @@ TNode<RawPtrT> CodeStubAssembler::LoadFixedTypedArrayOnHeapBackingStore(
// heap allocated typed array buffer. On heap allocated buffer's backing
// stores are a fixed offset from the pointer to a typed array's elements. See
// TypedArrayBuiltinsAssembler::AllocateOnHeapElements().
static const intptr_t fta_base_data_offset =
FixedTypedArrayBase::kDataOffset - kHeapObjectTag;
TNode<WordT> backing_store = IntPtrAdd(BitcastTaggedToWord(typed_array),
IntPtrConstant(fta_base_data_offset));
TNode<WordT> backing_store =
IntPtrAdd(BitcastTaggedToWord(typed_array),
IntPtrConstant(
FixedTypedArrayBase::ExternalPointerValueForOnHeapArray()));
#ifdef DEBUG
// Verify that this is an on heap backing store.
......
......@@ -790,11 +790,6 @@ ExternalReference ExternalReference::fast_c_call_caller_pc_address(
isolate->isolate_data()->fast_c_call_caller_pc_address());
}
ExternalReference ExternalReference::fixed_typed_array_base_data_offset() {
return ExternalReference(reinterpret_cast<void*>(
FixedTypedArrayBase::kDataOffset - kHeapObjectTag));
}
FUNCTION_REFERENCE(call_enqueue_microtask_function,
MicrotaskQueue::CallEnqueueMicrotask)
......
......@@ -112,7 +112,6 @@ class StatsCounter;
V(f64_acos_wrapper_function, "f64_acos_wrapper") \
V(f64_asin_wrapper_function, "f64_asin_wrapper") \
V(f64_mod_wrapper_function, "f64_mod_wrapper") \
V(fixed_typed_array_base_data_offset, "fixed_typed_array_base_data_offset") \
V(get_date_field_function, "JSDate::GetField") \
V(get_or_create_hash_raw, "get_or_create_hash_raw") \
V(ieee754_acos_function, "base::ieee754::acos") \
......
......@@ -1845,7 +1845,7 @@ Handle<FixedTypedArrayBase> Factory::NewFixedTypedArrayWithExternalPointer(
Handle<FixedTypedArrayBase> elements(FixedTypedArrayBase::cast(result),
isolate());
elements->set_base_pointer(Smi::kZero, SKIP_WRITE_BARRIER);
elements->set_external_pointer(external_pointer, SKIP_WRITE_BARRIER);
elements->set_external_pointer(external_pointer);
elements->set_length(length);
return elements;
}
......@@ -1868,9 +1868,7 @@ Handle<FixedTypedArrayBase> Factory::NewFixedTypedArray(
isolate());
elements->set_base_pointer(*elements, SKIP_WRITE_BARRIER);
elements->set_external_pointer(
reinterpret_cast<void*>(
ExternalReference::fixed_typed_array_base_data_offset().address()),
SKIP_WRITE_BARRIER);
FixedTypedArrayBase::ExternalPointerPtrForOnHeapArray());
elements->set_length(static_cast<int>(length));
if (initialize) memset(elements->DataPtr(), 0, elements->DataSize());
return elements;
......
......@@ -197,9 +197,7 @@ AllocationResult Heap::AllocateEmptyFixedTypedArray(
FixedTypedArrayBase elements = FixedTypedArrayBase::cast(object);
elements->set_base_pointer(elements, SKIP_WRITE_BARRIER);
elements->set_external_pointer(
reinterpret_cast<void*>(
ExternalReference::fixed_typed_array_base_data_offset().address()),
SKIP_WRITE_BARRIER);
FixedTypedArrayBase::ExternalPointerPtrForOnHeapArray());
elements->set_length(0);
return elements;
}
......
......@@ -510,8 +510,8 @@ template <class Traits>
void FixedTypedArray<Traits>::FixedTypedArrayVerify(Isolate* isolate) {
CHECK(IsHeapObject() && map()->instance_type() == Traits::kInstanceType);
if (base_pointer()->ptr() == ptr()) {
CHECK(reinterpret_cast<Address>(external_pointer()) ==
ExternalReference::fixed_typed_array_base_data_offset().address());
CHECK_EQ(reinterpret_cast<Address>(external_pointer()),
FixedTypedArrayBase::kDataOffset - kHeapObjectTag);
} else {
CHECK_EQ(base_pointer(), Smi::kZero);
}
......
......@@ -557,8 +557,7 @@ void* FixedTypedArrayBase::external_pointer() const {
return reinterpret_cast<void*>(ptr);
}
void FixedTypedArrayBase::set_external_pointer(void* value,
WriteBarrierMode mode) {
void FixedTypedArrayBase::set_external_pointer(void* value) {
intptr_t ptr = reinterpret_cast<intptr_t>(value);
WRITE_INTPTR_FIELD(*this, kExternalPointerOffset, ptr);
}
......
......@@ -585,7 +585,7 @@ class FixedTypedArrayBase : public FixedArrayBase {
// [external_pointer]: Contains the offset between base_pointer and the start
// of the data. If the base_pointer is a nullptr, the external_pointer
// therefore points to the actual backing store.
DECL_ACCESSORS(external_pointer, void*)
DECL_PRIMITIVE_ACCESSORS(external_pointer, void*)
// Dispatched behavior.
DECL_CAST(FixedTypedArrayBase)
......@@ -623,6 +623,14 @@ class FixedTypedArrayBase : public FixedArrayBase {
inline size_t ByteLength() const;
static inline intptr_t ExternalPointerValueForOnHeapArray() {
return FixedTypedArrayBase::kDataOffset - kHeapObjectTag;
}
static inline void* ExternalPointerPtrForOnHeapArray() {
return reinterpret_cast<void*>(ExternalPointerValueForOnHeapArray());
}
private:
static inline int ElementSize(InstanceType 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