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