[csa][cleanup] Remove ParameterMode/TNodify ExtractToFixedArray

Bug: v8:9708, v8:6949
Change-Id: I3d1bcf144c69a736b19b845d89e34af9bf15f5f1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2352786
Reviewed-by: Mythri Alle <mythria@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69401}
This commit is contained in:
Santiago Aboy Solanes 2020-08-13 15:34:39 +01:00 committed by Commit Bot
parent f5c83e20e8
commit c92de6a373
2 changed files with 28 additions and 31 deletions

View File

@ -3831,19 +3831,21 @@ TNode<FixedArrayBase> CodeStubAssembler::AllocateFixedArray(
return UncheckedCast<FixedArrayBase>(array);
}
template <typename TIndex>
TNode<FixedArray> CodeStubAssembler::ExtractToFixedArray(
SloppyTNode<FixedArrayBase> source, Node* first, Node* count,
Node* capacity, SloppyTNode<Map> source_map, ElementsKind from_kind,
AllocationFlags allocation_flags, ExtractFixedArrayFlags extract_flags,
ParameterMode parameter_mode, HoleConversionMode convert_holes,
SloppyTNode<FixedArrayBase> source, TNode<TIndex> first,
TNode<TIndex> count, TNode<TIndex> capacity, TNode<Map> source_map,
ElementsKind from_kind, AllocationFlags allocation_flags,
ExtractFixedArrayFlags extract_flags, HoleConversionMode convert_holes,
TVariable<BoolT>* var_holes_converted,
base::Optional<TNode<Int32T>> source_elements_kind) {
DCHECK_NE(first, nullptr);
DCHECK_NE(count, nullptr);
DCHECK_NE(capacity, nullptr);
static_assert(
std::is_same<TIndex, Smi>::value || std::is_same<TIndex, IntPtrT>::value,
"Only Smi or IntPtrT first, count, and capacity are allowed");
DCHECK(extract_flags & ExtractFixedArrayFlag::kFixedArrays);
CSA_ASSERT(this, IntPtrOrSmiNotEqual(IntPtrOrSmiConstant(0, parameter_mode),
capacity, parameter_mode));
CSA_ASSERT(this,
IntPtrOrSmiNotEqual(IntPtrOrSmiConstant<TIndex>(0), capacity));
CSA_ASSERT(this, TaggedEqual(source_map, LoadMap(source)));
TVARIABLE(FixedArrayBase, var_result);
@ -3871,8 +3873,7 @@ TNode<FixedArray> CodeStubAssembler::ExtractToFixedArray(
// 1) |extract_flags| forces us to, or
// 2) we're asked to extract only part of the |source| (|first| != 0).
if (extract_flags & ExtractFixedArrayFlag::kDontCopyCOW) {
Branch(IntPtrOrSmiNotEqual(IntPtrOrSmiConstant(0, parameter_mode),
first, parameter_mode),
Branch(IntPtrOrSmiNotEqual(IntPtrOrSmiConstant<TIndex>(0), first),
&new_space_check, [&] {
var_result = source;
Goto(&done);
@ -3884,6 +3885,9 @@ TNode<FixedArray> CodeStubAssembler::ExtractToFixedArray(
}
}
const ParameterMode parameter_mode =
std::is_same<TIndex, Smi>::value ? SMI_PARAMETERS : INTPTR_PARAMETERS;
BIND(&new_space_check);
{
bool handle_old_space = !FLAG_young_generation_large_objects;
@ -3940,8 +3944,7 @@ TNode<FixedArray> CodeStubAssembler::ExtractToFixedArray(
FillFixedArrayWithValue(to_kind, to_elements, count, capacity,
RootIndex::kTheHoleValue, parameter_mode);
CopyElements(to_kind, to_elements, IntPtrConstant(0), source,
ParameterToIntPtr(first, parameter_mode),
ParameterToIntPtr(count, parameter_mode),
ParameterToIntPtr(first), ParameterToIntPtr(count),
SKIP_WRITE_BARRIER);
} else {
CopyFixedArrayElements(from_kind, source, to_kind, to_elements, first,
@ -3976,8 +3979,7 @@ TNode<FixedArray> CodeStubAssembler::ExtractToFixedArray(
// GC. Otherwise it will copy elements by elements, but skip write
// barriers (since we're copying smis to smis).
CopyElements(to_smi_kind, to_elements, IntPtrConstant(0), source,
ParameterToIntPtr(first, parameter_mode),
ParameterToIntPtr(count, parameter_mode),
ParameterToIntPtr(first), ParameterToIntPtr(count),
SKIP_WRITE_BARRIER);
Goto(&done);
} else {
@ -4080,10 +4082,10 @@ TNode<FixedArrayBase> CodeStubAssembler::ExtractFixedDoubleArrayFillingHoles(
// replacing holes. We signal this to the caller through
// |var_holes_converted|.
*var_holes_converted = Int32TrueConstant();
to_elements = ExtractToFixedArray(from_array, first, count, capacity,
fixed_array_map, kind, allocation_flags,
extract_flags, parameter_mode,
HoleConversionMode::kConvertToUndefined);
to_elements =
ExtractToFixedArray(from_array, first, count, capacity, fixed_array_map,
kind, allocation_flags, extract_flags,
HoleConversionMode::kConvertToUndefined);
var_result = to_elements;
Goto(&done);
}
@ -4152,8 +4154,8 @@ TNode<FixedArrayBase> CodeStubAssembler::ExtractFixedArray(
// PACKED_ELEMENTS is used to signify that the source is a FixedArray.
TNode<FixedArray> to_elements = ExtractToFixedArray(
source, *first, *count, *capacity, source_map, PACKED_ELEMENTS,
allocation_flags, extract_flags, parameter_mode, convert_holes,
var_holes_converted, source_elements_kind);
allocation_flags, extract_flags, convert_holes, var_holes_converted,
source_elements_kind);
var_result = to_elements;
Goto(&done);
}

View File

@ -2108,8 +2108,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
// PACKED/HOLEY_ELEMENTS can be used, but not PACKED_DOUBLE_ELEMENTS.
// * |allocation_flags| and |extract_flags| influence how the target
// FixedArray is allocated.
// * |parameter_mode| determines the parameter mode of |first|, |count| and
// |capacity|.
// * |convert_holes| is used to signify that the target array should use
// undefined in places of holes.
// * If |convert_holes| is true and |var_holes_converted| not nullptr, then
@ -2118,15 +2116,12 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
// compatible with the result array. For example, if the input was of
// HOLEY_SMI_ELEMENTS kind, and a conversion took place, the result will be
// compatible only with HOLEY_ELEMENTS and PACKED_ELEMENTS.
template <typename TIndex>
TNode<FixedArray> ExtractToFixedArray(
SloppyTNode<FixedArrayBase> source, Node* first, Node* count,
Node* capacity, SloppyTNode<Map> source_map,
ElementsKind from_kind = PACKED_ELEMENTS,
AllocationFlags allocation_flags = AllocationFlag::kNone,
ExtractFixedArrayFlags extract_flags =
ExtractFixedArrayFlag::kAllFixedArrays,
ParameterMode parameter_mode = INTPTR_PARAMETERS,
HoleConversionMode convert_holes = HoleConversionMode::kDontConvert,
SloppyTNode<FixedArrayBase> source, TNode<TIndex> first,
TNode<TIndex> count, TNode<TIndex> capacity, TNode<Map> source_map,
ElementsKind from_kind, AllocationFlags allocation_flags,
ExtractFixedArrayFlags extract_flags, HoleConversionMode convert_holes,
TVariable<BoolT>* var_holes_converted = nullptr,
base::Optional<TNode<Int32T>> source_runtime_kind = base::nullopt);