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( ...@@ -3895,7 +3895,7 @@ TNode<FixedArray> CodeStubAssembler::ExtractToFixedArray(
if (extract_flags & ExtractFixedArrayFlag::kNewSpaceAllocationOnly) { if (extract_flags & ExtractFixedArrayFlag::kNewSpaceAllocationOnly) {
handle_old_space = false; handle_old_space = false;
CSA_ASSERT(this, Word32BinaryNot(FixedArraySizeDoesntFitInNewSpace( CSA_ASSERT(this, Word32BinaryNot(FixedArraySizeDoesntFitInNewSpace(
count, FixedArray::kHeaderSize, parameter_mode))); count, FixedArray::kHeaderSize)));
} else { } else {
int constant_count; int constant_count;
handle_old_space = handle_old_space =
...@@ -3908,8 +3908,8 @@ TNode<FixedArray> CodeStubAssembler::ExtractToFixedArray( ...@@ -3908,8 +3908,8 @@ TNode<FixedArray> CodeStubAssembler::ExtractToFixedArray(
Label old_space(this, Label::kDeferred); Label old_space(this, Label::kDeferred);
if (handle_old_space) { if (handle_old_space) {
GotoIfFixedArraySizeDoesntFitInNewSpace( GotoIfFixedArraySizeDoesntFitInNewSpace(capacity, &old_space,
capacity, &old_space, FixedArray::kHeaderSize, parameter_mode); FixedArray::kHeaderSize);
} }
Comment("Copy FixedArray in young generation"); Comment("Copy FixedArray in young generation");
...@@ -6369,12 +6369,16 @@ TNode<BoolT> CodeStubAssembler::IsNumberArrayIndex(TNode<Number> number) { ...@@ -6369,12 +6369,16 @@ TNode<BoolT> CodeStubAssembler::IsNumberArrayIndex(TNode<Number> number) {
[=] { return IsHeapNumberUint32(CAST(number)); }); [=] { return IsHeapNumberUint32(CAST(number)); });
} }
template <typename TIndex>
TNode<BoolT> CodeStubAssembler::FixedArraySizeDoesntFitInNewSpace( 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 = int max_newspace_elements =
(kMaxRegularHeapObjectSize - base_size) / kTaggedSize; (kMaxRegularHeapObjectSize - base_size) / kTaggedSize;
return IntPtrOrSmiGreaterThan( return IntPtrOrSmiGreaterThan(
element_count, IntPtrOrSmiConstant(max_newspace_elements, mode), mode); element_count, IntPtrOrSmiConstant<TIndex>(max_newspace_elements));
} }
TNode<Int32T> CodeStubAssembler::StringCharCodeAt(TNode<String> string, TNode<Int32T> CodeStubAssembler::StringCharCodeAt(TNode<String> string,
...@@ -10359,9 +10363,10 @@ void CodeStubAssembler::BuildFastArrayForEach( ...@@ -10359,9 +10363,10 @@ void CodeStubAssembler::BuildFastArrayForEach(
: IndexAdvanceMode::kPost); : IndexAdvanceMode::kPost);
} }
template <typename TIndex>
void CodeStubAssembler::GotoIfFixedArraySizeDoesntFitInNewSpace( void CodeStubAssembler::GotoIfFixedArraySizeDoesntFitInNewSpace(
Node* element_count, Label* doesnt_fit, int base_size, ParameterMode mode) { TNode<TIndex> element_count, Label* doesnt_fit, int base_size) {
GotoIf(FixedArraySizeDoesntFitInNewSpace(element_count, base_size, mode), GotoIf(FixedArraySizeDoesntFitInNewSpace(element_count, base_size),
doesnt_fit); doesnt_fit);
} }
......
...@@ -2484,9 +2484,9 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ...@@ -2484,9 +2484,9 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
// [0, 2^32-1). // [0, 2^32-1).
TNode<BoolT> IsNumberArrayIndex(TNode<Number> number); TNode<BoolT> IsNumberArrayIndex(TNode<Number> number);
TNode<BoolT> FixedArraySizeDoesntFitInNewSpace( template <typename TIndex>
Node* element_count, int base_size = FixedArray::kHeaderSize, TNode<BoolT> FixedArraySizeDoesntFitInNewSpace(TNode<TIndex> element_count,
ParameterMode mode = INTPTR_PARAMETERS); int base_size);
TNode<BoolT> IsMetaMap(TNode<HeapObject> o) { return IsMapMap(o); } TNode<BoolT> IsMetaMap(TNode<HeapObject> o) { return IsMapMap(o); }
...@@ -3300,9 +3300,10 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ...@@ -3300,9 +3300,10 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
PropertyArray::kHeaderSize); PropertyArray::kHeaderSize);
} }
void GotoIfFixedArraySizeDoesntFitInNewSpace(Node* element_count, template <typename TIndex>
Label* doesnt_fit, int base_size, void GotoIfFixedArraySizeDoesntFitInNewSpace(TNode<TIndex> element_count,
ParameterMode mode); Label* doesnt_fit,
int base_size);
void InitializeFieldsWithRoot(TNode<HeapObject> object, void InitializeFieldsWithRoot(TNode<HeapObject> object,
TNode<IntPtrT> start_offset, 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