[csa][cleanup] Remove ParameterMode/TNodify StoreFixedDoubleArrayElement

Merge StoreFixedDoubleArrayElementSmi into StoreFixedDoubleArrayElement.

Bug: v8:9708, v8:6949
Change-Id: If82893e16117362b40219bbe768acfc94be498e5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2377949
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69574}
This commit is contained in:
Santiago Aboy Solanes 2020-08-26 15:54:33 +01:00 committed by Commit Bot
parent 8b1e3ddc18
commit 84cf890532
5 changed files with 24 additions and 22 deletions

View File

@ -45,7 +45,7 @@ StoreElement<array::FastPackedDoubleElements, float64>(
implicit context: Context)(
elements: FixedArrayBase, index: Smi, value: float64) {
const elems: FixedDoubleArray = UnsafeCast<FixedDoubleArray>(elements);
StoreFixedDoubleArrayElementSmi(elems, index, value);
StoreFixedDoubleArrayElement(elems, index, value);
}
// Fast-path for all PACKED_* elements kinds. These do not need to check

View File

@ -2755,22 +2755,32 @@ void CodeStubAssembler::StoreFixedArrayOrPropertyArrayElement(
}
}
template <typename TIndex>
void CodeStubAssembler::StoreFixedDoubleArrayElement(
TNode<FixedDoubleArray> object, Node* index_node, TNode<Float64T> value,
ParameterMode parameter_mode, CheckBounds check_bounds) {
CSA_SLOW_ASSERT(this, MatchesParameterMode(index_node, parameter_mode));
TNode<FixedDoubleArray> object, TNode<TIndex> index, TNode<Float64T> value,
CheckBounds check_bounds) {
// 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 ||
std::is_same<TIndex, IntPtrT>::value,
"Only Smi, UintPtrT or IntPtrT index is allowed");
if (NeedsBoundsCheck(check_bounds)) {
FixedArrayBoundsCheck(object, index_node, 0, parameter_mode);
const ParameterMode mode =
std::is_same<TIndex, Smi>::value ? SMI_PARAMETERS : INTPTR_PARAMETERS;
FixedArrayBoundsCheck(object, index, 0, mode);
}
TNode<IntPtrT> offset =
ElementOffsetFromIndex(index_node, PACKED_DOUBLE_ELEMENTS, parameter_mode,
FixedArray::kHeaderSize - kHeapObjectTag);
TNode<IntPtrT> offset = ElementOffsetFromIndex(
index, PACKED_DOUBLE_ELEMENTS, FixedArray::kHeaderSize - kHeapObjectTag);
MachineRepresentation rep = MachineRepresentation::kFloat64;
// Make sure we do not store signalling NaNs into double arrays.
TNode<Float64T> value_silenced = Float64SilenceNaN(value);
StoreNoWriteBarrier(rep, object, offset, value_silenced);
}
// Export the Smi version which is used outside of code-stub-assembler.
template V8_EXPORT_PRIVATE void CodeStubAssembler::StoreFixedDoubleArrayElement<
Smi>(TNode<FixedDoubleArray>, TNode<Smi>, TNode<Float64T>, CheckBounds);
void CodeStubAssembler::StoreFeedbackVectorSlot(
TNode<FeedbackVector> feedback_vector, TNode<UintPtrT> slot,
TNode<AnyTaggedT> value, WriteBarrierMode barrier_mode,
@ -9510,9 +9520,7 @@ void CodeStubAssembler::StoreElement(Node* elements, ElementsKind kind,
return;
} else if (IsDoubleElementsKind(kind)) {
TNode<Float64T> value_float64 = UncheckedCast<Float64T>(value);
const ParameterMode mode =
std::is_same<TIndex, Smi>::value ? SMI_PARAMETERS : INTPTR_PARAMETERS;
StoreFixedDoubleArrayElement(CAST(elements), index, value_float64, mode);
StoreFixedDoubleArrayElement(CAST(elements), index, value_float64);
} else {
WriteBarrierMode barrier_mode = IsSmiElementsKind(kind)
? UNSAFE_SKIP_WRITE_BARRIER

View File

@ -1570,16 +1570,10 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
UNSAFE_SKIP_WRITE_BARRIER, additional_offset);
}
template <typename TIndex>
void StoreFixedDoubleArrayElement(
TNode<FixedDoubleArray> object, Node* index, TNode<Float64T> value,
ParameterMode parameter_mode = INTPTR_PARAMETERS,
CheckBounds check_bounds = CheckBounds::kAlways);
void StoreFixedDoubleArrayElementSmi(TNode<FixedDoubleArray> object,
TNode<Smi> index,
TNode<Float64T> value) {
StoreFixedDoubleArrayElement(object, index, value, SMI_PARAMETERS);
}
TNode<FixedDoubleArray> object, TNode<TIndex> index,
TNode<Float64T> value, CheckBounds check_bounds = CheckBounds::kAlways);
void StoreDoubleHole(TNode<HeapObject> object, TNode<IntPtrT> offset);
void StoreFixedDoubleArrayHole(TNode<FixedDoubleArray> array,

View File

@ -91,7 +91,7 @@ extern macro StoreFixedArrayElement(
FixedArray, intptr, Smi, constexpr WriteBarrierMode): void;
extern operator '.floats[]=' macro StoreFixedDoubleArrayElement(
FixedDoubleArray, intptr, float64): void;
extern operator '.floats[]=' macro StoreFixedDoubleArrayElementSmi(
extern operator '.floats[]=' macro StoreFixedDoubleArrayElement(
FixedDoubleArray, Smi, float64): void;
extern operator '.floats[]' macro LoadFixedDoubleArrayElement(
FixedDoubleArray, intptr): float64;

View File

@ -294,7 +294,7 @@ Store<FastDoubleElements>(
const elements = UnsafeCast<FixedDoubleArray>(object.elements);
const heapVal = UnsafeCast<HeapNumber>(value);
const val = Convert<float64>(heapVal);
StoreFixedDoubleArrayElementSmi(elements, index, val);
StoreFixedDoubleArrayElement(elements, index, val);
return kSuccess;
}