Commit 47636f18 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[csa][cleanup] Remove ParameterMode/TNodify size check methods

Do:
  * FixedArraySizeDoesntFitInNewSpace
  * GotoIfFixedArraySizeDoesntFitInNewSpace

Bug: v8:9708, v8:6949
Change-Id: Ic76b6b98620e6fcec9b13a940c51a36616c21a56
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2356347Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69429}
parent fe3b24a6
......@@ -3895,7 +3895,7 @@ TNode<FixedArray> CodeStubAssembler::ExtractToFixedArray(
if (extract_flags & ExtractFixedArrayFlag::kNewSpaceAllocationOnly) {
handle_old_space = false;
CSA_ASSERT(this, Word32BinaryNot(FixedArraySizeDoesntFitInNewSpace(
count, FixedArray::kHeaderSize, parameter_mode)));
count, FixedArray::kHeaderSize)));
} else {
int constant_count;
handle_old_space =
......@@ -3908,8 +3908,8 @@ TNode<FixedArray> CodeStubAssembler::ExtractToFixedArray(
Label old_space(this, Label::kDeferred);
if (handle_old_space) {
GotoIfFixedArraySizeDoesntFitInNewSpace(
capacity, &old_space, FixedArray::kHeaderSize, parameter_mode);
GotoIfFixedArraySizeDoesntFitInNewSpace(capacity, &old_space,
FixedArray::kHeaderSize);
}
Comment("Copy FixedArray in young generation");
......@@ -6369,12 +6369,16 @@ TNode<BoolT> CodeStubAssembler::IsNumberArrayIndex(TNode<Number> number) {
[=] { return IsHeapNumberUint32(CAST(number)); });
}
template <typename TIndex>
TNode<BoolT> CodeStubAssembler::FixedArraySizeDoesntFitInNewSpace(
Node* element_count, int base_size, ParameterMode mode) {
TNode<TIndex> element_count, int base_size) {
static_assert(
std::is_same<TIndex, Smi>::value || std::is_same<TIndex, IntPtrT>::value,
"Only Smi or IntPtrT element_count is allowed");
int max_newspace_elements =
(kMaxRegularHeapObjectSize - base_size) / kTaggedSize;
return IntPtrOrSmiGreaterThan(
element_count, IntPtrOrSmiConstant(max_newspace_elements, mode), mode);
element_count, IntPtrOrSmiConstant<TIndex>(max_newspace_elements));
}
TNode<Int32T> CodeStubAssembler::StringCharCodeAt(TNode<String> string,
......@@ -10359,9 +10363,10 @@ void CodeStubAssembler::BuildFastArrayForEach(
: IndexAdvanceMode::kPost);
}
template <typename TIndex>
void CodeStubAssembler::GotoIfFixedArraySizeDoesntFitInNewSpace(
Node* element_count, Label* doesnt_fit, int base_size, ParameterMode mode) {
GotoIf(FixedArraySizeDoesntFitInNewSpace(element_count, base_size, mode),
TNode<TIndex> element_count, Label* doesnt_fit, int base_size) {
GotoIf(FixedArraySizeDoesntFitInNewSpace(element_count, base_size),
doesnt_fit);
}
......
......@@ -2484,9 +2484,9 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
// [0, 2^32-1).
TNode<BoolT> IsNumberArrayIndex(TNode<Number> number);
TNode<BoolT> FixedArraySizeDoesntFitInNewSpace(
Node* element_count, int base_size = FixedArray::kHeaderSize,
ParameterMode mode = INTPTR_PARAMETERS);
template <typename TIndex>
TNode<BoolT> FixedArraySizeDoesntFitInNewSpace(TNode<TIndex> element_count,
int base_size);
TNode<BoolT> IsMetaMap(TNode<HeapObject> o) { return IsMapMap(o); }
......@@ -3300,9 +3300,10 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
PropertyArray::kHeaderSize);
}
void GotoIfFixedArraySizeDoesntFitInNewSpace(Node* element_count,
Label* doesnt_fit, int base_size,
ParameterMode mode);
template <typename TIndex>
void GotoIfFixedArraySizeDoesntFitInNewSpace(TNode<TIndex> element_count,
Label* doesnt_fit,
int base_size);
void InitializeFieldsWithRoot(TNode<HeapObject> object,
TNode<IntPtrT> start_offset,
......
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