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

[csa][cleanup] Remove ParameterMode/TNodify StoreFixedArrayElement

It has several variants that might need to be simplified but this
CL focuses on removing ParameterMode.

Bug: v8:9708, v8:6949
Change-Id: I1c300b7abe0b698a9f3d063e0af1ed931dbf4af2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2376820Reviewed-by: 's avatarDan Elphick <delphick@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69572}
parent 35cc3da9
......@@ -9517,9 +9517,7 @@ void CodeStubAssembler::StoreElement(Node* elements, ElementsKind kind,
WriteBarrierMode barrier_mode = IsSmiElementsKind(kind)
? UNSAFE_SKIP_WRITE_BARRIER
: UPDATE_WRITE_BARRIER;
const ParameterMode mode =
std::is_same<TIndex, Smi>::value ? SMI_PARAMETERS : INTPTR_PARAMETERS;
StoreFixedArrayElement(CAST(elements), index, value, barrier_mode, 0, mode);
StoreFixedArrayElement(CAST(elements), index, value, barrier_mode, 0);
}
}
......
......@@ -1483,8 +1483,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER,
CheckBounds check_bounds = CheckBounds::kAlways) {
return StoreFixedArrayElement(object, IntPtrConstant(index), value,
barrier_mode, 0, INTPTR_PARAMETERS,
check_bounds);
barrier_mode, 0, check_bounds);
}
// This doesn't emit a bounds-check. As part of the security-performance
// tradeoff, only use it if it is performance critical.
......@@ -1504,20 +1503,26 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<Smi> value,
CheckBounds check_bounds = CheckBounds::kAlways) {
return StoreFixedArrayElement(object, IntPtrConstant(index), value,
UNSAFE_SKIP_WRITE_BARRIER, 0,
INTPTR_PARAMETERS, check_bounds);
UNSAFE_SKIP_WRITE_BARRIER, 0, check_bounds);
}
template <typename TIndex>
void StoreFixedArrayElement(
TNode<FixedArray> array, Node* index, SloppyTNode<Object> value,
TNode<FixedArray> array, TNode<TIndex> index, SloppyTNode<Object> value,
WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER,
int additional_offset = 0,
ParameterMode parameter_mode = INTPTR_PARAMETERS,
CheckBounds check_bounds = CheckBounds::kAlways) {
// 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");
const ParameterMode mode =
std::is_same<TIndex, Smi>::value ? SMI_PARAMETERS : INTPTR_PARAMETERS;
if (NeedsBoundsCheck(check_bounds)) {
FixedArrayBoundsCheck(array, index, additional_offset, parameter_mode);
FixedArrayBoundsCheck(array, index, additional_offset, mode);
}
StoreFixedArrayOrPropertyArrayElement(array, index, value, barrier_mode,
additional_offset, parameter_mode);
additional_offset, mode);
}
// This doesn't emit a bounds-check. As part of the security-performance
// tradeoff, only use it if it is performance critical.
......@@ -1526,8 +1531,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER,
int additional_offset = 0) {
return StoreFixedArrayElement(array, index, value, barrier_mode,
additional_offset, INTPTR_PARAMETERS,
CheckBounds::kDebugOnly);
additional_offset, CheckBounds::kDebugOnly);
}
void UnsafeStoreFixedArrayElement(TNode<FixedArray> array,
......@@ -1535,7 +1539,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
int additional_offset) {
return StoreFixedArrayElement(array, index, value,
UNSAFE_SKIP_WRITE_BARRIER, additional_offset,
INTPTR_PARAMETERS, CheckBounds::kDebugOnly);
CheckBounds::kDebugOnly);
}
void StorePropertyArrayElement(TNode<PropertyArray> array,
......@@ -1547,8 +1551,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
void StoreFixedArrayElement(
TNode<FixedArray> array, TNode<Smi> index, TNode<Object> value,
WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER) {
StoreFixedArrayElement(array, index, value, barrier_mode, 0,
SMI_PARAMETERS);
StoreFixedArrayElement(array, index, value, barrier_mode, 0);
}
void StoreFixedArrayElement(
TNode<FixedArray> array, TNode<IntPtrT> index, TNode<Smi> value,
......@@ -1564,8 +1567,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
int additional_offset = 0) {
DCHECK_EQ(SKIP_WRITE_BARRIER, barrier_mode);
StoreFixedArrayElement(array, index, TNode<Object>{value},
UNSAFE_SKIP_WRITE_BARRIER, additional_offset,
SMI_PARAMETERS);
UNSAFE_SKIP_WRITE_BARRIER, additional_offset);
}
void StoreFixedDoubleArrayElement(
......
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