[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/+/2690595
Reviewed-by: Dan Elphick <delphick@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72705}
This commit is contained in:
Santiago Aboy Solanes 2021-02-11 21:04:35 +00:00 committed by Commit Bot
parent 94b294b349
commit ee1b6415bb
2 changed files with 11 additions and 13 deletions

View File

@ -9855,10 +9855,10 @@ MachineRepresentation ElementsKindToMachineRepresentation(ElementsKind kind) {
} // namespace } // namespace
template <typename TArray, typename TIndex> template <typename TArray, typename TIndex>
void CodeStubAssembler::StoreElementBigIntOrTypedArray(TNode<TArray> elements, void CodeStubAssembler::StoreElementTypedArray(TNode<TArray> elements,
ElementsKind kind, ElementsKind kind,
TNode<TIndex> index, TNode<TIndex> index,
Node* value) { Node* value) {
// TODO(v8:9708): Do we want to keep both IntPtrT and UintPtrT variants? // TODO(v8:9708): Do we want to keep both IntPtrT and UintPtrT variants?
static_assert(std::is_same<TIndex, Smi>::value || static_assert(std::is_same<TIndex, Smi>::value ||
std::is_same<TIndex, UintPtrT>::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 || static_assert(std::is_same<TArray, RawPtrT>::value ||
std::is_same<TArray, FixedArrayBase>::value, std::is_same<TArray, FixedArrayBase>::value,
"Only RawPtrT or FixedArrayBase elements are allowed"); "Only RawPtrT or FixedArrayBase elements are allowed");
DCHECK(IsTypedArrayElementsKind(kind));
if (kind == BIGINT64_ELEMENTS || kind == BIGUINT64_ELEMENTS) { if (kind == BIGINT64_ELEMENTS || kind == BIGUINT64_ELEMENTS) {
TNode<IntPtrT> offset = ElementOffsetFromIndex(index, kind, 0); TNode<IntPtrT> offset = ElementOffsetFromIndex(index, kind, 0);
TVARIABLE(UintPtrT, var_low); TVARIABLE(UintPtrT, var_low);
@ -9893,7 +9894,6 @@ void CodeStubAssembler::StoreElementBigIntOrTypedArray(TNode<TArray> elements,
} }
#endif #endif
} else { } else {
DCHECK(IsTypedArrayElementsKind(kind));
if (kind == UINT8_CLAMPED_ELEMENTS) { if (kind == UINT8_CLAMPED_ELEMENTS) {
CSA_ASSERT(this, Word32Equal(UncheckedCast<Word32T>(value), CSA_ASSERT(this, Word32Equal(UncheckedCast<Word32T>(value),
Word32And(Int32Constant(0xFF), 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, std::is_same<TIndex, Smi>::value || std::is_same<TIndex, IntPtrT>::value,
"Only Smi or IntPtrT indices are allowed"); "Only Smi or IntPtrT indices are allowed");
DCHECK(!IsDoubleElementsKind(kind)); DCHECK(!IsDoubleElementsKind(kind));
if (kind == BIGINT64_ELEMENTS || kind == BIGUINT64_ELEMENTS || if (IsTypedArrayElementsKind(kind)) {
IsTypedArrayElementsKind(kind)) { StoreElementTypedArray(elements, kind, index, value);
StoreElementBigIntOrTypedArray(elements, kind, index, value);
} else if (IsSmiElementsKind(kind)) { } else if (IsSmiElementsKind(kind)) {
TNode<Smi> smi_value = CAST(value); TNode<Smi> smi_value = CAST(value);
StoreFixedArrayElement(CAST(elements), index, smi_value); StoreFixedArrayElement(CAST(elements), index, smi_value);
@ -9938,9 +9937,8 @@ void CodeStubAssembler::StoreElement(TNode<FixedArrayBase> elements,
template <typename TIndex> template <typename TIndex>
void CodeStubAssembler::StoreElement(TNode<RawPtrT> elements, ElementsKind kind, void CodeStubAssembler::StoreElement(TNode<RawPtrT> elements, ElementsKind kind,
TNode<TIndex> index, Node* value) { TNode<TIndex> index, Node* value) {
DCHECK(kind == BIGINT64_ELEMENTS || kind == BIGUINT64_ELEMENTS || DCHECK(IsTypedArrayElementsKind(kind));
IsTypedArrayElementsKind(kind)); StoreElementTypedArray(elements, kind, index, value);
StoreElementBigIntOrTypedArray(elements, kind, index, value);
} }
template V8_EXPORT_PRIVATE void CodeStubAssembler::StoreElement<UintPtrT>( template V8_EXPORT_PRIVATE void CodeStubAssembler::StoreElement<UintPtrT>(
TNode<RawPtrT>, ElementsKind, TNode<UintPtrT>, Node*); TNode<RawPtrT>, ElementsKind, TNode<UintPtrT>, Node*);

View File

@ -3806,8 +3806,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
// TODO(solanes): This method can go away and simplify into only one version // TODO(solanes): This method can go away and simplify into only one version
// of StoreElement once we have "if constexpr" available to use. // of StoreElement once we have "if constexpr" available to use.
template <typename TArray, typename TIndex> template <typename TArray, typename TIndex>
void StoreElementBigIntOrTypedArray(TNode<TArray> elements, ElementsKind kind, void StoreElementTypedArray(TNode<TArray> elements, ElementsKind kind,
TNode<TIndex> index, Node* value); TNode<TIndex> index, Node* value);
template <typename TIndex> template <typename TIndex>
void StoreElement(TNode<FixedArrayBase> elements, ElementsKind kind, void StoreElement(TNode<FixedArrayBase> elements, ElementsKind kind,