Commit 3008427c authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[csa] Remove ParameterMode from CSA::AllocateJSArray

Bug: v8:9708
Change-Id: If60deb14e8031b121c9e1415dfc9f7308cb251f4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1917144
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64976}
parent d4b6f475
......@@ -507,9 +507,9 @@ class ArrayPopulatorAssembler : public CodeStubAssembler {
TNode<Map> array_map = CAST(LoadContextElement(
context, Context::JS_ARRAY_PACKED_SMI_ELEMENTS_MAP_INDEX));
array =
AllocateJSArray(PACKED_SMI_ELEMENTS, array_map, SmiConstant(0),
SmiConstant(0), {}, ParameterMode::SMI_PARAMETERS);
TNode<IntPtrT> capacity = IntPtrConstant(0);
TNode<Smi> length = SmiConstant(0);
array = AllocateJSArray(PACKED_SMI_ELEMENTS, array_map, capacity, length);
Goto(&done);
}
......@@ -2077,8 +2077,7 @@ void ArrayBuiltinsAssembler::GenerateConstructor(
TNode<JSArray> array = AllocateJSArray(
elements_kind, array_map, array_size_smi, array_size_smi,
mode == DONT_TRACK_ALLOCATION_SITE ? TNode<AllocationSite>()
: CAST(allocation_site),
CodeStubAssembler::SMI_PARAMETERS);
: CAST(allocation_site));
Return(array);
}
}
......
......@@ -1088,9 +1088,8 @@ TNode<JSArray> CollectionsBuiltinsAssembler::MapIteratorToList(
const ElementsKind kind = PACKED_ELEMENTS;
TNode<Map> array_map =
LoadJSArrayElementsMap(kind, LoadNativeContext(context));
TNode<JSArray> array =
AllocateJSArray(kind, array_map, size, SmiTag(size), {},
INTPTR_PARAMETERS, kAllowLargeObjectAllocation);
TNode<JSArray> array = AllocateJSArray(kind, array_map, size, SmiTag(size),
kAllowLargeObjectAllocation);
TNode<FixedArray> elements = CAST(LoadElements(array));
const int first_element_offset = FixedArray::kHeaderSize - kHeapObjectTag;
......@@ -1200,9 +1199,8 @@ TNode<JSArray> CollectionsBuiltinsAssembler::SetOrSetIteratorToList(
const ElementsKind kind = PACKED_ELEMENTS;
TNode<Map> array_map =
LoadJSArrayElementsMap(kind, LoadNativeContext(context));
TNode<JSArray> array =
AllocateJSArray(kind, array_map, size, SmiTag(size), {},
INTPTR_PARAMETERS, kAllowLargeObjectAllocation);
TNode<JSArray> array = AllocateJSArray(kind, array_map, size, SmiTag(size),
kAllowLargeObjectAllocation);
TNode<FixedArray> elements = CAST(LoadElements(array));
const int first_element_offset = FixedArray::kHeaderSize - kHeapObjectTag;
......
......@@ -404,11 +404,12 @@ TNode<JSArray> ConstructorBuiltinsAssembler::EmitCreateEmptyArrayLiteral(
TNode<NativeContext> native_context = LoadNativeContext(context);
Comment("LoadJSArrayElementsMap");
TNode<Map> array_map = LoadJSArrayElementsMap(kind, native_context);
TNode<IntPtrT> zero_intptr = IntPtrConstant(0);
TNode<Smi> zero = SmiConstant(0);
Comment("Allocate JSArray");
TNode<JSArray> result =
AllocateJSArray(GetInitialFastElementsKind(), array_map, zero, zero,
allocation_site.value(), ParameterMode::SMI_PARAMETERS);
AllocateJSArray(GetInitialFastElementsKind(), array_map, zero_intptr,
zero, allocation_site.value());
Goto(&done);
BIND(&done);
......
......@@ -178,7 +178,7 @@ TNode<JSArray> IntlBuiltinsAssembler::AllocateEmptyJSArray(
return CodeStubAssembler::AllocateJSArray(
PACKED_ELEMENTS,
LoadJSArrayElementsMap(PACKED_ELEMENTS, LoadNativeContext(context)),
SmiConstant(0), SmiConstant(0));
IntPtrConstant(0), SmiConstant(0));
}
TF_BUILTIN(ListFormatPrototypeFormat, IntlBuiltinsAssembler) {
......
......@@ -1593,8 +1593,8 @@ TNode<JSArray> RegExpBuiltinsAssembler::RegExpPrototypeSplitBody(
{
TNode<Smi> length = SmiConstant(1);
TNode<IntPtrT> capacity = IntPtrConstant(1);
var_result = AllocateJSArray(kind, array_map, capacity, length,
allocation_site, mode);
var_result =
AllocateJSArray(kind, array_map, capacity, length, allocation_site);
TNode<FixedArray> fixed_array = CAST(LoadElements(var_result.value()));
UnsafeStoreFixedArrayElement(fixed_array, 0, string);
......@@ -1767,8 +1767,8 @@ TNode<JSArray> RegExpBuiltinsAssembler::RegExpPrototypeSplitBody(
{
TNode<Smi> length = SmiZero();
TNode<IntPtrT> capacity = IntPtrZero();
var_result = AllocateJSArray(kind, array_map, capacity, length,
allocation_site, mode);
var_result =
AllocateJSArray(kind, array_map, capacity, length, allocation_site);
Goto(&done);
}
......
......@@ -84,7 +84,7 @@ namespace regexp {
regexp: FastJSRegExp, string: String, replaceFn: Callable): String {
regexp.lastIndex = 0;
const kInitialCapacity: Smi = 16;
const kInitialCapacity: intptr = 16;
const kInitialLength: Smi = 0;
const result: Null|JSArray = RegExpExecMultiple(
regexp, string, GetRegExpLastMatchInfo(),
......
......@@ -4044,12 +4044,12 @@ TNode<JSArray> CodeStubAssembler::AllocateUninitializedJSArray(
}
TNode<JSArray> CodeStubAssembler::AllocateJSArray(
ElementsKind kind, TNode<Map> array_map, Node* capacity, TNode<Smi> length,
TNode<AllocationSite> allocation_site, ParameterMode capacity_mode,
ElementsKind kind, TNode<Map> array_map, TNode<IntPtrT> capacity,
TNode<Smi> length, TNode<AllocationSite> allocation_site,
AllocationFlags allocation_flags) {
CSA_SLOW_ASSERT(this, TaggedIsPositiveSmi(length));
CSA_SLOW_ASSERT(this, MatchesParameterMode(capacity, capacity_mode));
ParameterMode capacity_mode = INTPTR_PARAMETERS;
TNode<JSArray> array;
TNode<FixedArrayBase> elements;
......@@ -4059,8 +4059,7 @@ TNode<JSArray> CodeStubAssembler::AllocateJSArray(
Label out(this), nonempty(this);
Branch(SmiEqual(ParameterToTagged(capacity, capacity_mode), SmiConstant(0)),
&out, &nonempty);
Branch(WordEqual(capacity, IntPtrConstant(0)), &out, &nonempty);
BIND(&nonempty);
{
......@@ -13296,7 +13295,7 @@ TNode<JSArray> CodeStubAssembler::ArrayCreate(TNode<Context> context,
}
BIND(&next);
CSA_ASSERT(this, TaggedIsSmi(length));
TNode<Smi> length_smi = CAST(length);
TNode<Map> array_map = CAST(LoadContextElement(
context, Context::JS_ARRAY_PACKED_SMI_ELEMENTS_MAP_INDEX));
......@@ -13304,8 +13303,8 @@ TNode<JSArray> CodeStubAssembler::ArrayCreate(TNode<Context> context,
// TODO(delphick): Consider using
// AllocateUninitializedJSArrayWithElements to avoid initializing an
// array and then writing over it.
array = AllocateJSArray(PACKED_SMI_ELEMENTS, array_map, length,
SmiConstant(0), {}, ParameterMode::SMI_PARAMETERS);
array = AllocateJSArray(PACKED_SMI_ELEMENTS, array_map, length_smi,
SmiConstant(0));
Goto(&done);
BIND(&done);
......
......@@ -1825,24 +1825,28 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
int array_header_size = JSArray::kSize);
// Allocate a JSArray and fill elements with the hole.
// The ParameterMode argument is only used for the capacity parameter.
TNode<JSArray> AllocateJSArray(
ElementsKind kind, TNode<Map> array_map, Node* capacity,
TNode<Smi> length, TNode<AllocationSite> allocation_site = {},
ParameterMode capacity_mode = INTPTR_PARAMETERS,
AllocationFlags allocation_flags = kNone);
TNode<JSArray> AllocateJSArray(ElementsKind kind, TNode<Map> array_map,
TNode<Smi> capacity, TNode<Smi> length) {
return AllocateJSArray(kind, array_map, capacity, length, {},
SMI_PARAMETERS);
TNode<IntPtrT> capacity, TNode<Smi> length,
TNode<AllocationSite> allocation_site,
AllocationFlags allocation_flags = kNone);
TNode<JSArray> AllocateJSArray(ElementsKind kind, TNode<Map> array_map,
TNode<Smi> capacity, TNode<Smi> length,
TNode<AllocationSite> allocation_site,
AllocationFlags allocation_flags = kNone) {
return AllocateJSArray(kind, array_map, SmiUntag(capacity), length,
allocation_site, allocation_flags);
}
TNode<JSArray> AllocateJSArray(ElementsKind kind, TNode<Map> array_map,
TNode<Smi> capacity, TNode<Smi> length,
AllocationFlags allocation_flags = kNone) {
return AllocateJSArray(kind, array_map, SmiUntag(capacity), length, {},
allocation_flags);
}
TNode<JSArray> AllocateJSArray(ElementsKind kind, TNode<Map> array_map,
TNode<IntPtrT> capacity, TNode<Smi> length,
AllocationFlags allocation_flags = kNone) {
return AllocateJSArray(kind, array_map, capacity, length, {},
INTPTR_PARAMETERS, allocation_flags);
allocation_flags);
}
// Allocate a JSArray and initialize the header fields.
......
......@@ -2537,9 +2537,10 @@ IGNITION_HANDLER(CreateEmptyArrayLiteral, InterpreterAssembler) {
{
TNode<Map> array_map = LoadJSArrayElementsMap(GetInitialFastElementsKind(),
LoadNativeContext(context));
result =
AllocateJSArray(GetInitialFastElementsKind(), array_map, SmiConstant(0),
SmiConstant(0), {}, ParameterMode::SMI_PARAMETERS);
TNode<Smi> length = SmiConstant(0);
TNode<IntPtrT> capacity = IntPtrConstant(0);
result = AllocateJSArray(GetInitialFastElementsKind(), array_map, capacity,
length);
Goto(&end);
}
......
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