v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
builtins-collections-gen.h
Go to the documentation of this file.
1// Copyright 2018 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_BUILTINS_BUILTINS_COLLECTIONS_GEN_H_
6#define V8_BUILTINS_BUILTINS_COLLECTIONS_GEN_H_
7
9
10namespace v8 {
11namespace internal {
12
14 compiler::CodeAssemblerState* state, TNode<Object> iterable,
15 TNode<Context> context, compiler::CodeAssemblerLabel* if_true,
16 compiler::CodeAssemblerLabel* if_false);
17
19 compiler::CodeAssemblerState* state, TNode<Object> iterable,
20 TNode<Context> context, compiler::CodeAssemblerLabel* if_true,
21 compiler::CodeAssemblerLabel* if_false);
22
24 public:
27
28 virtual ~BaseCollectionsAssembler() = default;
29
31 Label* if_cannot_be_held_weakly);
32
33 protected:
35
36 // Adds an entry to a collection. For Maps, properly handles extracting the
37 // key and value from the entry (see LoadKeyValue()).
38 void AddConstructorEntry(Variant variant, TNode<Context> context,
39 TNode<JSAny> collection, TNode<Object> add_function,
40 TNode<JSAny> key_value,
41 Label* if_may_have_side_effects = nullptr,
42 Label* if_exception = nullptr,
43 TVariable<Object>* var_exception = nullptr);
44
46 Variant variant, TNode<Object> initial_entries, TNode<Context> context,
47 TVariable<HeapObject>* var_entries_table,
48 TVariable<IntPtrT>* var_number_of_elements,
49 Label* if_not_fast_collection) = 0;
50
51 // Adds constructor entries to a collection. Choosing a fast path when
52 // possible.
53 void AddConstructorEntries(Variant variant, TNode<Context> context,
55 TNode<JSAnyNotSmi> collection,
56 TNode<JSAny> initial_entries);
57
58 // Fast path for adding constructor entries. Assumes the entries are a fast
59 // JS array (see CodeStubAssembler::BranchIfFastJSArray()).
62 TNode<JSAny> collection, TNode<JSArray> fast_jsarray,
63 Label* if_may_have_side_effects, TVariable<IntPtrT>& var_current_index);
64
65 // Adds constructor entries to a collection using the iterator protocol.
68 TNode<JSAny> collection, TNode<JSAny> iterable, Label* if_exception,
69 TVariable<JSReceiver>* var_iterator, TVariable<Object>* var_exception);
70
72 Variant variant, TNode<HeapObject> collection,
73 TNode<HeapObject> source_table) = 0;
74
75 // Constructs a collection instance. Choosing a fast path when possible.
77 TNode<JSFunction> constructor,
79
80 // Fast path for constructing a collection instance if the constructor
81 // function has not been modified.
83
84 // Fallback for constructing a collection instance if the constructor function
85 // has been modified.
87 TNode<JSFunction> constructor,
89
90 // Allocates the backing store for a collection.
92 Variant variant, TNode<IntPtrT> at_least_space_for) = 0;
93
94 // Main entry point for a collection constructor builtin.
95 void GenerateConstructor(Variant variant,
96 Handle<String> constructor_function_name,
98 TNode<Context> context);
99
100 // Retrieves the collection function that adds an entry. `set` for Maps and
101 // `add` for Sets.
103 TNode<JSAny> collection);
104
105 // Retrieves the collection constructor function.
108
109 // Retrieves the initial collection function that adds an entry. Should only
110 // be called when it is certain that a collection prototype's map hasn't been
111 // changed.
114
115 // Checks whether {collection}'s initial add/set function has been modified
116 // (depending on {variant}, loaded from {native_context}).
119 TNode<HeapObject> collection,
120 Label* if_modified);
121
122 // Gets root index for the name of the add/set function.
124
125 // Retrieves the offset to access the backing table from the collection.
126 int GetTableOffset(Variant variant);
127
128 // Determines whether the collection's prototype has been modified.
131 TNode<JSAny> collection);
132
133 // Gets the initial prototype map for given collection {variant}.
136
137 // Loads an element from a fixed array. If the element is the hole, returns
138 // `undefined`.
140 TNode<IntPtrT> index);
141
142 // Loads an element from a fixed double array. If the element is the hole,
143 // returns `undefined`.
145 TNode<HeapObject> elements, TNode<IntPtrT> index);
146};
147
149 public:
152
153 // Check whether |iterable| is a JS_MAP_KEY_ITERATOR_TYPE or
154 // JS_MAP_VALUE_ITERATOR_TYPE object that is not partially consumed and still
155 // has original iteration behavior.
157 TNode<Context> context,
158 Label* if_true,
159 Label* if_false);
160
161 // Check whether |iterable| is a JS_SET_TYPE or JS_SET_VALUE_ITERATOR_TYPE
162 // object that still has original iteration behavior. In case of the iterator,
163 // the iterator also must not have been partially consumed.
165 TNode<Context> context,
166 Label* if_true,
167 Label* if_false);
168
169 // Adds an element to a set if the element is not already in the set.
173 TNode<String> method_name);
174 // Direct iteration helpers.
175 template <typename CollectionType>
176 TorqueStructKeyIndexPair NextKeyIndexPairUnmodifiedTable(
177 const TNode<CollectionType> table, const TNode<Int32T> number_of_buckets,
178 const TNode<Int32T> used_capacity, const TNode<IntPtrT> index,
179 Label* if_end);
180
181 template <typename CollectionType>
182 TorqueStructKeyIndexPair NextKeyIndexPair(const TNode<CollectionType> table,
183 const TNode<IntPtrT> index,
184 Label* if_end);
185
186 TorqueStructKeyValueIndexTuple NextKeyValueIndexTupleUnmodifiedTable(
187 const TNode<OrderedHashMap> table, const TNode<Int32T> number_of_buckets,
188 const TNode<Int32T> used_capacity, const TNode<IntPtrT> index,
189 Label* if_end);
190
191 TorqueStructKeyValueIndexTuple NextKeyValueIndexTuple(
192 const TNode<OrderedHashMap> table, const TNode<IntPtrT> index,
193 Label* if_end);
194
195 // Checks if the set/map contains a key.
200
201 // Adds {value} to a FixedArray keyed by {key} in {groups}.
202 //
203 // Utility used by Object.groupBy and Map.groupBy.
205 const TNode<OrderedHashMap> groups, const TNode<Object> key,
206 const TNode<Object> value, const TNode<String> methodName);
207
208 // Normalizes -0 to +0.
210
211 // Methods after this point should really be protected but are exposed for
212 // Torque.
214 const TNode<Object> value,
215 const TNode<IntPtrT> entry) {
216 return StoreValueInOrderedHashMapEntry(table, value, entry,
218 }
219
222 Label* not_found);
223
224 TorqueStructOrderedHashSetIndexPair TransitionOrderedHashSetNoUpdate(
225 const TNode<OrderedHashSet> table, const TNode<IntPtrT> index);
226
227 protected:
228 template <typename IteratorType>
230 const TNode<Context> context, int map_index,
231 const TNode<HeapObject> collection);
233 TNode<IntPtrT> at_least_space_for) override;
237
238 // Transitions the iterator to the non obsolete backing store.
239 // This is a NOP if the [table] is not obsolete.
240 template <typename TableType>
241 using UpdateInTransition = std::function<void(const TNode<TableType> table,
242 const TNode<IntPtrT> index)>;
243 template <typename TableType>
244 std::pair<TNode<TableType>, TNode<IntPtrT>> Transition(
245 const TNode<TableType> table, const TNode<IntPtrT> index,
246 UpdateInTransition<TableType> const& update_in_transition);
247 template <typename IteratorType, typename TableType>
248 std::pair<TNode<TableType>, TNode<IntPtrT>> TransitionAndUpdate(
249 const TNode<IteratorType> iterator);
250
251 template <typename TableType>
252 std::tuple<TNode<JSAny>, TNode<IntPtrT>, TNode<IntPtrT>>
254 Label* if_end);
255 template <typename TableType>
256 std::tuple<TNode<JSAny>, TNode<IntPtrT>, TNode<IntPtrT>>
258 TNode<Int32T> number_of_buckets,
259 TNode<Int32T> used_capacity, TNode<IntPtrT> index,
260 Label* if_end);
261
262 // A helper function to help extract the {table} from either a Set or
263 // SetIterator. The function has a side effect of marking the
264 // SetIterator (if SetIterator is passed) as exhausted.
266
267 // Adds constructor entries to a collection when constructing from a Set
270
271 // a helper function to unwrap a fast js collection and load its length.
272 // var_entries_table is a variable meant to store the unwrapped collection.
273 // var_number_of_elements is a variable meant to store the length of the
274 // unwrapped collection. the function jumps to if_not_fast_collection if the
275 // collection is not a fast js collection.
277 Variant variant, TNode<Object> initial_entries, TNode<Context> context,
278 TVariable<HeapObject>* var_entries_table,
279 TVariable<IntPtrT>* var_number_of_elements,
280 Label* if_not_fast_collection) override;
281
282 // a helper to load constructor entries from a fast js collection.
284 Variant variant, TNode<HeapObject> collection,
285 TNode<HeapObject> source_table) override;
286
287 // Specialization for Smi.
288 // The {result} variable will contain the entry index if the key was found,
289 // or the hash code otherwise.
290 template <typename CollectionType>
292 TNode<Smi> key_tagged,
294 Label* entry_found, Label* not_found);
295 void SameValueZeroSmi(TNode<Smi> key_smi, TNode<Object> candidate_key,
296 Label* if_same, Label* if_not_same);
297
298 // Specialization for heap numbers.
299 // The {result} variable will contain the entry index if the key was found,
300 // or the hash code otherwise.
302 TNode<Object> candidate_key, Label* if_same,
303 Label* if_not_same);
304 template <typename CollectionType>
306 TNode<CollectionType> table, TNode<HeapNumber> key_heap_number,
307 TVariable<IntPtrT>* result, Label* entry_found, Label* not_found);
308
309 // Specialization for bigints.
310 // The {result} variable will contain the entry index if the key was found,
311 // or the hash code otherwise.
313 Label* if_same, Label* if_not_same);
314 template <typename CollectionType>
316 TNode<BigInt> key_big_int,
318 Label* entry_found,
319 Label* not_found);
320
321 // Specialization for string.
322 // The {result} variable will contain the entry index if the key was found,
323 // or the hash code otherwise.
324 template <typename CollectionType>
326 TNode<String> key_tagged,
328 Label* entry_found,
329 Label* not_found);
331 void SameValueZeroString(TNode<String> key_string,
332 TNode<Object> candidate_key, Label* if_same,
333 Label* if_not_same);
334
335 // Specialization for non-strings, non-numbers. For those we only need
336 // reference equality to compare the keys.
337 // The {result} variable will contain the entry index if the key was found,
338 // or the hash code otherwise. If the hash-code has not been computed, it
339 // should be Smi -1.
340 template <typename CollectionType>
342 TNode<HeapObject> key_heap_object,
344 Label* entry_found,
345 Label* not_found);
346
347 // Generates code to add an entry keyed by {key} to an instance of
348 // OrderedHashTable subclass {table}.
349 //
350 // Takes 3 functions:
351 // - {grow} generates code to return a OrderedHashTable subclass instance
352 // with space to store the entry.
353 // - {store_new_entry} generates code to store into a new entry, for the
354 // case when {table} didn't already have an entry keyed by {key}.
355 // - {store_existing_entry} generates code to store into an existing entry,
356 // for the case when {table} already has an entry keyed by {key}.
357 //
358 // Both {store_new_entry} and {store_existing_entry} take the table and an
359 // offset to the entry as parameters.
360 template <typename CollectionType>
361 using GrowCollection = std::function<const TNode<CollectionType>()>;
362 template <typename CollectionType>
363 using StoreAtEntry = std::function<void(const TNode<CollectionType> table,
364 const TNode<IntPtrT> entry_start)>;
365 template <typename CollectionType>
367 const TNode<CollectionType> table, const TNode<Object> key,
369 const StoreAtEntry<CollectionType>& store_at_new_entry,
370 const StoreAtEntry<CollectionType>& store_at_existing_entry);
371
372 template <typename CollectionType>
374 const TNode<Object> key,
376 Label* if_entry_found,
377 Label* if_not_found);
378
379 // Helper function to store a new entry when constructing sets from sets.
380 template <typename CollectionType>
382 const TNode<CollectionType> table, const TNode<Object> normalised_key,
383 const TNode<IntPtrT> number_of_buckets, const TNode<IntPtrT> occupancy,
384 const StoreAtEntry<CollectionType>& store_at_new_entry);
385
387 const TNode<JSAny> key,
388 const TNode<IntPtrT> number_of_buckets,
389 const TNode<IntPtrT> occupancy) {
390 TNode<JSAny> normalised_key = NormalizeNumberKey(key);
391 StoreAtEntry<OrderedHashSet> store_at_new_entry =
392 [this, normalised_key](const TNode<OrderedHashSet> table,
393 const TNode<IntPtrT> entry_start) {
394 UnsafeStoreKeyInOrderedHashSetEntry(table, normalised_key,
395 entry_start);
396 };
397 AddNewToOrderedHashTable<OrderedHashSet>(table, normalised_key,
398 number_of_buckets, occupancy,
399 store_at_new_entry);
400 }
401
402 // Generates code to store a new entry into {table}, connecting to the bucket
403 // chain, and updating the bucket head. {store_new_entry} is called to
404 // generate the code to store the payload (e.g., the key and value for
405 // OrderedHashMap).
406 template <typename CollectionType>
408 const TNode<CollectionType> table, const TNode<IntPtrT> hash,
409 const TNode<IntPtrT> number_of_buckets, const TNode<IntPtrT> occupancy,
410 const StoreAtEntry<CollectionType>& store_at_new_entry);
411
412 // Store payload (key, value, or both) in {table} at {entry}. Does not connect
413 // the bucket chain and update the bucket head.
415 const TNode<OrderedHashMap> table, const TNode<Object> value,
416 const TNode<IntPtrT> entry,
417 CheckBounds check_bounds = CheckBounds::kAlways);
419 const TNode<OrderedHashMap> table, const TNode<Object> key,
420 const TNode<Object> value, const TNode<IntPtrT> entry,
421 CheckBounds check_bounds = CheckBounds::kAlways);
423 const TNode<OrderedHashSet> table, const TNode<Object> key,
424 const TNode<IntPtrT> entry,
425 CheckBounds check_bounds = CheckBounds::kAlways);
426
428 const TNode<OrderedHashMap> table, const TNode<Object> key,
429 const TNode<Object> value, const TNode<IntPtrT> entry) {
430 return StoreKeyValueInOrderedHashMapEntry(table, key, value, entry,
432 }
439
441 const TNode<OrderedHashMap> table, const TNode<IntPtrT> entry,
442 CheckBounds check_bounds = CheckBounds::kAlways);
443
449
450 // Load payload (key or value) from {table} at {entry}.
451 template <typename CollectionType>
453 const TNode<CollectionType> table, const TNode<IntPtrT> entry,
454 CheckBounds check_bounds = CheckBounds::kAlways);
455
456 template <typename CollectionType>
462
463 // Create a JSArray with PACKED_ELEMENTS kind from a Map.prototype.keys() or
464 // Map.prototype.values() iterator. The iterator is assumed to satisfy
465 // IterableWithOriginalKeyOrValueMapIterator. This function will skip the
466 // iterator and iterate directly on the underlying hash table. In the end it
467 // will update the state of the iterator to 'exhausted'.
469 TNode<JSMapIterator> iterator);
470
471 // Create a JSArray with PACKED_ELEMENTS kind from a Set.prototype.keys() or
472 // Set.prototype.values() iterator, or a Set. The |iterable| is assumed to
473 // satisfy IterableWithOriginalValueSetIterator. This function will skip the
474 // iterator and iterate directly on the underlying hash table. In the end, if
475 // |iterable| is an iterator, it will update the state of the iterator to
476 // 'exhausted'.
478 TNode<HeapObject> iterable);
479
480 void BranchIfMapIteratorProtectorValid(Label* if_true, Label* if_false);
481 void BranchIfSetIteratorProtectorValid(Label* if_true, Label* if_false);
482
483 // Builds code that finds OrderedHashTable entry for a key with hash code
484 // {hash} with using the comparison code generated by {key_compare}. The code
485 // jumps to {entry_found} if the key is found, or to {not_found} if the key
486 // was not found. In the {entry_found} branch, the variable
487 // entry_start_position will be bound to the index of the entry (relative to
488 // OrderedHashTable::kHashTableStartIndex).
489 //
490 // The {CollectionType} template parameter stands for the particular instance
491 // of OrderedHashTable, it should be OrderedHashMap or OrderedHashSet.
492 template <typename CollectionType>
494 const TNode<CollectionType> table, const TNode<Uint32T> hash,
495 const std::function<void(TNode<Object>, Label*, Label*)>& key_compare,
496 TVariable<IntPtrT>* entry_start_position, Label* entry_found,
497 Label* not_found);
498
500};
501
503 public:
506
507 protected:
510 TNode<Int32T> number_of_elements);
511
513 TNode<IntPtrT> at_least_space_for) override;
514
516 // Generates and sets the identity for a JSRececiver.
520
521 // Builds code that finds the EphemeronHashTable entry for a {key} using the
522 // comparison code generated by {key_compare}. The key index is returned if
523 // the {key} is found.
525 std::function<void(TNode<Object> entry_key, Label* if_same)>;
527 TNode<IntPtrT> capacity,
528 const KeyComparator& key_compare);
529
530 // Builds code that finds an EphemeronHashTable entry available for a new
531 // entry.
533 TNode<IntPtrT> key_hash,
534 TNode<IntPtrT> capacity);
535
536 // Builds code that finds the EphemeronHashTable entry with key that matches
537 // {key} and returns the entry's key index. If {key} cannot be found, jumps to
538 // {if_not_found}.
540 TNode<IntPtrT> hash,
541 TNode<IntPtrT> capacity,
542 Label* if_not_found);
543
545 TNode<Int32T> number_of_elements,
546 TNode<Int32T> number_of_deleted);
548
550 int offset);
552 int offset = 0);
555
557 TNode<IntPtrT> number_of_elements);
558 TNode<BoolT> ShouldRehash(TNode<Int32T> number_of_elements,
559 TNode<Int32T> number_of_deleted);
561 TNode<IntPtrT> number_of_elements);
563
565 Variant variant, TNode<Object> initial_entries, TNode<Context> context,
566 TVariable<HeapObject>* var_entries_table,
567 TVariable<IntPtrT>* var_number_of_elements,
568 Label* if_not_fast_collection) override {
569 UNREACHABLE();
570 }
571
573 Variant variant, TNode<HeapObject> collection,
574 TNode<HeapObject> source_table) override {
575 UNREACHABLE();
576 }
577};
578
579// Controls the key coercion behavior for Object.groupBy and Map.groupBy.
581
582} // namespace internal
583} // namespace v8
584
585#endif // V8_BUILTINS_BUILTINS_COLLECTIONS_GEN_H_
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)
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)
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
Definition execution.cc:75
int32_t offset
TNode< Object > receiver
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
Definition map-inl.h:877