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