Commit 1c3085e2 authored by Toon Verwaest's avatar Toon Verwaest Committed by V8 LUCI CQ

[cleanup] Resolve -Wshadow warnings in code-stub-assembler.h

By changing AllocationFlag from enum to enum class

Bug: v8:12244, v8:12245
Change-Id: Ifdd04bb12026619f6422a98ee0890bd557f0e4e1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3181536
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Auto-Submit: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77188}
parent 749e41d4
...@@ -97,7 +97,7 @@ TF_BUILTIN(AsyncFunctionEnter, AsyncFunctionBuiltinsAssembler) { ...@@ -97,7 +97,7 @@ TF_BUILTIN(AsyncFunctionEnter, AsyncFunctionBuiltinsAssembler) {
// Allocate and initialize the register file. // Allocate and initialize the register file.
TNode<FixedArrayBase> parameters_and_registers = TNode<FixedArrayBase> parameters_and_registers =
AllocateFixedArray(HOLEY_ELEMENTS, parameters_and_register_length, AllocateFixedArray(HOLEY_ELEMENTS, parameters_and_register_length,
kAllowLargeObjectAllocation); AllocationFlag::kAllowLargeObjectAllocation);
FillFixedArrayWithValue(HOLEY_ELEMENTS, parameters_and_registers, FillFixedArrayWithValue(HOLEY_ELEMENTS, parameters_and_registers,
IntPtrConstant(0), parameters_and_register_length, IntPtrConstant(0), parameters_and_register_length,
RootIndex::kUndefinedValue); RootIndex::kUndefinedValue);
......
...@@ -334,7 +334,7 @@ void CallOrConstructBuiltinsAssembler::CallOrConstructDoubleVarargs( ...@@ -334,7 +334,7 @@ void CallOrConstructBuiltinsAssembler::CallOrConstructDoubleVarargs(
// Allocate a new FixedArray of Objects. // Allocate a new FixedArray of Objects.
TNode<FixedArray> new_elements = CAST(AllocateFixedArray( TNode<FixedArray> new_elements = CAST(AllocateFixedArray(
new_kind, intptr_length, CodeStubAssembler::kAllowLargeObjectAllocation)); new_kind, intptr_length, AllocationFlag::kAllowLargeObjectAllocation));
// CopyFixedArrayElements does not distinguish between holey and packed for // CopyFixedArrayElements does not distinguish between holey and packed for
// its first argument, so we don't need to dispatch on {kind} here. // its first argument, so we don't need to dispatch on {kind} here.
CopyFixedArrayElements(PACKED_DOUBLE_ELEMENTS, elements, new_kind, CopyFixedArrayElements(PACKED_DOUBLE_ELEMENTS, elements, new_kind,
......
...@@ -1089,8 +1089,9 @@ TNode<JSArray> CollectionsBuiltinsAssembler::MapIteratorToList( ...@@ -1089,8 +1089,9 @@ 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 = AllocateJSArray(kind, array_map, size, SmiTag(size), TNode<JSArray> array =
kAllowLargeObjectAllocation); AllocateJSArray(kind, array_map, size, SmiTag(size),
AllocationFlag::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,8 +1201,9 @@ TNode<JSArray> CollectionsBuiltinsAssembler::SetOrSetIteratorToList( ...@@ -1200,8 +1201,9 @@ 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 = AllocateJSArray(kind, array_map, size, SmiTag(size), TNode<JSArray> array =
kAllowLargeObjectAllocation); AllocateJSArray(kind, array_map, size, SmiTag(size),
AllocationFlag::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;
...@@ -2502,8 +2504,8 @@ TNode<HeapObject> WeakCollectionsBuiltinsAssembler::AllocateTable( ...@@ -2502,8 +2504,8 @@ TNode<HeapObject> WeakCollectionsBuiltinsAssembler::AllocateTable(
// See HashTable::NewInternal(). // See HashTable::NewInternal().
TNode<IntPtrT> length = KeyIndexFromEntry(capacity); TNode<IntPtrT> length = KeyIndexFromEntry(capacity);
TNode<FixedArray> table = CAST( TNode<FixedArray> table = CAST(AllocateFixedArray(
AllocateFixedArray(HOLEY_ELEMENTS, length, kAllowLargeObjectAllocation)); HOLEY_ELEMENTS, length, AllocationFlag::kAllowLargeObjectAllocation));
TNode<Map> map = TNode<Map> map =
HeapConstant(EphemeronHashTable::GetMap(ReadOnlyRoots(isolate()))); HeapConstant(EphemeronHashTable::GetMap(ReadOnlyRoots(isolate())));
......
...@@ -338,7 +338,7 @@ TNode<JSObject> ConstructorBuiltinsAssembler::FastNewObject( ...@@ -338,7 +338,7 @@ TNode<JSObject> ConstructorBuiltinsAssembler::FastNewObject(
BIND(&instantiate_map); BIND(&instantiate_map);
return AllocateJSObjectFromMap(initial_map, properties.value(), base::nullopt, return AllocateJSObjectFromMap(initial_map, properties.value(), base::nullopt,
kNone, kWithSlackTracking); AllocationFlag::kNone, kWithSlackTracking);
} }
TNode<Context> ConstructorBuiltinsAssembler::FastNewFunctionContext( TNode<Context> ConstructorBuiltinsAssembler::FastNewFunctionContext(
......
...@@ -249,8 +249,9 @@ TNode<JSArray> ObjectEntriesValuesBuiltinsAssembler::FastGetOwnValuesOrEntries( ...@@ -249,8 +249,9 @@ TNode<JSArray> ObjectEntriesValuesBuiltinsAssembler::FastGetOwnValuesOrEntries(
BIND(&if_has_enum_cache); BIND(&if_has_enum_cache);
{ {
GotoIf(WordEqual(object_enum_length, IntPtrConstant(0)), if_no_properties); GotoIf(WordEqual(object_enum_length, IntPtrConstant(0)), if_no_properties);
TNode<FixedArray> values_or_entries = CAST(AllocateFixedArray( TNode<FixedArray> values_or_entries =
PACKED_ELEMENTS, object_enum_length, kAllowLargeObjectAllocation)); CAST(AllocateFixedArray(PACKED_ELEMENTS, object_enum_length,
AllocationFlag::kAllowLargeObjectAllocation));
// If in case we have enum_cache, // If in case we have enum_cache,
// we can't detect accessor of object until loop through descriptors. // we can't detect accessor of object until loop through descriptors.
...@@ -1252,13 +1253,14 @@ TF_BUILTIN(CreateGeneratorObject, ObjectBuiltinsAssembler) { ...@@ -1252,13 +1253,14 @@ TF_BUILTIN(CreateGeneratorObject, ObjectBuiltinsAssembler) {
TNode<IntPtrT> size = TNode<IntPtrT> size =
IntPtrAdd(WordSar(frame_size, IntPtrConstant(kTaggedSizeLog2)), IntPtrAdd(WordSar(frame_size, IntPtrConstant(kTaggedSizeLog2)),
formal_parameter_count); formal_parameter_count);
TNode<FixedArrayBase> parameters_and_registers = TNode<FixedArrayBase> parameters_and_registers = AllocateFixedArray(
AllocateFixedArray(HOLEY_ELEMENTS, size, kAllowLargeObjectAllocation); HOLEY_ELEMENTS, size, AllocationFlag::kAllowLargeObjectAllocation);
FillFixedArrayWithValue(HOLEY_ELEMENTS, parameters_and_registers, FillFixedArrayWithValue(HOLEY_ELEMENTS, parameters_and_registers,
IntPtrConstant(0), size, RootIndex::kUndefinedValue); IntPtrConstant(0), size, RootIndex::kUndefinedValue);
// TODO(cbruni): support start_offset to avoid double initialization. // TODO(cbruni): support start_offset to avoid double initialization.
TNode<JSObject> result = AllocateJSObjectFromMap( TNode<JSObject> result =
map, base::nullopt, base::nullopt, kNone, kWithSlackTracking); AllocateJSObjectFromMap(map, base::nullopt, base::nullopt,
AllocationFlag::kNone, kWithSlackTracking);
StoreObjectFieldNoWriteBarrier(result, JSGeneratorObject::kFunctionOffset, StoreObjectFieldNoWriteBarrier(result, JSGeneratorObject::kFunctionOffset,
closure); closure);
StoreObjectFieldNoWriteBarrier(result, JSGeneratorObject::kContextOffset, StoreObjectFieldNoWriteBarrier(result, JSGeneratorObject::kContextOffset,
......
...@@ -112,7 +112,7 @@ TNode<JSRegExpResult> RegExpBuiltinsAssembler::AllocateRegExpResult( ...@@ -112,7 +112,7 @@ TNode<JSRegExpResult> RegExpBuiltinsAssembler::AllocateRegExpResult(
std::tie(var_array, var_elements) = std::tie(var_array, var_elements) =
AllocateUninitializedJSArrayWithElements( AllocateUninitializedJSArrayWithElements(
elements_kind, map, length, no_gc_site, length_intptr, elements_kind, map, length, no_gc_site, length_intptr,
kAllowLargeObjectAllocation, JSRegExpResult::kSize); AllocationFlag::kAllowLargeObjectAllocation, JSRegExpResult::kSize);
Goto(&allocated); Goto(&allocated);
} }
...@@ -124,7 +124,8 @@ TNode<JSRegExpResult> RegExpBuiltinsAssembler::AllocateRegExpResult( ...@@ -124,7 +124,8 @@ TNode<JSRegExpResult> RegExpBuiltinsAssembler::AllocateRegExpResult(
std::tie(var_array, var_elements) = std::tie(var_array, var_elements) =
AllocateUninitializedJSArrayWithElements( AllocateUninitializedJSArrayWithElements(
elements_kind, map, length, no_gc_site, length_intptr, elements_kind, map, length, no_gc_site, length_intptr,
kAllowLargeObjectAllocation, JSRegExpResultWithIndices::kSize); AllocationFlag::kAllowLargeObjectAllocation,
JSRegExpResultWithIndices::kSize);
Goto(&allocated); Goto(&allocated);
} }
...@@ -329,8 +330,8 @@ TNode<JSRegExpResult> RegExpBuiltinsAssembler::ConstructNewResultFromMatchInfo( ...@@ -329,8 +330,8 @@ TNode<JSRegExpResult> RegExpBuiltinsAssembler::ConstructNewResultFromMatchInfo(
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) { if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
properties = AllocateSwissNameDictionary(num_properties); properties = AllocateSwissNameDictionary(num_properties);
} else { } else {
properties = properties = AllocateNameDictionary(
AllocateNameDictionary(num_properties, kAllowLargeObjectAllocation); num_properties, AllocationFlag::kAllowLargeObjectAllocation);
} }
TNode<JSObject> group_object = AllocateJSObjectFromMap(map, properties); TNode<JSObject> group_object = AllocateJSObjectFromMap(map, properties);
......
...@@ -236,7 +236,8 @@ macro AllocateFromNew( ...@@ -236,7 +236,8 @@ macro AllocateFromNew(
return Allocate( return Allocate(
sizeInBytes, sizeInBytes,
%RawConstexprCast<constexpr AllocationFlag>( %RawConstexprCast<constexpr AllocationFlag>(
kAllocateBaseFlags | AllocationFlag::kPretenured)); %RawConstexprCast<constexpr int32>(kAllocateBaseFlags) |
%RawConstexprCast<constexpr int32>(AllocationFlag::kPretenured)));
} else { } else {
return Allocate(sizeInBytes, kAllocateBaseFlags); return Allocate(sizeInBytes, kAllocateBaseFlags);
} }
......
This diff is collapsed.
...@@ -322,7 +322,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ...@@ -322,7 +322,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
explicit CodeStubAssembler(compiler::CodeAssemblerState* state); explicit CodeStubAssembler(compiler::CodeAssemblerState* state);
enum AllocationFlag : uint8_t { enum class AllocationFlag : uint8_t {
kNone = 0, kNone = 0,
kDoubleAlignment = 1, kDoubleAlignment = 1,
kPretenured = 1 << 1, kPretenured = 1 << 1,
...@@ -753,13 +753,15 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ...@@ -753,13 +753,15 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
Operation bitwise_op); Operation bitwise_op);
// Allocate an object of the given size. // Allocate an object of the given size.
TNode<HeapObject> AllocateInNewSpace(TNode<IntPtrT> size, TNode<HeapObject> AllocateInNewSpace(
AllocationFlags flags = kNone); TNode<IntPtrT> size, AllocationFlags flags = AllocationFlag::kNone);
TNode<HeapObject> AllocateInNewSpace(int size, AllocationFlags flags = kNone); TNode<HeapObject> AllocateInNewSpace(
int size, AllocationFlags flags = AllocationFlag::kNone);
TNode<HeapObject> Allocate(TNode<IntPtrT> size, TNode<HeapObject> Allocate(TNode<IntPtrT> size,
AllocationFlags flags = kNone); AllocationFlags flags = AllocationFlag::kNone);
TNode<HeapObject> Allocate(int size, AllocationFlags flags = kNone); TNode<HeapObject> Allocate(int size,
AllocationFlags flags = AllocationFlag::kNone);
TNode<BoolT> IsRegularHeapObjectSize(TNode<IntPtrT> size); TNode<BoolT> IsRegularHeapObjectSize(TNode<IntPtrT> size);
...@@ -1809,17 +1811,17 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ...@@ -1809,17 +1811,17 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
AllocationFlags flags); AllocationFlags flags);
// Allocate a ByteArray with the given length. // Allocate a ByteArray with the given length.
TNode<ByteArray> AllocateByteArray(TNode<UintPtrT> length, TNode<ByteArray> AllocateByteArray(
AllocationFlags flags = kNone); TNode<UintPtrT> length, AllocationFlags flags = AllocationFlag::kNone);
// Allocate a SeqOneByteString with the given length. // Allocate a SeqOneByteString with the given length.
TNode<String> AllocateSeqOneByteString(uint32_t length, TNode<String> AllocateSeqOneByteString(
AllocationFlags flags = kNone); uint32_t length, AllocationFlags flags = AllocationFlag::kNone);
using TorqueGeneratedExportedMacrosAssembler::AllocateSeqOneByteString; using TorqueGeneratedExportedMacrosAssembler::AllocateSeqOneByteString;
// Allocate a SeqTwoByteString with the given length. // Allocate a SeqTwoByteString with the given length.
TNode<String> AllocateSeqTwoByteString(uint32_t length, TNode<String> AllocateSeqTwoByteString(
AllocationFlags flags = kNone); uint32_t length, AllocationFlags flags = AllocationFlag::kNone);
using TorqueGeneratedExportedMacrosAssembler::AllocateSeqTwoByteString; using TorqueGeneratedExportedMacrosAssembler::AllocateSeqTwoByteString;
// Allocate a SlicedOneByteString with the given length, parent and offset. // Allocate a SlicedOneByteString with the given length, parent and offset.
...@@ -1836,9 +1838,10 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ...@@ -1836,9 +1838,10 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<NameDictionary> AllocateNameDictionary(int at_least_space_for); TNode<NameDictionary> AllocateNameDictionary(int at_least_space_for);
TNode<NameDictionary> AllocateNameDictionary( TNode<NameDictionary> AllocateNameDictionary(
TNode<IntPtrT> at_least_space_for, AllocationFlags = kNone); TNode<IntPtrT> at_least_space_for,
AllocationFlags = AllocationFlag::kNone);
TNode<NameDictionary> AllocateNameDictionaryWithCapacity( TNode<NameDictionary> AllocateNameDictionaryWithCapacity(
TNode<IntPtrT> capacity, AllocationFlags = kNone); TNode<IntPtrT> capacity, AllocationFlags = AllocationFlag::kNone);
TNode<NameDictionary> CopyNameDictionary(TNode<NameDictionary> dictionary, TNode<NameDictionary> CopyNameDictionary(TNode<NameDictionary> dictionary,
Label* large_object_fallback); Label* large_object_fallback);
...@@ -1856,7 +1859,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ...@@ -1856,7 +1859,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<Map> map, TNode<Map> map,
base::Optional<TNode<HeapObject>> properties = base::nullopt, base::Optional<TNode<HeapObject>> properties = base::nullopt,
base::Optional<TNode<FixedArray>> elements = base::nullopt, base::Optional<TNode<FixedArray>> elements = base::nullopt,
AllocationFlags flags = kNone, AllocationFlags flags = AllocationFlag::kNone,
SlackTrackingMode slack_tracking_mode = kNoSlackTracking); SlackTrackingMode slack_tracking_mode = kNoSlackTracking);
void InitializeJSObjectFromMap( void InitializeJSObjectFromMap(
...@@ -1881,30 +1884,33 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ...@@ -1881,30 +1884,33 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
AllocateUninitializedJSArrayWithElements( AllocateUninitializedJSArrayWithElements(
ElementsKind kind, TNode<Map> array_map, TNode<Smi> length, ElementsKind kind, TNode<Map> array_map, TNode<Smi> length,
base::Optional<TNode<AllocationSite>> allocation_site, base::Optional<TNode<AllocationSite>> allocation_site,
TNode<IntPtrT> capacity, AllocationFlags allocation_flags = kNone, TNode<IntPtrT> capacity,
AllocationFlags allocation_flags = AllocationFlag::kNone,
int array_header_size = JSArray::kHeaderSize); int array_header_size = JSArray::kHeaderSize);
// Allocate a JSArray and fill elements with the hole. // Allocate a JSArray and fill elements with the hole.
TNode<JSArray> AllocateJSArray( TNode<JSArray> AllocateJSArray(
ElementsKind kind, TNode<Map> array_map, TNode<IntPtrT> capacity, ElementsKind kind, TNode<Map> array_map, TNode<IntPtrT> capacity,
TNode<Smi> length, base::Optional<TNode<AllocationSite>> allocation_site, TNode<Smi> length, base::Optional<TNode<AllocationSite>> allocation_site,
AllocationFlags allocation_flags = kNone); AllocationFlags allocation_flags = AllocationFlag::kNone);
TNode<JSArray> AllocateJSArray( TNode<JSArray> AllocateJSArray(
ElementsKind kind, TNode<Map> array_map, TNode<Smi> capacity, ElementsKind kind, TNode<Map> array_map, TNode<Smi> capacity,
TNode<Smi> length, base::Optional<TNode<AllocationSite>> allocation_site, TNode<Smi> length, base::Optional<TNode<AllocationSite>> allocation_site,
AllocationFlags allocation_flags = kNone) { AllocationFlags allocation_flags = AllocationFlag::kNone) {
return AllocateJSArray(kind, array_map, SmiUntag(capacity), length, return AllocateJSArray(kind, array_map, SmiUntag(capacity), length,
allocation_site, allocation_flags); allocation_site, allocation_flags);
} }
TNode<JSArray> AllocateJSArray(ElementsKind kind, TNode<Map> array_map, TNode<JSArray> AllocateJSArray(
TNode<Smi> capacity, TNode<Smi> length, ElementsKind kind, TNode<Map> array_map, TNode<Smi> capacity,
AllocationFlags allocation_flags = kNone) { TNode<Smi> length,
AllocationFlags allocation_flags = AllocationFlag::kNone) {
return AllocateJSArray(kind, array_map, SmiUntag(capacity), length, return AllocateJSArray(kind, array_map, SmiUntag(capacity), length,
base::nullopt, allocation_flags); base::nullopt, allocation_flags);
} }
TNode<JSArray> AllocateJSArray(ElementsKind kind, TNode<Map> array_map, TNode<JSArray> AllocateJSArray(
TNode<IntPtrT> capacity, TNode<Smi> length, ElementsKind kind, TNode<Map> array_map, TNode<IntPtrT> capacity,
AllocationFlags allocation_flags = kNone) { TNode<Smi> length,
AllocationFlags allocation_flags = AllocationFlag::kNone) {
return AllocateJSArray(kind, array_map, capacity, length, base::nullopt, return AllocateJSArray(kind, array_map, capacity, length, base::nullopt,
allocation_flags); allocation_flags);
} }
...@@ -1937,7 +1943,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ...@@ -1937,7 +1943,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
template <typename TIndex> template <typename TIndex>
TNode<FixedArrayBase> AllocateFixedArray( TNode<FixedArrayBase> AllocateFixedArray(
ElementsKind kind, TNode<TIndex> capacity, AllocationFlags flags = kNone, ElementsKind kind, TNode<TIndex> capacity,
AllocationFlags flags = AllocationFlag::kNone,
base::Optional<TNode<Map>> fixed_array_map = base::nullopt); base::Optional<TNode<Map>> fixed_array_map = base::nullopt);
TNode<NativeContext> GetCreationContext(TNode<JSReceiver> receiver, TNode<NativeContext> GetCreationContext(TNode<JSReceiver> receiver,
......
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