5#ifndef V8_BUILTINS_BUILTINS_COLLECTIONS_GEN_H_ 
    6#define V8_BUILTINS_BUILTINS_COLLECTIONS_GEN_H_ 
   14    compiler::CodeAssemblerState* state, TNode<Object> iterable,
 
   15    TNode<Context> context, compiler::CodeAssemblerLabel* if_true,
 
   16    compiler::CodeAssemblerLabel* if_false);
 
   19    compiler::CodeAssemblerState* state, TNode<Object> iterable,
 
   20    TNode<Context> context, compiler::CodeAssemblerLabel* if_true,
 
   21    compiler::CodeAssemblerLabel* if_false);
 
   31                                Label* if_cannot_be_held_weakly);
 
   41                           Label* if_may_have_side_effects = 
nullptr,
 
   42                           Label* if_exception = 
nullptr,
 
   49      Label* if_not_fast_collection) = 0;
 
 
  175  template <
typename CollectionType>
 
  181  template <
typename CollectionType>
 
  228  template <
typename IteratorType>
 
  240  template <
typename TableType>
 
  243  template <
typename TableType>
 
  247  template <
typename IteratorType, 
typename TableType>
 
  251  template <
typename TableType>
 
  255  template <
typename TableType>
 
  280      Label* if_not_fast_collection) 
override;
 
  290  template <
typename CollectionType>
 
  304  template <
typename CollectionType>
 
  314  template <
typename CollectionType>
 
  324  template <
typename CollectionType>
 
  340  template <
typename CollectionType>
 
  360  template <
typename CollectionType>
 
  362  template <
typename CollectionType>
 
  365  template <
typename CollectionType>
 
  372  template <
typename CollectionType>
 
  376                                      Label* if_entry_found,
 
  377                                      Label* if_not_found);
 
  380  template <
typename CollectionType>
 
  398                                             number_of_buckets, occupancy,
 
 
  406  template <
typename CollectionType>
 
  451  template <
typename CollectionType>
 
  456  template <
typename CollectionType>
 
  492  template <
typename CollectionType>
 
 
  542                                    Label* if_not_found);
 
  568      Label* if_not_fast_collection)
 override {
 
 
 
TNode< Object > LoadAndNormalizeFixedDoubleArrayElement(TNode< HeapObject > elements, TNode< IntPtrT > index)
TNode< Map > GetInitialCollectionPrototype(Variant variant, TNode< Context > native_context)
virtual void GetEntriesIfFastCollectionOrIterable(Variant variant, TNode< Object > initial_entries, TNode< Context > context, TVariable< HeapObject > *var_entries_table, TVariable< IntPtrT > *var_number_of_elements, Label *if_not_fast_collection)=0
TNode< JSFunction > GetInitialAddFunction(Variant variant, TNode< Context > native_context)
RootIndex GetAddFunctionNameIndex(Variant variant)
void AddConstructorEntriesFromFastJSArray(Variant variant, TNode< Context > context, TNode< Context > native_context, TNode< JSAny > collection, TNode< JSArray > fast_jsarray, Label *if_may_have_side_effects, TVariable< IntPtrT > &var_current_index)
TNode< JSFunction > GetConstructor(Variant variant, TNode< Context > native_context)
TNode< Object > LoadAndNormalizeFixedArrayElement(TNode< FixedArray > elements, TNode< IntPtrT > index)
TNode< Object > GetAddFunction(Variant variant, TNode< Context > context, TNode< JSAny > collection)
TNode< JSObject > AllocateJSCollection(TNode< Context > context, TNode< JSFunction > constructor, TNode< JSReceiver > new_target)
virtual TNode< HeapObject > AllocateTable(Variant variant, TNode< IntPtrT > at_least_space_for)=0
void AddConstructorEntries(Variant variant, TNode< Context > context, TNode< NativeContext > native_context, TNode< JSAnyNotSmi > collection, TNode< JSAny > initial_entries)
virtual void AddConstructorEntriesFromFastCollection(Variant variant, TNode< HeapObject > collection, TNode< HeapObject > source_table)=0
void GenerateConstructor(Variant variant, Handle< String > constructor_function_name, TNode< Object > new_target, TNode< IntPtrT > argc, TNode< Context > context)
void GotoIfInitialAddFunctionModified(Variant variant, TNode< NativeContext > native_context, TNode< HeapObject > collection, Label *if_modified)
virtual ~BaseCollectionsAssembler()=default
int GetTableOffset(Variant variant)
void GotoIfCannotBeHeldWeakly(const TNode< Object > obj, Label *if_cannot_be_held_weakly)
BaseCollectionsAssembler(compiler::CodeAssemblerState *state)
void AddConstructorEntry(Variant variant, TNode< Context > context, TNode< JSAny > collection, TNode< Object > add_function, TNode< JSAny > key_value, Label *if_may_have_side_effects=nullptr, Label *if_exception=nullptr, TVariable< Object > *var_exception=nullptr)
TNode< BoolT > HasInitialCollectionPrototype(Variant variant, TNode< Context > native_context, TNode< JSAny > collection)
TNode< JSObject > AllocateJSCollectionSlow(TNode< Context > context, TNode< JSFunction > constructor, TNode< JSReceiver > new_target)
void AddConstructorEntriesFromIterable(Variant variant, TNode< Context > context, TNode< Context > native_context, TNode< JSAny > collection, TNode< JSAny > iterable, Label *if_exception, TVariable< JSReceiver > *var_iterator, TVariable< Object > *var_exception)
TNode< JSObject > AllocateJSCollectionFast(TNode< JSFunction > constructor)
void BranchIfSetIteratorProtectorValid(Label *if_true, Label *if_false)
TNode< BoolT > TableHasKey(const TNode< Object > context, TNode< OrderedHashSet > table, TNode< Object > key)
void SameValueZeroBigInt(TNode< BigInt > key, TNode< Object > candidate_key, Label *if_same, Label *if_not_same)
void BranchIfIterableWithOriginalValueSetIterator(TNode< Object > iterable, TNode< Context > context, Label *if_true, Label *if_false)
void UnsafeStoreValueInOrderedHashMapEntry(const TNode< OrderedHashMap > table, const TNode< Object > value, const TNode< IntPtrT > entry)
const TNode< JSAny > NormalizeNumberKey(const TNode< JSAny > key)
void SameValueZeroHeapNumber(TNode< Float64T > key_float, TNode< Object > candidate_key, Label *if_same, Label *if_not_same)
TorqueStructKeyValueIndexTuple NextKeyValueIndexTuple(const TNode< OrderedHashMap > table, const TNode< IntPtrT > index, Label *if_end)
void TryLookupOrderedHashTableIndex(const TNode< CollectionType > table, const TNode< Object > key, TVariable< IntPtrT > *result, Label *if_entry_found, Label *if_not_found)
void AddConstructorEntriesFromFastCollection(Variant variant, TNode< HeapObject > collection, TNode< HeapObject > source_table) override
TorqueStructKeyValueIndexTuple NextKeyValueIndexTupleUnmodifiedTable(const TNode< OrderedHashMap > table, const TNode< Int32T > number_of_buckets, const TNode< Int32T > used_capacity, const TNode< IntPtrT > index, Label *if_end)
TNode< Smi > CallGetOrCreateHashRaw(const TNode< HeapObject > key)
void StoreKeyInOrderedHashSetEntry(const TNode< OrderedHashSet > table, const TNode< Object > key, const TNode< IntPtrT > entry, CheckBounds check_bounds=CheckBounds::kAlways)
TNode< JSArray > MapIteratorToList(TNode< Context > context, TNode< JSMapIterator > iterator)
const TNode< OrderedHashMap > AddValueToKeyedGroup(const TNode< OrderedHashMap > groups, const TNode< Object > key, const TNode< Object > value, const TNode< String > methodName)
void StoreKeyValueInOrderedHashMapEntry(const TNode< OrderedHashMap > table, const TNode< Object > key, const TNode< Object > value, const TNode< IntPtrT > entry, CheckBounds check_bounds=CheckBounds::kAlways)
TNode< JSAny > LoadKeyFromOrderedHashTableEntry(const TNode< CollectionType > table, const TNode< IntPtrT > entry, CheckBounds check_bounds=CheckBounds::kAlways)
void FindOrderedHashTableEntry(const TNode< CollectionType > table, const TNode< Uint32T > hash, const std::function< void(TNode< Object >, Label *, Label *)> &key_compare, TVariable< IntPtrT > *entry_start_position, Label *entry_found, Label *not_found)
void StoreOrderedHashTableNewEntry(const TNode< CollectionType > table, const TNode< IntPtrT > hash, const TNode< IntPtrT > number_of_buckets, const TNode< IntPtrT > occupancy, const StoreAtEntry< CollectionType > &store_at_new_entry)
TNode< UnionOf< JSAny, ArrayList > > LoadValueFromOrderedHashMapEntry(const TNode< OrderedHashMap > table, const TNode< IntPtrT > entry, CheckBounds check_bounds=CheckBounds::kAlways)
void FindOrderedHashTableEntryForSmiKey(TNode< CollectionType > table, TNode< Smi > key_tagged, TVariable< IntPtrT > *result, Label *entry_found, Label *not_found)
void BranchIfIterableWithOriginalKeyOrValueMapIterator(TNode< Object > iterable, TNode< Context > context, Label *if_true, Label *if_false)
void SameValueZeroString(TNode< String > key_string, TNode< Object > candidate_key, Label *if_same, Label *if_not_same)
void FindOrderedHashTableEntryForStringKey(TNode< CollectionType > table, TNode< String > key_tagged, TVariable< IntPtrT > *result, Label *entry_found, Label *not_found)
TNode< JSAny > UnsafeLoadKeyFromOrderedHashTableEntry(const TNode< CollectionType > table, const TNode< IntPtrT > entry)
void BranchIfMapIteratorProtectorValid(Label *if_true, Label *if_false)
TNode< JSArray > SetOrSetIteratorToList(TNode< Context > context, TNode< HeapObject > iterable)
void FindOrderedHashTableEntryForOtherKey(TNode< CollectionType > table, TNode< HeapObject > key_heap_object, TVariable< IntPtrT > *result, Label *entry_found, Label *not_found)
std::tuple< TNode< JSAny >, TNode< IntPtrT >, TNode< IntPtrT > > NextSkipHashTableHoles(TNode< TableType > table, TNode< IntPtrT > index, Label *if_end)
TNode< Uint32T > ComputeStringHash(TNode< String > string_key)
std::pair< TNode< TableType >, TNode< IntPtrT > > TransitionAndUpdate(const TNode< IteratorType > iterator)
TorqueStructKeyIndexPair NextKeyIndexPairUnmodifiedTable(const TNode< CollectionType > table, const TNode< Int32T > number_of_buckets, const TNode< Int32T > used_capacity, const TNode< IntPtrT > index, Label *if_end)
void FindOrderedHashTableEntryForHeapNumberKey(TNode< CollectionType > table, TNode< HeapNumber > key_heap_number, TVariable< IntPtrT > *result, Label *entry_found, Label *not_found)
TorqueStructOrderedHashSetIndexPair TransitionOrderedHashSetNoUpdate(const TNode< OrderedHashSet > table, const TNode< IntPtrT > index)
void AddNewToOrderedHashTable(const TNode< CollectionType > table, const TNode< Object > normalised_key, const TNode< IntPtrT > number_of_buckets, const TNode< IntPtrT > occupancy, const StoreAtEntry< CollectionType > &store_at_new_entry)
void SameValueZeroSmi(TNode< Smi > key_smi, TNode< Object > candidate_key, Label *if_same, Label *if_not_same)
std::function< void(const TNode< TableType > table, const TNode< IntPtrT > index)> UpdateInTransition
void FindOrderedHashTableEntryForBigIntKey(TNode< CollectionType > table, TNode< BigInt > key_big_int, TVariable< IntPtrT > *result, Label *entry_found, Label *not_found)
CollectionsBuiltinsAssembler(compiler::CodeAssemblerState *state)
TNode< UnionOf< JSAny, ArrayList > > UnsafeLoadValueFromOrderedHashMapEntry(const TNode< OrderedHashMap > table, const TNode< IntPtrT > entry)
TorqueStructKeyIndexPair NextKeyIndexPair(const TNode< CollectionType > table, const TNode< IntPtrT > index, Label *if_end)
TNode< HeapObject > AllocateJSCollectionIterator(const TNode< Context > context, int map_index, const TNode< HeapObject > collection)
void GetEntriesIfFastCollectionOrIterable(Variant variant, TNode< Object > initial_entries, TNode< Context > context, TVariable< HeapObject > *var_entries_table, TVariable< IntPtrT > *var_number_of_elements, Label *if_not_fast_collection) override
std::function< void(const TNode< CollectionType > table, const TNode< IntPtrT > entry_start)> StoreAtEntry
TNode< OrderedHashSet > AddToSetTable(TNode< Object > context, TNode< OrderedHashSet > table, TNode< JSAny > key, TNode< String > method_name)
void StoreValueInOrderedHashMapEntry(const TNode< OrderedHashMap > table, const TNode< Object > value, const TNode< IntPtrT > entry, CheckBounds check_bounds=CheckBounds::kAlways)
void AddNewToOrderedHashSet(const TNode< OrderedHashSet > table, const TNode< JSAny > key, const TNode< IntPtrT > number_of_buckets, const TNode< IntPtrT > occupancy)
void UnsafeStoreKeyValueInOrderedHashMapEntry(const TNode< OrderedHashMap > table, const TNode< Object > key, const TNode< Object > value, const TNode< IntPtrT > entry)
void UnsafeStoreKeyInOrderedHashSetEntry(const TNode< OrderedHashSet > table, const TNode< Object > key, const TNode< IntPtrT > entry)
TNode< Word32T > ComputeUnseededHash(TNode< IntPtrT > key)
TNode< CollectionType > AddToOrderedHashTable(const TNode< CollectionType > table, const TNode< Object > key, const GrowCollection< CollectionType > &grow, const StoreAtEntry< CollectionType > &store_at_new_entry, const StoreAtEntry< CollectionType > &store_at_existing_entry)
TNode< Uint32T > CallGetHashRaw(const TNode< HeapObject > key)
TNode< Smi > DeleteFromSetTable(const TNode< Object > context, TNode< OrderedHashSet > table, TNode< Object > key, Label *not_found)
TNode< OrderedHashSet > SetOrSetIteratorToSet(TNode< Object > iterator)
std::pair< TNode< TableType >, TNode< IntPtrT > > Transition(const TNode< TableType > table, const TNode< IntPtrT > index, UpdateInTransition< TableType > const &update_in_transition)
TNode< HeapObject > AllocateTable(Variant variant, TNode< IntPtrT > at_least_space_for) override
std::function< const TNode< CollectionType >()> GrowCollection
void AddConstructorEntriesFromSet(TNode< JSSet > collection, TNode< OrderedHashSet > table)
TNode< Uint32T > GetHash(const TNode< HeapObject > key)
TNode< Int32T > LoadNumberOfElements(TNode< EphemeronHashTable > table, int offset)
TNode< IntPtrT > GetHash(const TNode< HeapObject > key, Label *if_no_hash)
TNode< IntPtrT > LoadTableCapacity(TNode< EphemeronHashTable > table)
TNode< BoolT > ShouldRehash(TNode< Int32T > number_of_elements, TNode< Int32T > number_of_deleted)
WeakCollectionsBuiltinsAssembler(compiler::CodeAssemblerState *state)
TNode< IntPtrT > KeyIndexFromEntry(TNode< IntPtrT > entry)
std::function< void(TNode< Object > entry_key, Label *if_same)> KeyComparator
void GetEntriesIfFastCollectionOrIterable(Variant variant, TNode< Object > initial_entries, TNode< Context > context, TVariable< HeapObject > *var_entries_table, TVariable< IntPtrT > *var_number_of_elements, Label *if_not_fast_collection) override
TNode< IntPtrT > FindKeyIndex(TNode< HeapObject > table, TNode< IntPtrT > key_hash, TNode< IntPtrT > capacity, const KeyComparator &key_compare)
TNode< Smi > CreateIdentityHash(TNode< Object > receiver)
TNode< Word32T > InsufficientCapacityToAdd(TNode< Int32T > capacity, TNode< Int32T > number_of_elements, TNode< Int32T > number_of_deleted)
void AddEntry(TNode< EphemeronHashTable > table, TNode< IntPtrT > key_index, TNode< Object > key, TNode< Object > value, TNode< Int32T > number_of_elements)
TNode< HeapObject > AllocateTable(Variant variant, TNode< IntPtrT > at_least_space_for) override
TNode< IntPtrT > FindKeyIndexForInsertion(TNode< HeapObject > table, TNode< IntPtrT > key_hash, TNode< IntPtrT > capacity)
void RemoveEntry(TNode< EphemeronHashTable > table, TNode< IntPtrT > key_index, TNode< IntPtrT > number_of_elements)
TNode< Word32T > ShouldShrink(TNode< IntPtrT > capacity, TNode< IntPtrT > number_of_elements)
TNode< IntPtrT > ValueIndexFromKeyIndex(TNode< IntPtrT > key_index)
TNode< IntPtrT > FindKeyIndexForKey(TNode< HeapObject > table, TNode< Object > key, TNode< IntPtrT > hash, TNode< IntPtrT > capacity, Label *if_not_found)
void AddConstructorEntriesFromFastCollection(Variant variant, TNode< HeapObject > collection, TNode< HeapObject > source_table) override
TNode< IntPtrT > EntryMask(TNode< IntPtrT > capacity)
TNode< EphemeronHashTable > LoadTable(TNode< JSWeakCollection > collection)
TNode< IntPtrT > Coefficient(TNode< IntPtrT > capacity)
TNode< Int32T > LoadNumberOfDeleted(TNode< EphemeronHashTable > table, int offset=0)
DirectHandle< Object > new_target
ZoneVector< RpoNumber > & result
void BranchIfIterableWithOriginalKeyOrValueMapIterator(compiler::CodeAssemblerState *state, TNode< Object > iterable, TNode< Context > context, compiler::CodeAssemblerLabel *if_true, compiler::CodeAssemblerLabel *if_false)
void BranchIfIterableWithOriginalValueSetIterator(compiler::CodeAssemblerState *state, TNode< Object > iterable, TNode< Context > context, compiler::CodeAssemblerLabel *if_true, compiler::CodeAssemblerLabel *if_false)
!IsContextMap !IsContextMap native_context