Commit 5dedee92 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[csa][cleanup] Remove ParameterMode/TNodify LoadFixedDoubleArrayElement

Cleanups:
 * Additional offset was always 0 so it can be removed
 * Reordered arguements to take advantage of the implicit arguments

Bug: v8:9708, v8:6949
Change-Id: I2168b80013958ab5b017280422fbfc9c7a137dcb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2349304Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69380}
parent 6da744d0
......@@ -936,8 +936,8 @@ void ArrayIncludesIndexofAssembler::GeneratePackedDoubles(
Label continue_loop(this);
GotoIfNot(UintPtrLessThan(index_var.value(), array_length_untagged),
&return_not_found);
TNode<Float64T> element_k = LoadFixedDoubleArrayElement(
elements, index_var.value(), MachineType::Float64());
TNode<Float64T> element_k =
LoadFixedDoubleArrayElement(elements, index_var.value());
Branch(Float64Equal(element_k, search_num.value()), &return_found,
&continue_loop);
BIND(&continue_loop);
......@@ -951,8 +951,8 @@ void ArrayIncludesIndexofAssembler::GeneratePackedDoubles(
Label continue_loop(this);
GotoIfNot(UintPtrLessThan(index_var.value(), array_length_untagged),
&return_not_found);
TNode<Float64T> element_k = LoadFixedDoubleArrayElement(
elements, index_var.value(), MachineType::Float64());
TNode<Float64T> element_k =
LoadFixedDoubleArrayElement(elements, index_var.value());
BranchIfFloat64IsNaN(element_k, &return_found, &continue_loop);
BIND(&continue_loop);
Increment(&index_var);
......@@ -1010,8 +1010,8 @@ void ArrayIncludesIndexofAssembler::GenerateHoleyDoubles(
// No need for hole checking here; the following Float64Equal will
// return 'not equal' for holes anyway.
TNode<Float64T> element_k = LoadFixedDoubleArrayElement(
elements, index_var.value(), MachineType::Float64());
TNode<Float64T> element_k =
LoadFixedDoubleArrayElement(elements, index_var.value());
Branch(Float64Equal(element_k, search_num.value()), &return_found,
&continue_loop);
......@@ -1029,8 +1029,7 @@ void ArrayIncludesIndexofAssembler::GenerateHoleyDoubles(
// Load double value or continue if it's the hole NaN.
TNode<Float64T> element_k = LoadFixedDoubleArrayElement(
elements, index_var.value(), MachineType::Float64(), 0,
INTPTR_PARAMETERS, &continue_loop);
elements, index_var.value(), &continue_loop);
BranchIfFloat64IsNaN(element_k, &return_found, &continue_loop);
BIND(&continue_loop);
......@@ -1045,9 +1044,8 @@ void ArrayIncludesIndexofAssembler::GenerateHoleyDoubles(
&return_not_found);
// Check if the element is a double hole, but don't load it.
LoadFixedDoubleArrayElement(elements, index_var.value(),
MachineType::None(), 0, INTPTR_PARAMETERS,
&return_found);
LoadFixedDoubleArrayElement(elements, index_var.value(), &return_found,
MachineType::None());
Increment(&index_var);
Goto(&hole_loop);
......
......@@ -567,8 +567,7 @@ TNode<Object> BaseCollectionsAssembler::LoadAndNormalizeFixedDoubleArrayElement(
TVARIABLE(Object, entry);
Label if_hole(this, Label::kDeferred), next(this);
TNode<Float64T> element =
LoadFixedDoubleArrayElement(CAST(elements), index, MachineType::Float64(),
0, INTPTR_PARAMETERS, &if_hole);
LoadFixedDoubleArrayElement(CAST(elements), index, &if_hole);
{ // not hole
entry = AllocateHeapNumberWithValue(element);
Goto(&next);
......
......@@ -1067,16 +1067,9 @@ void CodeStubAssembler::Bind(Label* label, AssemblerDebugInfo debug_info) {
void CodeStubAssembler::Bind(Label* label) { CodeAssembler::Bind(label); }
TNode<Float64T> CodeStubAssembler::LoadDoubleWithHoleCheck(
TNode<FixedDoubleArray> array, TNode<Smi> index, Label* if_hole) {
return LoadFixedDoubleArrayElement(array, index, MachineType::Float64(), 0,
SMI_PARAMETERS, if_hole);
}
TNode<Float64T> CodeStubAssembler::LoadDoubleWithHoleCheck(
TNode<FixedDoubleArray> array, TNode<IntPtrT> index, Label* if_hole) {
return LoadFixedDoubleArrayElement(array, index, MachineType::Float64(), 0,
INTPTR_PARAMETERS, if_hole);
return LoadFixedDoubleArrayElement(array, index, if_hole);
}
void CodeStubAssembler::BranchIfJSReceiver(SloppyTNode<Object> object,
......@@ -2407,16 +2400,11 @@ TNode<MaybeObject> CodeStubAssembler::LoadWeakFixedArrayElement(
}
TNode<Float64T> CodeStubAssembler::LoadFixedDoubleArrayElement(
SloppyTNode<FixedDoubleArray> object, Node* index_node,
MachineType machine_type, int additional_offset,
ParameterMode parameter_mode, Label* if_hole) {
CSA_ASSERT(this, IsFixedDoubleArray(object));
DCHECK(IsAligned(additional_offset, kTaggedSize));
CSA_SLOW_ASSERT(this, MatchesParameterMode(index_node, parameter_mode));
int32_t header_size =
FixedDoubleArray::kHeaderSize + additional_offset - kHeapObjectTag;
TNode<IntPtrT> offset = ElementOffsetFromIndex(
index_node, HOLEY_DOUBLE_ELEMENTS, parameter_mode, header_size);
TNode<FixedDoubleArray> object, TNode<IntPtrT> index, Label* if_hole,
MachineType machine_type) {
int32_t header_size = FixedDoubleArray::kHeaderSize - kHeapObjectTag;
TNode<IntPtrT> offset =
ElementOffsetFromIndex(index, HOLEY_DOUBLE_ELEMENTS, header_size);
CSA_ASSERT(this, IsOffsetInBounds(
offset, LoadAndUntagFixedArrayBaseLength(object),
FixedDoubleArray::kHeaderSize, HOLEY_DOUBLE_ELEMENTS));
......@@ -2465,16 +2453,15 @@ TNode<Object> CodeStubAssembler::LoadFixedArrayBaseElementAsTagged(
BIND(&if_packed_double);
{
var_result = AllocateHeapNumberWithValue(LoadFixedDoubleArrayElement(
CAST(elements), index, MachineType::Float64()));
var_result = AllocateHeapNumberWithValue(
LoadFixedDoubleArrayElement(CAST(elements), index));
Goto(&done);
}
BIND(&if_holey_double);
{
var_result = AllocateHeapNumberWithValue(LoadFixedDoubleArrayElement(
CAST(elements), index, MachineType::Float64(), 0, INTPTR_PARAMETERS,
if_hole));
var_result = AllocateHeapNumberWithValue(
LoadFixedDoubleArrayElement(CAST(elements), index, if_hole));
Goto(&done);
}
......@@ -2506,7 +2493,7 @@ TNode<BoolT> CodeStubAssembler::IsDoubleHole(TNode<Object> base,
}
TNode<Float64T> CodeStubAssembler::LoadDoubleWithHoleCheck(
SloppyTNode<Object> base, SloppyTNode<IntPtrT> offset, Label* if_hole,
TNode<Object> base, TNode<IntPtrT> offset, Label* if_hole,
MachineType machine_type) {
if (if_hole) {
GotoIf(IsDoubleHole(base, offset), if_hole);
......@@ -8828,9 +8815,8 @@ void CodeStubAssembler::TryLookupElement(
GotoIfNot(UintPtrLessThan(intptr_index, length), &if_oob);
// Check if the element is a double hole, but don't load it.
LoadFixedDoubleArrayElement(CAST(elements), intptr_index,
MachineType::None(), 0, INTPTR_PARAMETERS,
if_not_found);
LoadFixedDoubleArrayElement(CAST(elements), intptr_index, if_not_found,
MachineType::None());
Goto(if_found);
}
BIND(&if_isdictionary);
......
......@@ -1384,24 +1384,9 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
// Load an array element from a FixedDoubleArray.
TNode<Float64T> LoadFixedDoubleArrayElement(
SloppyTNode<FixedDoubleArray> object, Node* index,
MachineType machine_type, int additional_offset = 0,
ParameterMode parameter_mode = INTPTR_PARAMETERS,
Label* if_hole = nullptr);
TNode<Float64T> LoadFixedDoubleArrayElement(TNode<FixedDoubleArray> object,
TNode<Smi> index,
Label* if_hole = nullptr) {
return LoadFixedDoubleArrayElement(object, index, MachineType::Float64(), 0,
SMI_PARAMETERS, if_hole);
}
TNode<Float64T> LoadFixedDoubleArrayElement(TNode<FixedDoubleArray> object,
TNode<IntPtrT> index,
Label* if_hole = nullptr) {
return LoadFixedDoubleArrayElement(object, index, MachineType::Float64(), 0,
INTPTR_PARAMETERS, if_hole);
}
TNode<FixedDoubleArray> object, TNode<IntPtrT> index,
Label* if_hole = nullptr,
MachineType machine_type = MachineType::Float64());
// Load an array element from a FixedArray, FixedDoubleArray or a
// NumberDictionary (depending on the |elements_kind|) and return
......@@ -1420,24 +1405,16 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
int additional_offset = 0);
TNode<IntPtrT> LoadFeedbackVectorLength(TNode<FeedbackVector>);
TNode<Float64T> LoadDoubleWithHoleCheck(TNode<FixedDoubleArray> array,
TNode<Smi> index,
Label* if_hole = nullptr);
TNode<Float64T> LoadDoubleWithHoleCheck(TNode<FixedDoubleArray> array,
TNode<IntPtrT> index,
Label* if_hole = nullptr);
TNode<Float64T> LoadDoubleWithHoleCheck(TNode<FixedDoubleArray> array,
TNode<UintPtrT> index,
Label* if_hole = nullptr) {
return LoadDoubleWithHoleCheck(array, Signed(index), if_hole);
}
TNode<BoolT> IsDoubleHole(TNode<Object> base, TNode<IntPtrT> offset);
// Load Float64 value by |base| + |offset| address. If the value is a double
// hole then jump to |if_hole|. If |machine_type| is None then only the hole
// check is generated.
TNode<Float64T> LoadDoubleWithHoleCheck(
SloppyTNode<Object> base, SloppyTNode<IntPtrT> offset, Label* if_hole,
TNode<Object> base, TNode<IntPtrT> offset, Label* if_hole,
MachineType machine_type = MachineType::Float64());
TNode<Numeric> LoadFixedTypedArrayElementAsTagged(TNode<RawPtrT> data_pointer,
TNode<UintPtrT> index,
......
......@@ -2094,8 +2094,8 @@ void AccessorAssembler::EmitElementLoad(
if (access_mode == LoadAccessMode::kHas) {
exit_point->Return(TrueConstant());
} else {
*var_double_value = LoadFixedDoubleArrayElement(
CAST(elements), intptr_index, MachineType::Float64());
*var_double_value =
LoadFixedDoubleArrayElement(CAST(elements), intptr_index);
Goto(rebox_double);
}
}
......@@ -2103,9 +2103,8 @@ void AccessorAssembler::EmitElementLoad(
BIND(&if_fast_holey_double);
{
Comment("holey double elements");
TNode<Float64T> value = LoadFixedDoubleArrayElement(
CAST(elements), intptr_index, MachineType::Float64(), 0,
INTPTR_PARAMETERS, if_hole);
TNode<Float64T> value =
LoadFixedDoubleArrayElement(CAST(elements), intptr_index, if_hole);
if (access_mode == LoadAccessMode::kHas) {
exit_point->Return(TrueConstant());
} else {
......
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