Commit 9569d3f9 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[csa][cleanup] Remove ParameterMode/TNodify TryGrowElementsCapacity

Bug: v8:9708, v8:6949
Change-Id: I80fa9b813d6ce80e52a42a02b42f8c98e2f3f75f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2212267
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: 's avatarDan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68016}
parent 44143cfd
......@@ -4848,28 +4848,32 @@ TNode<FixedArrayBase> CodeStubAssembler::TryGrowElementsCapacity(
CSA_SLOW_ASSERT(this, IsFixedArrayWithKindOrEmpty(elements, kind));
TNode<Smi> capacity = LoadFixedArrayBaseLength(elements);
ParameterMode mode = OptimalParameterMode();
return TryGrowElementsCapacity(
object, elements, kind, TaggedToParameter<BInt>(key),
TaggedToParameter<BInt>(capacity), mode, bailout);
return TryGrowElementsCapacity(object, elements, kind,
TaggedToParameter<BInt>(key),
TaggedToParameter<BInt>(capacity), bailout);
}
template <typename TIndex>
TNode<FixedArrayBase> CodeStubAssembler::TryGrowElementsCapacity(
TNode<HeapObject> object, TNode<FixedArrayBase> elements, ElementsKind kind,
Node* key, Node* capacity, ParameterMode mode, Label* bailout) {
TNode<TIndex> key, TNode<TIndex> capacity, Label* bailout) {
static_assert(
std::is_same<TIndex, Smi>::value || std::is_same<TIndex, IntPtrT>::value,
"Only Smi or IntPtrT key and capacity nodes are allowed");
Comment("TryGrowElementsCapacity");
CSA_SLOW_ASSERT(this, IsFixedArrayWithKindOrEmpty(elements, kind));
CSA_SLOW_ASSERT(this, MatchesParameterMode(capacity, mode));
CSA_SLOW_ASSERT(this, MatchesParameterMode(key, mode));
// If the gap growth is too big, fall back to the runtime.
Node* max_gap = IntPtrOrSmiConstant(JSObject::kMaxGap, mode);
Node* max_capacity = IntPtrOrSmiAdd(capacity, max_gap, mode);
GotoIf(UintPtrOrSmiGreaterThanOrEqual(key, max_capacity, mode), bailout);
TNode<TIndex> max_gap = IntPtrOrSmiConstant<TIndex>(JSObject::kMaxGap);
TNode<TIndex> max_capacity = IntPtrOrSmiAdd(capacity, max_gap);
GotoIf(UintPtrOrSmiGreaterThanOrEqual(key, max_capacity), bailout);
// Calculate the capacity of the new backing store.
Node* new_capacity = CalculateNewElementsCapacity(
IntPtrOrSmiAdd(key, IntPtrOrSmiConstant(1, mode), mode), mode);
IntPtrOrSmiAdd(key, IntPtrOrSmiConstant<TIndex>(1)));
ParameterMode mode =
std::is_same<TIndex, Smi>::value ? SMI_PARAMETERS : INTPTR_PARAMETERS;
return GrowElementsCapacity(object, elements, kind, kind, capacity,
new_capacity, mode, bailout);
}
......@@ -9979,9 +9983,8 @@ Node* CodeStubAssembler::CheckForCapacityGrow(
GotoIf(UintPtrLessThan(key, current_capacity), &fits_capacity);
{
Node* new_elements =
TryGrowElementsCapacity(object, elements, kind, key, current_capacity,
INTPTR_PARAMETERS, &grow_bailout);
Node* new_elements = TryGrowElementsCapacity(
object, elements, kind, key, current_capacity, &grow_bailout);
checked_elements.Bind(new_elements);
Goto(&fits_capacity);
}
......
......@@ -2388,11 +2388,12 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
// Tries to grow the |capacity|-length |elements| array of given |object|
// to store the |key| or bails out if the growing gap is too big. Returns
// new elements.
template <typename TIndex>
TNode<FixedArrayBase> TryGrowElementsCapacity(TNode<HeapObject> object,
TNode<FixedArrayBase> elements,
ElementsKind kind, Node* key,
Node* capacity,
ParameterMode mode,
ElementsKind kind,
TNode<TIndex> key,
TNode<TIndex> capacity,
Label* bailout);
// Grows elements capacity of given object. Returns new elements.
......
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