#include "src/builtins/builtins-collections-gen.h"
#include "src/builtins/builtins-constructor-gen.h"
#include "src/builtins/builtins-iterator-gen.h"
#include "src/builtins/builtins-utils-gen.h"
#include "src/codegen/code-stub-assembler-inl.h"
#include "src/execution/protectors.h"
#include "src/heap/factory-inl.h"
#include "src/heap/heap-inl.h"
#include "src/objects/hash-table-inl.h"
#include "src/objects/js-collection.h"
#include "src/objects/ordered-hash-table.h"
#include "src/roots/roots.h"
namespace v8 {
namespace internal {
#include "src/codegen/define-code-stub-assembler-macros.inc"
TVariable;
void BaseCollectionsAssembler::AddConstructorEntry(
Variant variant, TNode<Context> context, TNode<Object> collection,
TNode<Object> add_function, TNode<Object> key_value,
Label* if_may_have_side_effects, Label* if_exception,
TVariable<Object>* var_exception) { … }
void BaseCollectionsAssembler::AddConstructorEntries(
Variant variant, TNode<Context> context,
TNode<NativeContext> native_context, TNode<HeapObject> collection,
TNode<Object> initial_entries) { … }
void BaseCollectionsAssembler::AddConstructorEntriesFromFastJSArray(
Variant variant, TNode<Context> context, TNode<Context> native_context,
TNode<Object> collection, TNode<JSArray> fast_jsarray,
Label* if_may_have_side_effects, TVariable<IntPtrT>& var_current_index) { … }
void BaseCollectionsAssembler::AddConstructorEntriesFromIterable(
Variant variant, TNode<Context> context, TNode<Context> native_context,
TNode<Object> collection, TNode<Object> iterable, Label* if_exception,
TVariable<JSReceiver>* var_iterator_object,
TVariable<Object>* var_exception) { … }
RootIndex BaseCollectionsAssembler::GetAddFunctionNameIndex(Variant variant) { … }
void BaseCollectionsAssembler::GotoIfInitialAddFunctionModified(
Variant variant, TNode<NativeContext> native_context,
TNode<HeapObject> collection, Label* if_modified) { … }
TNode<JSObject> BaseCollectionsAssembler::AllocateJSCollection(
TNode<Context> context, TNode<JSFunction> constructor,
TNode<JSReceiver> new_target) { … }
TNode<JSObject> BaseCollectionsAssembler::AllocateJSCollectionFast(
TNode<JSFunction> constructor) { … }
TNode<JSObject> BaseCollectionsAssembler::AllocateJSCollectionSlow(
TNode<Context> context, TNode<JSFunction> constructor,
TNode<JSReceiver> new_target) { … }
void BaseCollectionsAssembler::GenerateConstructor(
Variant variant, Handle<String> constructor_function_name,
TNode<Object> new_target, TNode<IntPtrT> argc, TNode<Context> context) { … }
TNode<Object> BaseCollectionsAssembler::GetAddFunction(
Variant variant, TNode<Context> context, TNode<Object> collection) { … }
TNode<JSFunction> BaseCollectionsAssembler::GetConstructor(
Variant variant, TNode<Context> native_context) { … }
TNode<JSFunction> BaseCollectionsAssembler::GetInitialAddFunction(
Variant variant, TNode<Context> native_context) { … }
int BaseCollectionsAssembler::GetTableOffset(Variant variant) { … }
void BaseCollectionsAssembler::GotoIfCannotBeHeldWeakly(
const TNode<Object> obj, Label* if_cannot_be_held_weakly) { … }
TNode<Map> BaseCollectionsAssembler::GetInitialCollectionPrototype(
Variant variant, TNode<Context> native_context) { … }
TNode<BoolT> BaseCollectionsAssembler::HasInitialCollectionPrototype(
Variant variant, TNode<Context> native_context, TNode<Object> collection) { … }
TNode<Object> BaseCollectionsAssembler::LoadAndNormalizeFixedArrayElement(
TNode<FixedArray> elements, TNode<IntPtrT> index) { … }
TNode<Object> BaseCollectionsAssembler::LoadAndNormalizeFixedDoubleArrayElement(
TNode<HeapObject> elements, TNode<IntPtrT> index) { … }
template <typename CollectionType>
void CollectionsBuiltinsAssembler::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 CollectionsBuiltinsAssembler::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) { … }
void CollectionsBuiltinsAssembler::AddConstructorEntriesFromSet(
TNode<JSSet> collection, TNode<OrderedHashSet> table) { … }
void CollectionsBuiltinsAssembler::AddConstructorEntriesFromFastCollection(
Variant variant, TNode<HeapObject> collection,
TNode<HeapObject> source_table) { … }
template <typename IteratorType>
TNode<HeapObject> CollectionsBuiltinsAssembler::AllocateJSCollectionIterator(
const TNode<Context> context, int map_index,
const TNode<HeapObject> collection) { … }
TNode<HeapObject> CollectionsBuiltinsAssembler::AllocateTable(
Variant variant, TNode<IntPtrT> at_least_space_for) { … }
TF_BUILTIN(MapConstructor, CollectionsBuiltinsAssembler) { … }
TF_BUILTIN(SetConstructor, CollectionsBuiltinsAssembler) { … }
TNode<Smi> CollectionsBuiltinsAssembler::CallGetOrCreateHashRaw(
const TNode<HeapObject> key) { … }
TNode<Uint32T> CollectionsBuiltinsAssembler::CallGetHashRaw(
const TNode<HeapObject> key) { … }
TNode<Uint32T> CollectionsBuiltinsAssembler::GetHash(
const TNode<HeapObject> key) { … }
void CollectionsBuiltinsAssembler::SameValueZeroSmi(TNode<Smi> key_smi,
TNode<Object> candidate_key,
Label* if_same,
Label* if_not_same) { … }
void CollectionsBuiltinsAssembler::BranchIfMapIteratorProtectorValid(
Label* if_true, Label* if_false) { … }
void CollectionsBuiltinsAssembler::
BranchIfIterableWithOriginalKeyOrValueMapIterator(TNode<Object> iterator,
TNode<Context> context,
Label* if_true,
Label* if_false) { … }
void BranchIfIterableWithOriginalKeyOrValueMapIterator(
compiler::CodeAssemblerState* state, TNode<Object> iterable,
TNode<Context> context, compiler::CodeAssemblerLabel* if_true,
compiler::CodeAssemblerLabel* if_false) { … }
void CollectionsBuiltinsAssembler::BranchIfSetIteratorProtectorValid(
Label* if_true, Label* if_false) { … }
void CollectionsBuiltinsAssembler::BranchIfIterableWithOriginalValueSetIterator(
TNode<Object> iterable, TNode<Context> context, Label* if_true,
Label* if_false) { … }
void BranchIfIterableWithOriginalValueSetIterator(
compiler::CodeAssemblerState* state, TNode<Object> iterable,
TNode<Context> context, compiler::CodeAssemblerLabel* if_true,
compiler::CodeAssemblerLabel* if_false) { … }
TNode<OrderedHashSet> CollectionsBuiltinsAssembler::SetOrSetIteratorToSet(
TNode<Object> iterable) { … }
TNode<JSArray> CollectionsBuiltinsAssembler::MapIteratorToList(
TNode<Context> context, TNode<JSMapIterator> iterator) { … }
TF_BUILTIN(MapIteratorToList, CollectionsBuiltinsAssembler) { … }
TNode<JSArray> CollectionsBuiltinsAssembler::SetOrSetIteratorToList(
TNode<Context> context, TNode<HeapObject> iterable) { … }
TF_BUILTIN(SetOrSetIteratorToList, CollectionsBuiltinsAssembler) { … }
TNode<Word32T> CollectionsBuiltinsAssembler::ComputeUnseededHash(
TNode<IntPtrT> key) { … }
template <typename CollectionType>
void CollectionsBuiltinsAssembler::FindOrderedHashTableEntryForSmiKey(
TNode<CollectionType> table, TNode<Smi> smi_key, TVariable<IntPtrT>* result,
Label* entry_found, Label* not_found) { … }
template <typename CollectionType>
void CollectionsBuiltinsAssembler::FindOrderedHashTableEntryForStringKey(
TNode<CollectionType> table, TNode<String> key_tagged,
TVariable<IntPtrT>* result, Label* entry_found, Label* not_found) { … }
template <typename CollectionType>
void CollectionsBuiltinsAssembler::FindOrderedHashTableEntryForHeapNumberKey(
TNode<CollectionType> table, TNode<HeapNumber> key_heap_number,
TVariable<IntPtrT>* result, Label* entry_found, Label* not_found) { … }
template <typename CollectionType>
void CollectionsBuiltinsAssembler::FindOrderedHashTableEntryForBigIntKey(
TNode<CollectionType> table, TNode<BigInt> key_big_int,
TVariable<IntPtrT>* result, Label* entry_found, Label* not_found) { … }
template <typename CollectionType>
void CollectionsBuiltinsAssembler::FindOrderedHashTableEntryForOtherKey(
TNode<CollectionType> table, TNode<HeapObject> key_heap_object,
TVariable<IntPtrT>* result, Label* entry_found, Label* not_found) { … }
TNode<Uint32T> CollectionsBuiltinsAssembler::ComputeStringHash(
TNode<String> string_key) { … }
void CollectionsBuiltinsAssembler::SameValueZeroString(
TNode<String> key_string, TNode<Object> candidate_key, Label* if_same,
Label* if_not_same) { … }
void CollectionsBuiltinsAssembler::SameValueZeroBigInt(
TNode<BigInt> key, TNode<Object> candidate_key, Label* if_same,
Label* if_not_same) { … }
void CollectionsBuiltinsAssembler::SameValueZeroHeapNumber(
TNode<Float64T> key_float, TNode<Object> candidate_key, Label* if_same,
Label* if_not_same) { … }
TF_BUILTIN(OrderedHashTableHealIndex, CollectionsBuiltinsAssembler) { … }
template <typename TableType>
std::pair<TNode<TableType>, TNode<IntPtrT>>
CollectionsBuiltinsAssembler::Transition(
const TNode<TableType> table, const TNode<IntPtrT> index,
UpdateInTransition<TableType> const& update_in_transition) { … }
template <typename IteratorType, typename TableType>
std::pair<TNode<TableType>, TNode<IntPtrT>>
CollectionsBuiltinsAssembler::TransitionAndUpdate(
const TNode<IteratorType> iterator) { … }
TorqueStructOrderedHashSetIndexPair
CollectionsBuiltinsAssembler::TransitionOrderedHashSetNoUpdate(
const TNode<OrderedHashSet> table_arg, const TNode<IntPtrT> index_arg) { … }
template <typename TableType>
std::tuple<TNode<Object>, TNode<IntPtrT>, TNode<IntPtrT>>
CollectionsBuiltinsAssembler::NextSkipHashTableHoles(TNode<TableType> table,
TNode<IntPtrT> index,
Label* if_end) { … }
template <typename TableType>
std::tuple<TNode<Object>, TNode<IntPtrT>, TNode<IntPtrT>>
CollectionsBuiltinsAssembler::NextSkipHashTableHoles(
TNode<TableType> table, TNode<Int32T> number_of_buckets,
TNode<Int32T> used_capacity, TNode<IntPtrT> index, Label* if_end) { … }
template <typename CollectionType>
TorqueStructKeyIndexPair
CollectionsBuiltinsAssembler::NextKeyIndexPairUnmodifiedTable(
const TNode<CollectionType> table, const TNode<Int32T> number_of_buckets,
const TNode<Int32T> used_capacity, const TNode<IntPtrT> index,
Label* if_end) { … }
template TorqueStructKeyIndexPair
CollectionsBuiltinsAssembler::NextKeyIndexPairUnmodifiedTable(
const TNode<OrderedHashMap> table, const TNode<Int32T> number_of_buckets,
const TNode<Int32T> used_capacity, const TNode<IntPtrT> index,
Label* if_end);
template TorqueStructKeyIndexPair
CollectionsBuiltinsAssembler::NextKeyIndexPairUnmodifiedTable(
const TNode<OrderedHashSet> table, const TNode<Int32T> number_of_buckets,
const TNode<Int32T> used_capacity, const TNode<IntPtrT> index,
Label* if_end);
template <typename CollectionType>
TorqueStructKeyIndexPair CollectionsBuiltinsAssembler::NextKeyIndexPair(
const TNode<CollectionType> table, const TNode<IntPtrT> index,
Label* if_end) { … }
template TorqueStructKeyIndexPair
CollectionsBuiltinsAssembler::NextKeyIndexPair(
const TNode<OrderedHashMap> table, const TNode<IntPtrT> index,
Label* if_end);
template TorqueStructKeyIndexPair
CollectionsBuiltinsAssembler::NextKeyIndexPair(
const TNode<OrderedHashSet> table, const TNode<IntPtrT> index,
Label* if_end);
TorqueStructKeyValueIndexTuple
CollectionsBuiltinsAssembler::NextKeyValueIndexTupleUnmodifiedTable(
const TNode<OrderedHashMap> table, const TNode<Int32T> number_of_buckets,
const TNode<Int32T> used_capacity, const TNode<IntPtrT> index,
Label* if_end) { … }
TorqueStructKeyValueIndexTuple
CollectionsBuiltinsAssembler::NextKeyValueIndexTuple(
const TNode<OrderedHashMap> table, const TNode<IntPtrT> index,
Label* if_end) { … }
TF_BUILTIN(MapPrototypeGet, CollectionsBuiltinsAssembler) { … }
TF_BUILTIN(MapPrototypeHas, CollectionsBuiltinsAssembler) { … }
TNode<BoolT> CollectionsBuiltinsAssembler::TableHasKey(
const TNode<Object> context, TNode<OrderedHashMap> table,
TNode<Object> key) { … }
const TNode<Object> CollectionsBuiltinsAssembler::NormalizeNumberKey(
const TNode<Object> key) { … }
template <typename CollectionType>
TNode<CollectionType> CollectionsBuiltinsAssembler::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) { … }
TF_BUILTIN(MapPrototypeSet, CollectionsBuiltinsAssembler) { … }
template <typename CollectionType>
void CollectionsBuiltinsAssembler::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) { … }
template <typename CollectionType>
void CollectionsBuiltinsAssembler::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 CollectionsBuiltinsAssembler::StoreValueInOrderedHashMapEntry(
const TNode<OrderedHashMap> table, const TNode<Object> value,
const TNode<IntPtrT> entry_start, CheckBounds check_bounds) { … }
void CollectionsBuiltinsAssembler::StoreKeyValueInOrderedHashMapEntry(
const TNode<OrderedHashMap> table, const TNode<Object> key,
const TNode<Object> value, const TNode<IntPtrT> entry_start,
CheckBounds check_bounds) { … }
TF_BUILTIN(MapPrototypeDelete, CollectionsBuiltinsAssembler) { … }
TF_BUILTIN(SetPrototypeAdd, CollectionsBuiltinsAssembler) { … }
TNode<OrderedHashSet> CollectionsBuiltinsAssembler::AddToSetTable(
const TNode<Object> context, TNode<OrderedHashSet> table, TNode<Object> key,
TNode<String> method_name) { … }
void CollectionsBuiltinsAssembler::StoreKeyInOrderedHashSetEntry(
const TNode<OrderedHashSet> table, const TNode<Object> key,
const TNode<IntPtrT> entry_start, CheckBounds check_bounds) { … }
template <typename CollectionType>
TNode<Object> CollectionsBuiltinsAssembler::LoadKeyFromOrderedHashTableEntry(
const TNode<CollectionType> table, const TNode<IntPtrT> entry,
CheckBounds check_bounds) { … }
TNode<Object> CollectionsBuiltinsAssembler::LoadValueFromOrderedHashMapEntry(
const TNode<OrderedHashMap> table, const TNode<IntPtrT> entry,
CheckBounds check_bounds) { … }
TF_BUILTIN(SetPrototypeDelete, CollectionsBuiltinsAssembler) { … }
TNode<Smi> CollectionsBuiltinsAssembler::DeleteFromSetTable(
const TNode<Object> context, TNode<OrderedHashSet> table, TNode<Object> key,
Label* not_found) { … }
TF_BUILTIN(MapPrototypeEntries, CollectionsBuiltinsAssembler) { … }
TF_BUILTIN(MapPrototypeGetSize, CollectionsBuiltinsAssembler) { … }
TF_BUILTIN(MapPrototypeForEach, CollectionsBuiltinsAssembler) { … }
TF_BUILTIN(MapPrototypeKeys, CollectionsBuiltinsAssembler) { … }
TF_BUILTIN(MapPrototypeValues, CollectionsBuiltinsAssembler) { … }
TF_BUILTIN(MapIteratorPrototypeNext, CollectionsBuiltinsAssembler) { … }
TF_BUILTIN(SetPrototypeHas, CollectionsBuiltinsAssembler) { … }
TNode<BoolT> CollectionsBuiltinsAssembler::TableHasKey(
const TNode<Object> context, TNode<OrderedHashSet> table,
TNode<Object> key) { … }
TF_BUILTIN(SetPrototypeEntries, CollectionsBuiltinsAssembler) { … }
TF_BUILTIN(SetPrototypeGetSize, CollectionsBuiltinsAssembler) { … }
TF_BUILTIN(SetPrototypeForEach, CollectionsBuiltinsAssembler) { … }
TF_BUILTIN(SetPrototypeValues, CollectionsBuiltinsAssembler) { … }
TF_BUILTIN(SetIteratorPrototypeNext, CollectionsBuiltinsAssembler) { … }
template <typename CollectionType>
void CollectionsBuiltinsAssembler::TryLookupOrderedHashTableIndex(
const TNode<CollectionType> table, const TNode<Object> key,
TVariable<IntPtrT>* result, Label* if_entry_found, Label* if_not_found) { … }
TF_BUILTIN(FindOrderedHashMapEntry, CollectionsBuiltinsAssembler) { … }
TF_BUILTIN(FindOrderedHashSetEntry, CollectionsBuiltinsAssembler) { … }
const TNode<OrderedHashMap> CollectionsBuiltinsAssembler::AddValueToKeyedGroup(
const TNode<OrderedHashMap> groups, const TNode<Object> key,
const TNode<Object> value, const TNode<String> methodName) { … }
void WeakCollectionsBuiltinsAssembler::AddEntry(
TNode<EphemeronHashTable> table, TNode<IntPtrT> key_index,
TNode<Object> key, TNode<Object> value, TNode<Int32T> number_of_elements) { … }
TNode<IntPtrT> WeakCollectionsBuiltinsAssembler::GetHash(
const TNode<HeapObject> key, Label* if_no_hash) { … }
TNode<HeapObject> WeakCollectionsBuiltinsAssembler::AllocateTable(
Variant variant, TNode<IntPtrT> at_least_space_for) { … }
TNode<Smi> WeakCollectionsBuiltinsAssembler::CreateIdentityHash(
TNode<Object> key) { … }
TNode<IntPtrT> WeakCollectionsBuiltinsAssembler::EntryMask(
TNode<IntPtrT> capacity) { … }
TNode<IntPtrT> WeakCollectionsBuiltinsAssembler::FindKeyIndex(
TNode<HeapObject> table, TNode<IntPtrT> key_hash, TNode<IntPtrT> entry_mask,
const KeyComparator& key_compare) { … }
TNode<IntPtrT> WeakCollectionsBuiltinsAssembler::FindKeyIndexForInsertion(
TNode<HeapObject> table, TNode<IntPtrT> key_hash,
TNode<IntPtrT> entry_mask) { … }
TNode<IntPtrT> WeakCollectionsBuiltinsAssembler::FindKeyIndexForKey(
TNode<HeapObject> table, TNode<Object> key, TNode<IntPtrT> hash,
TNode<IntPtrT> entry_mask, Label* if_not_found) { … }
TNode<IntPtrT> WeakCollectionsBuiltinsAssembler::KeyIndexFromEntry(
TNode<IntPtrT> entry) { … }
TNode<Int32T> WeakCollectionsBuiltinsAssembler::LoadNumberOfElements(
TNode<EphemeronHashTable> table, int offset) { … }
TNode<Int32T> WeakCollectionsBuiltinsAssembler::LoadNumberOfDeleted(
TNode<EphemeronHashTable> table, int offset) { … }
TNode<EphemeronHashTable> WeakCollectionsBuiltinsAssembler::LoadTable(
TNode<JSWeakCollection> collection) { … }
TNode<IntPtrT> WeakCollectionsBuiltinsAssembler::LoadTableCapacity(
TNode<EphemeronHashTable> table) { … }
TNode<Word32T> WeakCollectionsBuiltinsAssembler::InsufficientCapacityToAdd(
TNode<Int32T> capacity, TNode<Int32T> number_of_elements,
TNode<Int32T> number_of_deleted) { … }
void WeakCollectionsBuiltinsAssembler::RemoveEntry(
TNode<EphemeronHashTable> table, TNode<IntPtrT> key_index,
TNode<IntPtrT> number_of_elements) { … }
TNode<BoolT> WeakCollectionsBuiltinsAssembler::ShouldRehash(
TNode<Int32T> number_of_elements, TNode<Int32T> number_of_deleted) { … }
TNode<Word32T> WeakCollectionsBuiltinsAssembler::ShouldShrink(
TNode<IntPtrT> capacity, TNode<IntPtrT> number_of_elements) { … }
TNode<IntPtrT> WeakCollectionsBuiltinsAssembler::ValueIndexFromKeyIndex(
TNode<IntPtrT> key_index) { … }
TF_BUILTIN(WeakMapConstructor, WeakCollectionsBuiltinsAssembler) { … }
TF_BUILTIN(WeakSetConstructor, WeakCollectionsBuiltinsAssembler) { … }
TF_BUILTIN(WeakMapLookupHashIndex, WeakCollectionsBuiltinsAssembler) { … }
TF_BUILTIN(WeakMapGet, WeakCollectionsBuiltinsAssembler) { … }
TF_BUILTIN(WeakMapPrototypeHas, WeakCollectionsBuiltinsAssembler) { … }
TF_BUILTIN(WeakCollectionDelete, WeakCollectionsBuiltinsAssembler) { … }
TF_BUILTIN(WeakCollectionSet, WeakCollectionsBuiltinsAssembler) { … }
TF_BUILTIN(WeakMapPrototypeDelete, CodeStubAssembler) { … }
TF_BUILTIN(WeakMapPrototypeSet, WeakCollectionsBuiltinsAssembler) { … }
TF_BUILTIN(WeakSetPrototypeAdd, WeakCollectionsBuiltinsAssembler) { … }
TF_BUILTIN(WeakSetPrototypeDelete, CodeStubAssembler) { … }
TF_BUILTIN(WeakSetPrototypeHas, WeakCollectionsBuiltinsAssembler) { … }
#include "src/codegen/undef-code-stub-assembler-macros.inc"
}
}