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