Commit 8e26b122 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[csa] Remove ParameterMode from CSA::Increment/Decrement

Bug: v8:9708
Change-Id: I73cbe14437f596b805084ba61bc669556ac34289
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1798642Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63718}
parent a0809161
...@@ -93,12 +93,12 @@ Node* ArgumentsBuiltinsAssembler::ConstructParametersObjectFromArgs( ...@@ -93,12 +93,12 @@ Node* ArgumentsBuiltinsAssembler::ConstructParametersObjectFromArgs(
AllocateArgumentsObject(map, rest_count, nullptr, param_mode, base_size); AllocateArgumentsObject(map, rest_count, nullptr, param_mode, base_size);
DCHECK_NULL(unused); DCHECK_NULL(unused);
CodeStubArguments arguments(this, arg_count, frame_ptr, param_mode); CodeStubArguments arguments(this, arg_count, frame_ptr, param_mode);
VARIABLE(offset, MachineType::PointerRepresentation()); TVARIABLE(IntPtrT, offset,
offset.Bind(IntPtrConstant(FixedArrayBase::kHeaderSize - kHeapObjectTag)); IntPtrConstant(FixedArrayBase::kHeaderSize - kHeapObjectTag));
VariableList list({&offset}, zone()); VariableList list({&offset}, zone());
arguments.ForEach( arguments.ForEach(
list, list,
[this, elements, &offset](Node* arg) { [&](Node* arg) {
StoreNoWriteBarrier(MachineRepresentation::kTagged, elements, StoreNoWriteBarrier(MachineRepresentation::kTagged, elements,
offset.value(), arg); offset.value(), arg);
Increment(&offset, kTaggedSize); Increment(&offset, kTaggedSize);
...@@ -224,15 +224,15 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewSloppyArguments(Node* context, ...@@ -224,15 +224,15 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewSloppyArguments(Node* context,
{ {
Comment("Mapped parameter JSSloppyArgumentsObject"); Comment("Mapped parameter JSSloppyArgumentsObject");
Node* mapped_count = TNode<BInt> mapped_count =
IntPtrOrSmiMin(info.argument_count, info.formal_parameter_count, mode); IntPtrOrSmiMin(info.argument_count, info.formal_parameter_count);
Node* parameter_map_size = TNode<BInt> parameter_map_size =
IntPtrOrSmiAdd(mapped_count, IntPtrOrSmiConstant(2, mode), mode); IntPtrOrSmiAdd(mapped_count, BIntConstant(2));
// Verify that the overall allocation will fit in new space. // Verify that the overall allocation will fit in new space.
Node* elements_allocated = TNode<BInt> elements_allocated =
IntPtrOrSmiAdd(info.argument_count, parameter_map_size, mode); IntPtrOrSmiAdd(info.argument_count, parameter_map_size);
GotoIfFixedArraySizeDoesntFitInNewSpace( GotoIfFixedArraySizeDoesntFitInNewSpace(
elements_allocated, &runtime, elements_allocated, &runtime,
JSSloppyArgumentsObject::kSize + FixedArray::kHeaderSize * 2, mode); JSSloppyArgumentsObject::kSize + FixedArray::kHeaderSize * 2, mode);
...@@ -259,15 +259,15 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewSloppyArguments(Node* context, ...@@ -259,15 +259,15 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewSloppyArguments(Node* context,
ElementOffsetFromIndex(mapped_count, PACKED_ELEMENTS, mode, ElementOffsetFromIndex(mapped_count, PACKED_ELEMENTS, mode,
FixedArray::kHeaderSize - kHeapObjectTag); FixedArray::kHeaderSize - kHeapObjectTag);
CodeStubArguments arguments(this, info.argument_count, info.frame, mode); CodeStubArguments arguments(this, info.argument_count, info.frame, mode);
VARIABLE(current_argument, MachineType::PointerRepresentation()); TVARIABLE(IntPtrT, current_argument,
current_argument.Bind(arguments.AtIndexPtr(info.argument_count, mode)); Signed(arguments.AtIndexPtr(info.argument_count, mode)));
VariableList var_list1({&current_argument}, zone()); VariableList var_list1({&current_argument}, zone());
mapped_offset = UncheckedCast<IntPtrT>(BuildFastLoop( mapped_offset = UncheckedCast<IntPtrT>(BuildFastLoop(
var_list1, argument_offset, mapped_offset, var_list1, argument_offset, mapped_offset,
[this, elements, &current_argument](Node* offset) { [this, elements, &current_argument](Node* offset) {
Increment(&current_argument, kSystemPointerSize); Increment(&current_argument, kSystemPointerSize);
TNode<Object> arg = LoadBufferObject( TNode<Object> arg = LoadBufferObject(
UncheckedCast<RawPtrT>(current_argument.value()), 0); ReinterpretCast<RawPtrT>(current_argument.value()), 0);
StoreNoWriteBarrier(MachineRepresentation::kTagged, elements, offset, StoreNoWriteBarrier(MachineRepresentation::kTagged, elements, offset,
arg); arg);
}, },
...@@ -282,11 +282,11 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewSloppyArguments(Node* context, ...@@ -282,11 +282,11 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewSloppyArguments(Node* context,
// MIN_CONTEXT_SLOTS+argument_count-mapped_count // MIN_CONTEXT_SLOTS+argument_count-mapped_count
// We loop from right to left. // We loop from right to left.
Comment("Fill in mapped parameters"); Comment("Fill in mapped parameters");
VARIABLE(context_index, OptimalParameterRepresentation()); TVARIABLE(
context_index.Bind(IntPtrOrSmiSub( BInt, context_index,
IntPtrOrSmiAdd(IntPtrOrSmiConstant(Context::MIN_CONTEXT_SLOTS, mode), IntPtrOrSmiSub(IntPtrOrSmiAdd(BIntConstant(Context::MIN_CONTEXT_SLOTS),
info.formal_parameter_count, mode), info.formal_parameter_count),
mapped_count, mode)); mapped_count));
TNode<Oddball> the_hole = TheHoleConstant(); TNode<Oddball> the_hole = TheHoleConstant();
VariableList var_list2({&context_index}, zone()); VariableList var_list2({&context_index}, zone());
const int kParameterMapHeaderSize = FixedArray::OffsetOfElementAt(2); const int kParameterMapHeaderSize = FixedArray::OffsetOfElementAt(2);
...@@ -302,8 +302,8 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewSloppyArguments(Node* context, ...@@ -302,8 +302,8 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewSloppyArguments(Node* context,
the_hole); the_hole);
StoreNoWriteBarrier(MachineRepresentation::kTagged, StoreNoWriteBarrier(MachineRepresentation::kTagged,
adjusted_map_array, offset, adjusted_map_array, offset,
ParameterToTagged(context_index.value(), mode)); BIntToSmi(context_index.value()));
Increment(&context_index, 1, mode); Increment(&context_index);
}, },
-kTaggedSize, INTPTR_PARAMETERS); -kTaggedSize, INTPTR_PARAMETERS);
......
...@@ -1339,8 +1339,8 @@ TF_BUILTIN(OrderedHashTableHealIndex, CollectionsBuiltinsAssembler) { ...@@ -1339,8 +1339,8 @@ TF_BUILTIN(OrderedHashTableHealIndex, CollectionsBuiltinsAssembler) {
IntPtrConstant(OrderedHashMap::kClearedTableSentinel)), IntPtrConstant(OrderedHashMap::kClearedTableSentinel)),
&return_zero); &return_zero);
VARIABLE(var_i, MachineType::PointerRepresentation(), IntPtrConstant(0)); TVARIABLE(IntPtrT, var_i, IntPtrConstant(0));
VARIABLE(var_index, MachineRepresentation::kTagged, index); TVARIABLE(Smi, var_index, index);
Label loop(this, {&var_i, &var_index}); Label loop(this, {&var_i, &var_index});
Goto(&loop); Goto(&loop);
BIND(&loop); BIND(&loop);
...@@ -1352,7 +1352,7 @@ TF_BUILTIN(OrderedHashTableHealIndex, CollectionsBuiltinsAssembler) { ...@@ -1352,7 +1352,7 @@ TF_BUILTIN(OrderedHashTableHealIndex, CollectionsBuiltinsAssembler) {
TNode<Smi> removed_index = CAST(LoadFixedArrayElement( TNode<Smi> removed_index = CAST(LoadFixedArrayElement(
CAST(table), i, OrderedHashMap::RemovedHolesIndex() * kTaggedSize)); CAST(table), i, OrderedHashMap::RemovedHolesIndex() * kTaggedSize));
GotoIf(SmiGreaterThanOrEqual(removed_index, index), &return_index); GotoIf(SmiGreaterThanOrEqual(removed_index, index), &return_index);
Decrement(&var_index, 1, SMI_PARAMETERS); Decrement(&var_index);
Increment(&var_i); Increment(&var_i);
Goto(&loop); Goto(&loop);
} }
......
...@@ -124,12 +124,11 @@ TF_BUILTIN(FastFunctionPrototypeBind, CodeStubAssembler) { ...@@ -124,12 +124,11 @@ TF_BUILTIN(FastFunctionPrototypeBind, CodeStubAssembler) {
Signed(ChangeUint32ToWord(Unsigned(Int32Sub(argc, Int32Constant(1))))); Signed(ChangeUint32ToWord(Unsigned(Int32Sub(argc, Int32Constant(1)))));
TNode<FixedArray> elements = CAST(AllocateFixedArray( TNode<FixedArray> elements = CAST(AllocateFixedArray(
PACKED_ELEMENTS, elements_length, kAllowLargeObjectAllocation)); PACKED_ELEMENTS, elements_length, kAllowLargeObjectAllocation));
VARIABLE(index, MachineType::PointerRepresentation()); TVARIABLE(IntPtrT, index, IntPtrConstant(0));
index.Bind(IntPtrConstant(0));
VariableList foreach_vars({&index}, zone()); VariableList foreach_vars({&index}, zone());
args.ForEach( args.ForEach(
foreach_vars, foreach_vars,
[this, elements, &index](Node* arg) { [&](Node* arg) {
StoreFixedArrayElement(elements, index.value(), arg); StoreFixedArrayElement(elements, index.value(), arg);
Increment(&index); Increment(&index);
}, },
......
...@@ -62,8 +62,7 @@ TF_BUILTIN(StringToLowerCaseIntl, IntlBuiltinsAssembler) { ...@@ -62,8 +62,7 @@ TF_BUILTIN(StringToLowerCaseIntl, IntlBuiltinsAssembler) {
{ {
Node* const dst_ptr = PointerToSeqStringData(dst); Node* const dst_ptr = PointerToSeqStringData(dst);
VARIABLE(var_cursor, MachineType::PointerRepresentation(), TVARIABLE(IntPtrT, var_cursor, IntPtrConstant(0));
IntPtrConstant(0));
TNode<RawPtrT> const start_address = to_direct.PointerToData(&call_c); TNode<RawPtrT> const start_address = to_direct.PointerToData(&call_c);
TNode<IntPtrT> const end_address = TNode<IntPtrT> const end_address =
......
...@@ -321,12 +321,12 @@ TNode<JSArray> ObjectEntriesValuesBuiltinsAssembler::FastGetOwnValuesOrEntries( ...@@ -321,12 +321,12 @@ TNode<JSArray> ObjectEntriesValuesBuiltinsAssembler::FastGetOwnValuesOrEntries(
StoreFixedArrayElement(values_or_entries, var_result_index.value(), StoreFixedArrayElement(values_or_entries, var_result_index.value(),
value); value);
Increment(&var_result_index, 1); Increment(&var_result_index);
Goto(&next_descriptor); Goto(&next_descriptor);
BIND(&next_descriptor); BIND(&next_descriptor);
{ {
Increment(&var_descriptor_number, 1); Increment(&var_descriptor_number);
Branch(IntPtrEqual(var_result_index.value(), object_enum_length), Branch(IntPtrEqual(var_result_index.value(), object_enum_length),
&after_loop, &loop); &after_loop, &loop);
} }
......
...@@ -3154,8 +3154,7 @@ TNode<Smi> CodeStubAssembler::BuildAppendJSArray(ElementsKind kind, ...@@ -3154,8 +3154,7 @@ TNode<Smi> CodeStubAssembler::BuildAppendJSArray(ElementsKind kind,
Label success(this); Label success(this);
TVARIABLE(Smi, var_tagged_length); TVARIABLE(Smi, var_tagged_length);
ParameterMode mode = OptimalParameterMode(); ParameterMode mode = OptimalParameterMode();
VARIABLE(var_length, OptimalParameterRepresentation(), TVARIABLE(BInt, var_length, SmiToBInt(LoadFastJSArrayLength(array)));
TaggedToParameter(LoadFastJSArrayLength(array), mode));
VARIABLE(var_elements, MachineRepresentation::kTagged, LoadElements(array)); VARIABLE(var_elements, MachineRepresentation::kTagged, LoadElements(array));
// Resize the capacity of the fixed array if it doesn't fit. // Resize the capacity of the fixed array if it doesn't fit.
...@@ -3173,14 +3172,14 @@ TNode<Smi> CodeStubAssembler::BuildAppendJSArray(ElementsKind kind, ...@@ -3173,14 +3172,14 @@ TNode<Smi> CodeStubAssembler::BuildAppendJSArray(ElementsKind kind,
Node* elements = var_elements.value(); Node* elements = var_elements.value();
args->ForEach( args->ForEach(
push_vars, push_vars,
[this, kind, mode, elements, &var_length, &pre_bailout](Node* arg) { [=, &var_length, &pre_bailout](Node* arg) {
TryStoreArrayElement(kind, mode, &pre_bailout, elements, TryStoreArrayElement(kind, mode, &pre_bailout, elements,
var_length.value(), arg); var_length.value(), arg);
Increment(&var_length, 1, mode); Increment(&var_length);
}, },
first, nullptr); first, nullptr);
{ {
TNode<Smi> length = ParameterToTagged(var_length.value(), mode); TNode<Smi> length = BIntToSmi(var_length.value());
var_tagged_length = length; var_tagged_length = length;
StoreObjectFieldNoWriteBarrier(array, JSArray::kLengthOffset, length); StoreObjectFieldNoWriteBarrier(array, JSArray::kLengthOffset, length);
Goto(&success); Goto(&success);
...@@ -3220,8 +3219,7 @@ void CodeStubAssembler::BuildAppendJSArray(ElementsKind kind, Node* array, ...@@ -3220,8 +3219,7 @@ void CodeStubAssembler::BuildAppendJSArray(ElementsKind kind, Node* array,
CSA_SLOW_ASSERT(this, IsJSArray(array)); CSA_SLOW_ASSERT(this, IsJSArray(array));
Comment("BuildAppendJSArray: ", ElementsKindToString(kind)); Comment("BuildAppendJSArray: ", ElementsKindToString(kind));
ParameterMode mode = OptimalParameterMode(); ParameterMode mode = OptimalParameterMode();
VARIABLE(var_length, OptimalParameterRepresentation(), TVARIABLE(BInt, var_length, SmiToBInt(LoadFastJSArrayLength(array)));
TaggedToParameter(LoadFastJSArrayLength(array), mode));
VARIABLE(var_elements, MachineRepresentation::kTagged, LoadElements(array)); VARIABLE(var_elements, MachineRepresentation::kTagged, LoadElements(array));
// Resize the capacity of the fixed array if it doesn't fit. // Resize the capacity of the fixed array if it doesn't fit.
...@@ -3233,9 +3231,9 @@ void CodeStubAssembler::BuildAppendJSArray(ElementsKind kind, Node* array, ...@@ -3233,9 +3231,9 @@ void CodeStubAssembler::BuildAppendJSArray(ElementsKind kind, Node* array,
// capacity. // capacity.
TryStoreArrayElement(kind, mode, bailout, var_elements.value(), TryStoreArrayElement(kind, mode, bailout, var_elements.value(),
var_length.value(), value); var_length.value(), value);
Increment(&var_length, 1, mode); Increment(&var_length);
TNode<Smi> length = ParameterToTagged(var_length.value(), mode); TNode<Smi> length = BIntToSmi(var_length.value());
StoreObjectFieldNoWriteBarrier(array, JSArray::kLengthOffset, length); StoreObjectFieldNoWriteBarrier(array, JSArray::kLengthOffset, length);
} }
...@@ -5428,7 +5426,7 @@ void CodeStubAssembler::CopyStringCharacters(Node* from_string, Node* to_string, ...@@ -5428,7 +5426,7 @@ void CodeStubAssembler::CopyStringCharacters(Node* from_string, Node* to_string,
int from_increment = 1 << ElementsKindToShiftSize(from_kind); int from_increment = 1 << ElementsKindToShiftSize(from_kind);
int to_increment = 1 << ElementsKindToShiftSize(to_kind); int to_increment = 1 << ElementsKindToShiftSize(to_kind);
VARIABLE(current_to_offset, MachineType::PointerRepresentation(), to_offset); TVARIABLE(IntPtrT, current_to_offset, to_offset);
VariableList vars({&current_to_offset}, zone()); VariableList vars({&current_to_offset}, zone());
int to_index_constant = 0, from_index_constant = 0; int to_index_constant = 0, from_index_constant = 0;
bool index_same = (from_encoding == to_encoding) && bool index_same = (from_encoding == to_encoding) &&
...@@ -5438,8 +5436,7 @@ void CodeStubAssembler::CopyStringCharacters(Node* from_string, Node* to_string, ...@@ -5438,8 +5436,7 @@ void CodeStubAssembler::CopyStringCharacters(Node* from_string, Node* to_string,
from_index_constant == to_index_constant)); from_index_constant == to_index_constant));
BuildFastLoop( BuildFastLoop(
vars, from_offset, limit_offset, vars, from_offset, limit_offset,
[this, from_string, to_string, &current_to_offset, to_increment, type, [=, &current_to_offset](Node* offset) {
rep, index_same](Node* offset) {
Node* value = Load(type, from_string, offset); Node* value = Load(type, from_string, offset);
StoreNoWriteBarrier(rep, to_string, StoreNoWriteBarrier(rep, to_string,
index_same ? offset : current_to_offset.value(), index_same ? offset : current_to_offset.value(),
...@@ -9302,8 +9299,7 @@ void CodeStubAssembler::ForEachEnumerableOwnProperty( ...@@ -9302,8 +9299,7 @@ void CodeStubAssembler::ForEachEnumerableOwnProperty(
var_is_symbol_processing_loop = Int32TrueConstant(); var_is_symbol_processing_loop = Int32TrueConstant();
// Add DescriptorArray::kEntrySize to make the var_end_key_index exclusive // Add DescriptorArray::kEntrySize to make the var_end_key_index exclusive
// as BuildFastLoop() expects. // as BuildFastLoop() expects.
Increment(&var_end_key_index, DescriptorArray::kEntrySize, Increment(&var_end_key_index, DescriptorArray::kEntrySize);
INTPTR_PARAMETERS);
Goto(&descriptor_array_loop); Goto(&descriptor_array_loop);
BIND(&done); BIND(&done);
......
...@@ -2835,23 +2835,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ...@@ -2835,23 +2835,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
Increment(variable, -value); Increment(variable, -value);
} }
// TODO(v8:9708): remove once all uses are ported.
void Increment(Variable* variable, int value = 1,
ParameterMode mode = INTPTR_PARAMETERS) {
if (mode == SMI_PARAMETERS) {
return Increment(static_cast<TVariable<Smi>*>(variable), value);
} else {
DCHECK(mode == INTPTR_PARAMETERS);
return Increment(static_cast<TVariable<IntPtrT>*>(variable), value);
}
}
// TODO(v8:9708): remove once all uses are ported.
void Decrement(Variable* variable, int value = 1,
ParameterMode mode = INTPTR_PARAMETERS) {
Increment(variable, -value, mode);
}
// Generates "if (false) goto label" code. Useful for marking a label as // Generates "if (false) goto label" code. Useful for marking a label as
// "live" to avoid assertion failures during graph building. In the resulting // "live" to avoid assertion failures during graph building. In the resulting
// code this check will be eliminated. // code this check will be eliminated.
......
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