Commit ee1b6415 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[csa][cleanup] Simplify StoreElementBigIntOrTypedArray

BigInts are considered in the typed array elements kind, there's no need
to special case them.

Bug: v8:6949, v8:11384
Change-Id: I0b231d3ba2ca53236b2005d200b8a208bc57ed0e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2690595Reviewed-by: 's avatarDan Elphick <delphick@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72705}
parent 94b294b3
......@@ -9855,10 +9855,10 @@ MachineRepresentation ElementsKindToMachineRepresentation(ElementsKind kind) {
} // namespace
template <typename TArray, typename TIndex>
void CodeStubAssembler::StoreElementBigIntOrTypedArray(TNode<TArray> elements,
ElementsKind kind,
TNode<TIndex> index,
Node* value) {
void CodeStubAssembler::StoreElementTypedArray(TNode<TArray> elements,
ElementsKind kind,
TNode<TIndex> index,
Node* value) {
// TODO(v8:9708): Do we want to keep both IntPtrT and UintPtrT variants?
static_assert(std::is_same<TIndex, Smi>::value ||
std::is_same<TIndex, UintPtrT>::value ||
......@@ -9867,6 +9867,7 @@ void CodeStubAssembler::StoreElementBigIntOrTypedArray(TNode<TArray> elements,
static_assert(std::is_same<TArray, RawPtrT>::value ||
std::is_same<TArray, FixedArrayBase>::value,
"Only RawPtrT or FixedArrayBase elements are allowed");
DCHECK(IsTypedArrayElementsKind(kind));
if (kind == BIGINT64_ELEMENTS || kind == BIGUINT64_ELEMENTS) {
TNode<IntPtrT> offset = ElementOffsetFromIndex(index, kind, 0);
TVARIABLE(UintPtrT, var_low);
......@@ -9893,7 +9894,6 @@ void CodeStubAssembler::StoreElementBigIntOrTypedArray(TNode<TArray> elements,
}
#endif
} else {
DCHECK(IsTypedArrayElementsKind(kind));
if (kind == UINT8_CLAMPED_ELEMENTS) {
CSA_ASSERT(this, Word32Equal(UncheckedCast<Word32T>(value),
Word32And(Int32Constant(0xFF), value)));
......@@ -9913,9 +9913,8 @@ void CodeStubAssembler::StoreElement(TNode<FixedArrayBase> elements,
std::is_same<TIndex, Smi>::value || std::is_same<TIndex, IntPtrT>::value,
"Only Smi or IntPtrT indices are allowed");
DCHECK(!IsDoubleElementsKind(kind));
if (kind == BIGINT64_ELEMENTS || kind == BIGUINT64_ELEMENTS ||
IsTypedArrayElementsKind(kind)) {
StoreElementBigIntOrTypedArray(elements, kind, index, value);
if (IsTypedArrayElementsKind(kind)) {
StoreElementTypedArray(elements, kind, index, value);
} else if (IsSmiElementsKind(kind)) {
TNode<Smi> smi_value = CAST(value);
StoreFixedArrayElement(CAST(elements), index, smi_value);
......@@ -9938,9 +9937,8 @@ void CodeStubAssembler::StoreElement(TNode<FixedArrayBase> elements,
template <typename TIndex>
void CodeStubAssembler::StoreElement(TNode<RawPtrT> elements, ElementsKind kind,
TNode<TIndex> index, Node* value) {
DCHECK(kind == BIGINT64_ELEMENTS || kind == BIGUINT64_ELEMENTS ||
IsTypedArrayElementsKind(kind));
StoreElementBigIntOrTypedArray(elements, kind, index, value);
DCHECK(IsTypedArrayElementsKind(kind));
StoreElementTypedArray(elements, kind, index, value);
}
template V8_EXPORT_PRIVATE void CodeStubAssembler::StoreElement<UintPtrT>(
TNode<RawPtrT>, ElementsKind, TNode<UintPtrT>, Node*);
......
......@@ -3806,8 +3806,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
// TODO(solanes): This method can go away and simplify into only one version
// of StoreElement once we have "if constexpr" available to use.
template <typename TArray, typename TIndex>
void StoreElementBigIntOrTypedArray(TNode<TArray> elements, ElementsKind kind,
TNode<TIndex> index, Node* value);
void StoreElementTypedArray(TNode<TArray> elements, ElementsKind kind,
TNode<TIndex> index, Node* value);
template <typename TIndex>
void StoreElement(TNode<FixedArrayBase> elements, ElementsKind kind,
......
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