[CSA][cleanup] TNodify builtins collections gen (pt. 1)
TNodified several methods, such as the ones regarding CollectionType. Eliminated unneeded Context parameters Removed Sloppy-ness from TNodes. Bug: v8:6949, v8:9396 Change-Id: Ib4c7643957629b651aa39051f89a90bc70e215c9 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1803335 Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org> Reviewed-by: Mythri Alle <mythria@chromium.org> Cr-Commit-Position: refs/heads/master@{#63763}
This commit is contained in:
parent
b7cb606654
commit
f8e4b23adb
@ -79,8 +79,8 @@ class BaseCollectionsAssembler : public CodeStubAssembler {
|
|||||||
TNode<JSReceiver> new_target);
|
TNode<JSReceiver> new_target);
|
||||||
|
|
||||||
// Allocates the backing store for a collection.
|
// Allocates the backing store for a collection.
|
||||||
virtual TNode<Object> AllocateTable(Variant variant, TNode<Context> context,
|
virtual TNode<HeapObject> AllocateTable(
|
||||||
TNode<IntPtrT> at_least_space_for) = 0;
|
Variant variant, TNode<IntPtrT> at_least_space_for) = 0;
|
||||||
|
|
||||||
// Main entry point for a collection constructor builtin.
|
// Main entry point for a collection constructor builtin.
|
||||||
void GenerateConstructor(Variant variant,
|
void GenerateConstructor(Variant variant,
|
||||||
@ -122,7 +122,7 @@ class BaseCollectionsAssembler : public CodeStubAssembler {
|
|||||||
TNode<IntPtrT> EstimatedInitialSize(TNode<Object> initial_entries,
|
TNode<IntPtrT> EstimatedInitialSize(TNode<Object> initial_entries,
|
||||||
TNode<BoolT> is_fast_jsarray);
|
TNode<BoolT> is_fast_jsarray);
|
||||||
|
|
||||||
void GotoIfNotJSReceiver(Node* const obj, Label* if_not_receiver);
|
void GotoIfNotJSReceiver(TNode<Object> const obj, Label* if_not_receiver);
|
||||||
|
|
||||||
// Determines whether the collection's prototype has been modified.
|
// Determines whether the collection's prototype has been modified.
|
||||||
TNode<BoolT> HasInitialCollectionPrototype(Variant variant,
|
TNode<BoolT> HasInitialCollectionPrototype(Variant variant,
|
||||||
@ -158,8 +158,8 @@ void BaseCollectionsAssembler::AddConstructorEntry(
|
|||||||
? LoadKeyValuePairNoSideEffects(context, key_value,
|
? LoadKeyValuePairNoSideEffects(context, key_value,
|
||||||
if_may_have_side_effects)
|
if_may_have_side_effects)
|
||||||
: LoadKeyValuePair(context, key_value);
|
: LoadKeyValuePair(context, key_value);
|
||||||
Node* key_n = pair.key;
|
TNode<Object> key_n = pair.key;
|
||||||
Node* value_n = pair.value;
|
TNode<Object> value_n = pair.value;
|
||||||
CallJS(CodeFactory::Call(isolate()), context, add_function, collection,
|
CallJS(CodeFactory::Call(isolate()), context, add_function, collection,
|
||||||
key_n, value_n);
|
key_n, value_n);
|
||||||
} else {
|
} else {
|
||||||
@ -181,7 +181,7 @@ void BaseCollectionsAssembler::AddConstructorEntries(
|
|||||||
Goto(&allocate_table);
|
Goto(&allocate_table);
|
||||||
BIND(&allocate_table);
|
BIND(&allocate_table);
|
||||||
{
|
{
|
||||||
TNode<Object> table = AllocateTable(variant, context, at_least_space_for);
|
TNode<HeapObject> table = AllocateTable(variant, at_least_space_for);
|
||||||
StoreObjectField(collection, GetTableOffset(variant), table);
|
StoreObjectField(collection, GetTableOffset(variant), table);
|
||||||
GotoIf(IsNullOrUndefined(initial_entries), &exit);
|
GotoIf(IsNullOrUndefined(initial_entries), &exit);
|
||||||
GotoIfInitialAddFunctionModified(variant, CAST(native_context),
|
GotoIfInitialAddFunctionModified(variant, CAST(native_context),
|
||||||
@ -521,10 +521,10 @@ TNode<IntPtrT> BaseCollectionsAssembler::EstimatedInitialSize(
|
|||||||
[=] { return IntPtrConstant(0); });
|
[=] { return IntPtrConstant(0); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseCollectionsAssembler::GotoIfNotJSReceiver(Node* const obj,
|
void BaseCollectionsAssembler::GotoIfNotJSReceiver(TNode<Object> const obj,
|
||||||
Label* if_not_receiver) {
|
Label* if_not_receiver) {
|
||||||
GotoIf(TaggedIsSmi(obj), if_not_receiver);
|
GotoIf(TaggedIsSmi(obj), if_not_receiver);
|
||||||
GotoIfNot(IsJSReceiver(obj), if_not_receiver);
|
GotoIfNot(IsJSReceiver(CAST(obj)), if_not_receiver);
|
||||||
}
|
}
|
||||||
|
|
||||||
TNode<Map> BaseCollectionsAssembler::GetInitialCollectionPrototype(
|
TNode<Map> BaseCollectionsAssembler::GetInitialCollectionPrototype(
|
||||||
@ -606,13 +606,14 @@ class CollectionsBuiltinsAssembler : public BaseCollectionsAssembler {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
template <typename IteratorType>
|
template <typename IteratorType>
|
||||||
Node* AllocateJSCollectionIterator(SloppyTNode<Context> context,
|
TNode<HeapObject> AllocateJSCollectionIterator(
|
||||||
int map_index, Node* collection);
|
const TNode<Context> context, int map_index,
|
||||||
TNode<Object> AllocateTable(Variant variant, TNode<Context> context,
|
const TNode<HeapObject> collection);
|
||||||
|
TNode<HeapObject> AllocateTable(Variant variant,
|
||||||
TNode<IntPtrT> at_least_space_for) override;
|
TNode<IntPtrT> at_least_space_for) override;
|
||||||
TNode<IntPtrT> GetHash(SloppyTNode<HeapObject> const key);
|
TNode<IntPtrT> GetHash(const TNode<HeapObject> key);
|
||||||
TNode<IntPtrT> CallGetHashRaw(SloppyTNode<HeapObject> const key);
|
TNode<IntPtrT> CallGetHashRaw(const TNode<HeapObject> key);
|
||||||
TNode<Smi> CallGetOrCreateHashRaw(SloppyTNode<HeapObject> const key);
|
TNode<Smi> CallGetOrCreateHashRaw(const TNode<HeapObject> key);
|
||||||
|
|
||||||
// Transitions the iterator to the non obsolete backing store.
|
// Transitions the iterator to the non obsolete backing store.
|
||||||
// This is a NOP if the [table] is not obsolete.
|
// This is a NOP if the [table] is not obsolete.
|
||||||
@ -633,25 +634,23 @@ class CollectionsBuiltinsAssembler : public BaseCollectionsAssembler {
|
|||||||
// The {result} variable will contain the entry index if the key was found,
|
// The {result} variable will contain the entry index if the key was found,
|
||||||
// or the hash code otherwise.
|
// or the hash code otherwise.
|
||||||
template <typename CollectionType>
|
template <typename CollectionType>
|
||||||
void FindOrderedHashTableEntryForSmiKey(Node* table,
|
void FindOrderedHashTableEntryForSmiKey(TNode<CollectionType> table,
|
||||||
SloppyTNode<Smi> key_tagged,
|
TNode<Smi> key_tagged,
|
||||||
Variable* result, Label* entry_found,
|
TVariable<IntPtrT>* result,
|
||||||
Label* not_found);
|
Label* entry_found, Label* not_found);
|
||||||
void SameValueZeroSmi(SloppyTNode<Smi> key_smi,
|
void SameValueZeroSmi(TNode<Smi> key_smi, TNode<Object> candidate_key,
|
||||||
SloppyTNode<Object> candidate_key, Label* if_same,
|
Label* if_same, Label* if_not_same);
|
||||||
Label* if_not_same);
|
|
||||||
|
|
||||||
// Specialization for heap numbers.
|
// Specialization for heap numbers.
|
||||||
// The {result} variable will contain the entry index if the key was found,
|
// The {result} variable will contain the entry index if the key was found,
|
||||||
// or the hash code otherwise.
|
// or the hash code otherwise.
|
||||||
void SameValueZeroHeapNumber(SloppyTNode<Float64T> key_float,
|
void SameValueZeroHeapNumber(TNode<Float64T> key_float,
|
||||||
SloppyTNode<Object> candidate_key,
|
TNode<Object> candidate_key, Label* if_same,
|
||||||
Label* if_same, Label* if_not_same);
|
Label* if_not_same);
|
||||||
template <typename CollectionType>
|
template <typename CollectionType>
|
||||||
void FindOrderedHashTableEntryForHeapNumberKey(
|
void FindOrderedHashTableEntryForHeapNumberKey(
|
||||||
SloppyTNode<Context> context, Node* table,
|
TNode<CollectionType> table, TNode<HeapNumber> key_heap_number,
|
||||||
SloppyTNode<HeapNumber> key_heap_number, Variable* result,
|
TVariable<IntPtrT>* result, Label* entry_found, Label* not_found);
|
||||||
Label* entry_found, Label* not_found);
|
|
||||||
|
|
||||||
// Specialization for bigints.
|
// Specialization for bigints.
|
||||||
// The {result} variable will contain the entry index if the key was found,
|
// The {result} variable will contain the entry index if the key was found,
|
||||||
@ -659,9 +658,9 @@ class CollectionsBuiltinsAssembler : public BaseCollectionsAssembler {
|
|||||||
void SameValueZeroBigInt(Node* key, Node* candidate_key, Label* if_same,
|
void SameValueZeroBigInt(Node* key, Node* candidate_key, Label* if_same,
|
||||||
Label* if_not_same);
|
Label* if_not_same);
|
||||||
template <typename CollectionType>
|
template <typename CollectionType>
|
||||||
void FindOrderedHashTableEntryForBigIntKey(SloppyTNode<Context> context,
|
void FindOrderedHashTableEntryForBigIntKey(TNode<CollectionType> table,
|
||||||
Node* table, Node* key,
|
TNode<BigInt> key_big_int,
|
||||||
Variable* result,
|
TVariable<IntPtrT>* result,
|
||||||
Label* entry_found,
|
Label* entry_found,
|
||||||
Label* not_found);
|
Label* not_found);
|
||||||
|
|
||||||
@ -669,14 +668,14 @@ class CollectionsBuiltinsAssembler : public BaseCollectionsAssembler {
|
|||||||
// The {result} variable will contain the entry index if the key was found,
|
// The {result} variable will contain the entry index if the key was found,
|
||||||
// or the hash code otherwise.
|
// or the hash code otherwise.
|
||||||
template <typename CollectionType>
|
template <typename CollectionType>
|
||||||
void FindOrderedHashTableEntryForStringKey(
|
void FindOrderedHashTableEntryForStringKey(TNode<CollectionType> table,
|
||||||
SloppyTNode<Context> context, Node* table, SloppyTNode<String> key_tagged,
|
TNode<String> key_tagged,
|
||||||
Variable* result, Label* entry_found, Label* not_found);
|
TVariable<IntPtrT>* result,
|
||||||
TNode<IntPtrT> ComputeStringHash(TNode<Context> context,
|
Label* entry_found,
|
||||||
TNode<String> string_key);
|
Label* not_found);
|
||||||
void SameValueZeroString(SloppyTNode<Context> context,
|
TNode<IntPtrT> ComputeStringHash(TNode<String> string_key);
|
||||||
SloppyTNode<String> key_string,
|
void SameValueZeroString(TNode<String> key_string,
|
||||||
SloppyTNode<Object> candidate_key, Label* if_same,
|
TNode<Object> candidate_key, Label* if_same,
|
||||||
Label* if_not_same);
|
Label* if_not_same);
|
||||||
|
|
||||||
// Specialization for non-strings, non-numbers. For those we only need
|
// Specialization for non-strings, non-numbers. For those we only need
|
||||||
@ -685,17 +684,20 @@ class CollectionsBuiltinsAssembler : public BaseCollectionsAssembler {
|
|||||||
// or the hash code otherwise. If the hash-code has not been computed, it
|
// or the hash code otherwise. If the hash-code has not been computed, it
|
||||||
// should be Smi -1.
|
// should be Smi -1.
|
||||||
template <typename CollectionType>
|
template <typename CollectionType>
|
||||||
void FindOrderedHashTableEntryForOtherKey(
|
void FindOrderedHashTableEntryForOtherKey(TNode<CollectionType> table,
|
||||||
SloppyTNode<Context> context, Node* table, SloppyTNode<HeapObject> key,
|
TNode<HeapObject> key_heap_object,
|
||||||
Variable* result, Label* entry_found, Label* not_found);
|
TVariable<IntPtrT>* result,
|
||||||
|
Label* entry_found,
|
||||||
|
Label* not_found);
|
||||||
|
|
||||||
template <typename CollectionType>
|
template <typename CollectionType>
|
||||||
void TryLookupOrderedHashTableIndex(Node* const table, Node* const key,
|
void TryLookupOrderedHashTableIndex(const TNode<CollectionType> table,
|
||||||
Node* const context, Variable* result,
|
const TNode<Object> key,
|
||||||
|
TVariable<IntPtrT>* result,
|
||||||
Label* if_entry_found,
|
Label* if_entry_found,
|
||||||
Label* if_not_found);
|
Label* if_not_found);
|
||||||
|
|
||||||
Node* NormalizeNumberKey(Node* key);
|
const TNode<Object> NormalizeNumberKey(const TNode<Object> key);
|
||||||
void StoreOrderedHashMapNewEntry(TNode<OrderedHashMap> const table,
|
void StoreOrderedHashMapNewEntry(TNode<OrderedHashMap> const table,
|
||||||
Node* const key, Node* const value,
|
Node* const key, Node* const value,
|
||||||
Node* const hash,
|
Node* const hash,
|
||||||
@ -728,8 +730,9 @@ class CollectionsBuiltinsAssembler : public BaseCollectionsAssembler {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename IteratorType>
|
template <typename IteratorType>
|
||||||
Node* CollectionsBuiltinsAssembler::AllocateJSCollectionIterator(
|
TNode<HeapObject> CollectionsBuiltinsAssembler::AllocateJSCollectionIterator(
|
||||||
SloppyTNode<Context> context, int map_index, Node* collection) {
|
TNode<Context> const context, int map_index,
|
||||||
|
TNode<HeapObject> const collection) {
|
||||||
TNode<Object> const table =
|
TNode<Object> const table =
|
||||||
LoadObjectField(collection, JSCollection::kTableOffset);
|
LoadObjectField(collection, JSCollection::kTableOffset);
|
||||||
TNode<NativeContext> const native_context = LoadNativeContext(context);
|
TNode<NativeContext> const native_context = LoadNativeContext(context);
|
||||||
@ -747,9 +750,8 @@ Node* CollectionsBuiltinsAssembler::AllocateJSCollectionIterator(
|
|||||||
return iterator;
|
return iterator;
|
||||||
}
|
}
|
||||||
|
|
||||||
TNode<Object> CollectionsBuiltinsAssembler::AllocateTable(
|
TNode<HeapObject> CollectionsBuiltinsAssembler::AllocateTable(
|
||||||
Variant variant, TNode<Context> context,
|
Variant variant, TNode<IntPtrT> at_least_space_for) {
|
||||||
TNode<IntPtrT> at_least_space_for) {
|
|
||||||
return CAST((variant == kMap || variant == kWeakMap)
|
return CAST((variant == kMap || variant == kWeakMap)
|
||||||
? AllocateOrderedHashTable<OrderedHashMap>()
|
? AllocateOrderedHashTable<OrderedHashMap>()
|
||||||
: AllocateOrderedHashTable<OrderedHashSet>());
|
: AllocateOrderedHashTable<OrderedHashSet>());
|
||||||
@ -776,7 +778,7 @@ TF_BUILTIN(SetConstructor, CollectionsBuiltinsAssembler) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TNode<Smi> CollectionsBuiltinsAssembler::CallGetOrCreateHashRaw(
|
TNode<Smi> CollectionsBuiltinsAssembler::CallGetOrCreateHashRaw(
|
||||||
SloppyTNode<HeapObject> const key) {
|
const TNode<HeapObject> key) {
|
||||||
TNode<ExternalReference> const function_addr =
|
TNode<ExternalReference> const function_addr =
|
||||||
ExternalConstant(ExternalReference::get_or_create_hash_raw());
|
ExternalConstant(ExternalReference::get_or_create_hash_raw());
|
||||||
TNode<ExternalReference> const isolate_ptr =
|
TNode<ExternalReference> const isolate_ptr =
|
||||||
@ -793,7 +795,7 @@ TNode<Smi> CollectionsBuiltinsAssembler::CallGetOrCreateHashRaw(
|
|||||||
}
|
}
|
||||||
|
|
||||||
TNode<IntPtrT> CollectionsBuiltinsAssembler::CallGetHashRaw(
|
TNode<IntPtrT> CollectionsBuiltinsAssembler::CallGetHashRaw(
|
||||||
SloppyTNode<HeapObject> const key) {
|
const TNode<HeapObject> key) {
|
||||||
TNode<ExternalReference> const function_addr =
|
TNode<ExternalReference> const function_addr =
|
||||||
ExternalConstant(ExternalReference::orderedhashmap_gethash_raw());
|
ExternalConstant(ExternalReference::orderedhashmap_gethash_raw());
|
||||||
TNode<ExternalReference> const isolate_ptr =
|
TNode<ExternalReference> const isolate_ptr =
|
||||||
@ -810,7 +812,7 @@ TNode<IntPtrT> CollectionsBuiltinsAssembler::CallGetHashRaw(
|
|||||||
}
|
}
|
||||||
|
|
||||||
TNode<IntPtrT> CollectionsBuiltinsAssembler::GetHash(
|
TNode<IntPtrT> CollectionsBuiltinsAssembler::GetHash(
|
||||||
SloppyTNode<HeapObject> const key) {
|
const TNode<HeapObject> key) {
|
||||||
TVARIABLE(IntPtrT, var_hash);
|
TVARIABLE(IntPtrT, var_hash);
|
||||||
Label if_receiver(this), if_other(this), done(this);
|
Label if_receiver(this), if_other(this), done(this);
|
||||||
Branch(IsJSReceiver(key), &if_receiver, &if_other);
|
Branch(IsJSReceiver(key), &if_receiver, &if_other);
|
||||||
@ -831,8 +833,9 @@ TNode<IntPtrT> CollectionsBuiltinsAssembler::GetHash(
|
|||||||
return var_hash.value();
|
return var_hash.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionsBuiltinsAssembler::SameValueZeroSmi(
|
void CollectionsBuiltinsAssembler::SameValueZeroSmi(TNode<Smi> key_smi,
|
||||||
SloppyTNode<Smi> key_smi, SloppyTNode<Object> candidate_key, Label* if_same,
|
TNode<Object> candidate_key,
|
||||||
|
Label* if_same,
|
||||||
Label* if_not_same) {
|
Label* if_not_same) {
|
||||||
// If the key is the same, we are done.
|
// If the key is the same, we are done.
|
||||||
GotoIf(TaggedEqual(candidate_key, key_smi), if_same);
|
GotoIf(TaggedEqual(candidate_key, key_smi), if_same);
|
||||||
@ -1162,13 +1165,13 @@ TF_BUILTIN(SetOrSetIteratorToList, CollectionsBuiltinsAssembler) {
|
|||||||
|
|
||||||
template <typename CollectionType>
|
template <typename CollectionType>
|
||||||
void CollectionsBuiltinsAssembler::FindOrderedHashTableEntryForSmiKey(
|
void CollectionsBuiltinsAssembler::FindOrderedHashTableEntryForSmiKey(
|
||||||
Node* table, SloppyTNode<Smi> smi_key, Variable* result, Label* entry_found,
|
TNode<CollectionType> table, TNode<Smi> smi_key, TVariable<IntPtrT>* result,
|
||||||
Label* not_found) {
|
Label* entry_found, Label* not_found) {
|
||||||
TNode<IntPtrT> const key_untagged = SmiUntag(smi_key);
|
TNode<IntPtrT> const key_untagged = SmiUntag(smi_key);
|
||||||
TNode<IntPtrT> const hash =
|
TNode<IntPtrT> const hash =
|
||||||
ChangeInt32ToIntPtr(ComputeUnseededHash(key_untagged));
|
ChangeInt32ToIntPtr(ComputeUnseededHash(key_untagged));
|
||||||
CSA_ASSERT(this, IntPtrGreaterThanOrEqual(hash, IntPtrConstant(0)));
|
CSA_ASSERT(this, IntPtrGreaterThanOrEqual(hash, IntPtrConstant(0)));
|
||||||
result->Bind(hash);
|
*result = hash;
|
||||||
FindOrderedHashTableEntry<CollectionType>(
|
FindOrderedHashTableEntry<CollectionType>(
|
||||||
table, hash,
|
table, hash,
|
||||||
[&](TNode<Object> other_key, Label* if_same, Label* if_not_same) {
|
[&](TNode<Object> other_key, Label* if_same, Label* if_not_same) {
|
||||||
@ -1179,28 +1182,26 @@ void CollectionsBuiltinsAssembler::FindOrderedHashTableEntryForSmiKey(
|
|||||||
|
|
||||||
template <typename CollectionType>
|
template <typename CollectionType>
|
||||||
void CollectionsBuiltinsAssembler::FindOrderedHashTableEntryForStringKey(
|
void CollectionsBuiltinsAssembler::FindOrderedHashTableEntryForStringKey(
|
||||||
SloppyTNode<Context> context, Node* table, SloppyTNode<String> key_tagged,
|
TNode<CollectionType> table, TNode<String> key_tagged,
|
||||||
Variable* result, Label* entry_found, Label* not_found) {
|
TVariable<IntPtrT>* result, Label* entry_found, Label* not_found) {
|
||||||
TNode<IntPtrT> const hash = ComputeStringHash(context, key_tagged);
|
TNode<IntPtrT> const hash = ComputeStringHash(key_tagged);
|
||||||
CSA_ASSERT(this, IntPtrGreaterThanOrEqual(hash, IntPtrConstant(0)));
|
CSA_ASSERT(this, IntPtrGreaterThanOrEqual(hash, IntPtrConstant(0)));
|
||||||
result->Bind(hash);
|
*result = hash;
|
||||||
FindOrderedHashTableEntry<CollectionType>(
|
FindOrderedHashTableEntry<CollectionType>(
|
||||||
table, hash,
|
table, hash,
|
||||||
[&](TNode<Object> other_key, Label* if_same, Label* if_not_same) {
|
[&](TNode<Object> other_key, Label* if_same, Label* if_not_same) {
|
||||||
SameValueZeroString(context, key_tagged, other_key, if_same,
|
SameValueZeroString(key_tagged, other_key, if_same, if_not_same);
|
||||||
if_not_same);
|
|
||||||
},
|
},
|
||||||
result, entry_found, not_found);
|
result, entry_found, not_found);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename CollectionType>
|
template <typename CollectionType>
|
||||||
void CollectionsBuiltinsAssembler::FindOrderedHashTableEntryForHeapNumberKey(
|
void CollectionsBuiltinsAssembler::FindOrderedHashTableEntryForHeapNumberKey(
|
||||||
SloppyTNode<Context> context, Node* table,
|
TNode<CollectionType> table, TNode<HeapNumber> key_heap_number,
|
||||||
SloppyTNode<HeapNumber> key_heap_number, Variable* result,
|
TVariable<IntPtrT>* result, Label* entry_found, Label* not_found) {
|
||||||
Label* entry_found, Label* not_found) {
|
|
||||||
TNode<IntPtrT> const hash = CallGetHashRaw(key_heap_number);
|
TNode<IntPtrT> const hash = CallGetHashRaw(key_heap_number);
|
||||||
CSA_ASSERT(this, IntPtrGreaterThanOrEqual(hash, IntPtrConstant(0)));
|
CSA_ASSERT(this, IntPtrGreaterThanOrEqual(hash, IntPtrConstant(0)));
|
||||||
result->Bind(hash);
|
*result = hash;
|
||||||
TNode<Float64T> const key_float = LoadHeapNumberValue(key_heap_number);
|
TNode<Float64T> const key_float = LoadHeapNumberValue(key_heap_number);
|
||||||
FindOrderedHashTableEntry<CollectionType>(
|
FindOrderedHashTableEntry<CollectionType>(
|
||||||
table, hash,
|
table, hash,
|
||||||
@ -1212,36 +1213,36 @@ void CollectionsBuiltinsAssembler::FindOrderedHashTableEntryForHeapNumberKey(
|
|||||||
|
|
||||||
template <typename CollectionType>
|
template <typename CollectionType>
|
||||||
void CollectionsBuiltinsAssembler::FindOrderedHashTableEntryForBigIntKey(
|
void CollectionsBuiltinsAssembler::FindOrderedHashTableEntryForBigIntKey(
|
||||||
SloppyTNode<Context> context, Node* table, Node* key, Variable* result,
|
TNode<CollectionType> table, TNode<BigInt> key_big_int,
|
||||||
Label* entry_found, Label* not_found) {
|
TVariable<IntPtrT>* result, Label* entry_found, Label* not_found) {
|
||||||
TNode<IntPtrT> const hash = CallGetHashRaw(key);
|
TNode<IntPtrT> const hash = CallGetHashRaw(key_big_int);
|
||||||
CSA_ASSERT(this, IntPtrGreaterThanOrEqual(hash, IntPtrConstant(0)));
|
CSA_ASSERT(this, IntPtrGreaterThanOrEqual(hash, IntPtrConstant(0)));
|
||||||
result->Bind(hash);
|
*result = hash;
|
||||||
FindOrderedHashTableEntry<CollectionType>(
|
FindOrderedHashTableEntry<CollectionType>(
|
||||||
table, hash,
|
table, hash,
|
||||||
[&](TNode<Object> other_key, Label* if_same, Label* if_not_same) {
|
[&](TNode<Object> other_key, Label* if_same, Label* if_not_same) {
|
||||||
SameValueZeroBigInt(key, other_key, if_same, if_not_same);
|
SameValueZeroBigInt(key_big_int, other_key, if_same, if_not_same);
|
||||||
},
|
},
|
||||||
result, entry_found, not_found);
|
result, entry_found, not_found);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename CollectionType>
|
template <typename CollectionType>
|
||||||
void CollectionsBuiltinsAssembler::FindOrderedHashTableEntryForOtherKey(
|
void CollectionsBuiltinsAssembler::FindOrderedHashTableEntryForOtherKey(
|
||||||
SloppyTNode<Context> context, Node* table, SloppyTNode<HeapObject> key,
|
TNode<CollectionType> table, TNode<HeapObject> key_heap_object,
|
||||||
Variable* result, Label* entry_found, Label* not_found) {
|
TVariable<IntPtrT>* result, Label* entry_found, Label* not_found) {
|
||||||
TNode<IntPtrT> const hash = GetHash(key);
|
TNode<IntPtrT> const hash = GetHash(key_heap_object);
|
||||||
CSA_ASSERT(this, IntPtrGreaterThanOrEqual(hash, IntPtrConstant(0)));
|
CSA_ASSERT(this, IntPtrGreaterThanOrEqual(hash, IntPtrConstant(0)));
|
||||||
result->Bind(hash);
|
*result = hash;
|
||||||
FindOrderedHashTableEntry<CollectionType>(
|
FindOrderedHashTableEntry<CollectionType>(
|
||||||
table, hash,
|
table, hash,
|
||||||
[&](TNode<Object> other_key, Label* if_same, Label* if_not_same) {
|
[&](TNode<Object> other_key, Label* if_same, Label* if_not_same) {
|
||||||
Branch(TaggedEqual(key, other_key), if_same, if_not_same);
|
Branch(TaggedEqual(key_heap_object, other_key), if_same, if_not_same);
|
||||||
},
|
},
|
||||||
result, entry_found, not_found);
|
result, entry_found, not_found);
|
||||||
}
|
}
|
||||||
|
|
||||||
TNode<IntPtrT> CollectionsBuiltinsAssembler::ComputeStringHash(
|
TNode<IntPtrT> CollectionsBuiltinsAssembler::ComputeStringHash(
|
||||||
TNode<Context> context, TNode<String> string_key) {
|
TNode<String> string_key) {
|
||||||
TVARIABLE(IntPtrT, var_result);
|
TVARIABLE(IntPtrT, var_result);
|
||||||
|
|
||||||
Label hash_not_computed(this), done(this, &var_result);
|
Label hash_not_computed(this), done(this, &var_result);
|
||||||
@ -1259,14 +1260,14 @@ TNode<IntPtrT> CollectionsBuiltinsAssembler::ComputeStringHash(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CollectionsBuiltinsAssembler::SameValueZeroString(
|
void CollectionsBuiltinsAssembler::SameValueZeroString(
|
||||||
SloppyTNode<Context> context, SloppyTNode<String> key_string,
|
TNode<String> key_string, TNode<Object> candidate_key, Label* if_same,
|
||||||
SloppyTNode<Object> candidate_key, Label* if_same, Label* if_not_same) {
|
Label* if_not_same) {
|
||||||
// If the candidate is not a string, the keys are not equal.
|
// If the candidate is not a string, the keys are not equal.
|
||||||
GotoIf(TaggedIsSmi(candidate_key), if_not_same);
|
GotoIf(TaggedIsSmi(candidate_key), if_not_same);
|
||||||
GotoIfNot(IsString(CAST(candidate_key)), if_not_same);
|
GotoIfNot(IsString(CAST(candidate_key)), if_not_same);
|
||||||
|
|
||||||
Branch(TaggedEqual(CallBuiltin(Builtins::kStringEqual, context, key_string,
|
Branch(TaggedEqual(CallBuiltin(Builtins::kStringEqual, NoContextConstant(),
|
||||||
candidate_key),
|
key_string, candidate_key),
|
||||||
TrueConstant()),
|
TrueConstant()),
|
||||||
if_same, if_not_same);
|
if_same, if_not_same);
|
||||||
}
|
}
|
||||||
@ -1286,8 +1287,8 @@ void CollectionsBuiltinsAssembler::SameValueZeroBigInt(Node* key,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CollectionsBuiltinsAssembler::SameValueZeroHeapNumber(
|
void CollectionsBuiltinsAssembler::SameValueZeroHeapNumber(
|
||||||
SloppyTNode<Float64T> key_float, SloppyTNode<Object> candidate_key,
|
TNode<Float64T> key_float, TNode<Object> candidate_key, Label* if_same,
|
||||||
Label* if_same, Label* if_not_same) {
|
Label* if_not_same) {
|
||||||
Label if_smi(this), if_keyisnan(this);
|
Label if_smi(this), if_keyisnan(this);
|
||||||
|
|
||||||
GotoIf(TaggedIsSmi(candidate_key), &if_smi);
|
GotoIf(TaggedIsSmi(candidate_key), &if_smi);
|
||||||
@ -1458,13 +1459,14 @@ CollectionsBuiltinsAssembler::NextSkipHoles(TNode<TableType> table,
|
|||||||
}
|
}
|
||||||
|
|
||||||
TF_BUILTIN(MapPrototypeGet, CollectionsBuiltinsAssembler) {
|
TF_BUILTIN(MapPrototypeGet, CollectionsBuiltinsAssembler) {
|
||||||
Node* const receiver = Parameter(Descriptor::kReceiver);
|
const TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
|
||||||
Node* const key = Parameter(Descriptor::kKey);
|
const TNode<Object> key = CAST(Parameter(Descriptor::kKey));
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
const TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||||
|
|
||||||
ThrowIfNotInstanceType(context, receiver, JS_MAP_TYPE, "Map.prototype.get");
|
ThrowIfNotInstanceType(context, receiver, JS_MAP_TYPE, "Map.prototype.get");
|
||||||
|
|
||||||
TNode<Object> const table = LoadObjectField(receiver, JSMap::kTableOffset);
|
TNode<Object> const table =
|
||||||
|
LoadObjectField<Object>(CAST(receiver), JSMap::kTableOffset);
|
||||||
TNode<Smi> index = CAST(
|
TNode<Smi> index = CAST(
|
||||||
CallBuiltin(Builtins::kFindOrderedHashMapEntry, context, table, key));
|
CallBuiltin(Builtins::kFindOrderedHashMapEntry, context, table, key));
|
||||||
|
|
||||||
@ -1483,13 +1485,14 @@ TF_BUILTIN(MapPrototypeGet, CollectionsBuiltinsAssembler) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TF_BUILTIN(MapPrototypeHas, CollectionsBuiltinsAssembler) {
|
TF_BUILTIN(MapPrototypeHas, CollectionsBuiltinsAssembler) {
|
||||||
Node* const receiver = Parameter(Descriptor::kReceiver);
|
const TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
|
||||||
Node* const key = Parameter(Descriptor::kKey);
|
const TNode<Object> key = CAST(Parameter(Descriptor::kKey));
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
const TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||||
|
|
||||||
ThrowIfNotInstanceType(context, receiver, JS_MAP_TYPE, "Map.prototype.has");
|
ThrowIfNotInstanceType(context, receiver, JS_MAP_TYPE, "Map.prototype.has");
|
||||||
|
|
||||||
TNode<Object> const table = LoadObjectField(receiver, JSMap::kTableOffset);
|
TNode<Object> const table =
|
||||||
|
LoadObjectField(CAST(receiver), JSMap::kTableOffset);
|
||||||
TNode<Smi> index = CAST(
|
TNode<Smi> index = CAST(
|
||||||
CallBuiltin(Builtins::kFindOrderedHashMapEntry, context, table, key));
|
CallBuiltin(Builtins::kFindOrderedHashMapEntry, context, table, key));
|
||||||
|
|
||||||
@ -1504,17 +1507,18 @@ TF_BUILTIN(MapPrototypeHas, CollectionsBuiltinsAssembler) {
|
|||||||
Return(FalseConstant());
|
Return(FalseConstant());
|
||||||
}
|
}
|
||||||
|
|
||||||
Node* CollectionsBuiltinsAssembler::NormalizeNumberKey(Node* const key) {
|
const TNode<Object> CollectionsBuiltinsAssembler::NormalizeNumberKey(
|
||||||
VARIABLE(result, MachineRepresentation::kTagged, key);
|
const TNode<Object> key) {
|
||||||
|
TVARIABLE(Object, result, key);
|
||||||
Label done(this);
|
Label done(this);
|
||||||
|
|
||||||
GotoIf(TaggedIsSmi(key), &done);
|
GotoIf(TaggedIsSmi(key), &done);
|
||||||
GotoIfNot(IsHeapNumber(key), &done);
|
GotoIfNot(IsHeapNumber(CAST(key)), &done);
|
||||||
TNode<Float64T> const number = LoadHeapNumberValue(key);
|
TNode<Float64T> const number = LoadHeapNumberValue(CAST(key));
|
||||||
GotoIfNot(Float64Equal(number, Float64Constant(0.0)), &done);
|
GotoIfNot(Float64Equal(number, Float64Constant(0.0)), &done);
|
||||||
// We know the value is zero, so we take the key to be Smi 0.
|
// We know the value is zero, so we take the key to be Smi 0.
|
||||||
// Another option would be to normalize to Smi here.
|
// Another option would be to normalize to Smi here.
|
||||||
result.Bind(SmiConstant(0));
|
result = SmiConstant(0);
|
||||||
Goto(&done);
|
Goto(&done);
|
||||||
|
|
||||||
BIND(&done);
|
BIND(&done);
|
||||||
@ -1522,25 +1526,23 @@ Node* CollectionsBuiltinsAssembler::NormalizeNumberKey(Node* const key) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TF_BUILTIN(MapPrototypeSet, CollectionsBuiltinsAssembler) {
|
TF_BUILTIN(MapPrototypeSet, CollectionsBuiltinsAssembler) {
|
||||||
Node* const receiver = Parameter(Descriptor::kReceiver);
|
const TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
|
||||||
Node* key = Parameter(Descriptor::kKey);
|
TNode<Object> key = CAST(Parameter(Descriptor::kKey));
|
||||||
Node* const value = Parameter(Descriptor::kValue);
|
const TNode<Object> value = CAST(Parameter(Descriptor::kValue));
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
const TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||||
|
|
||||||
ThrowIfNotInstanceType(context, receiver, JS_MAP_TYPE, "Map.prototype.set");
|
ThrowIfNotInstanceType(context, receiver, JS_MAP_TYPE, "Map.prototype.set");
|
||||||
|
|
||||||
key = NormalizeNumberKey(key);
|
key = NormalizeNumberKey(key);
|
||||||
|
|
||||||
TNode<OrderedHashMap> const table =
|
TNode<OrderedHashMap> const table =
|
||||||
CAST(LoadObjectField(receiver, JSMap::kTableOffset));
|
LoadObjectField<OrderedHashMap>(CAST(receiver), JSMap::kTableOffset);
|
||||||
|
|
||||||
VARIABLE(entry_start_position_or_hash, MachineType::PointerRepresentation(),
|
TVARIABLE(IntPtrT, entry_start_position_or_hash, IntPtrConstant(0));
|
||||||
IntPtrConstant(0));
|
|
||||||
Label entry_found(this), not_found(this);
|
Label entry_found(this), not_found(this);
|
||||||
|
|
||||||
TryLookupOrderedHashTableIndex<OrderedHashMap>(table, key, context,
|
TryLookupOrderedHashTableIndex<OrderedHashMap>(
|
||||||
&entry_start_position_or_hash,
|
table, key, &entry_start_position_or_hash, &entry_found, ¬_found);
|
||||||
&entry_found, ¬_found);
|
|
||||||
|
|
||||||
BIND(&entry_found);
|
BIND(&entry_found);
|
||||||
// If we found the entry, we just store the value there.
|
// If we found the entry, we just store the value there.
|
||||||
@ -1559,7 +1561,7 @@ TF_BUILTIN(MapPrototypeSet, CollectionsBuiltinsAssembler) {
|
|||||||
&add_entry);
|
&add_entry);
|
||||||
|
|
||||||
// Otherwise, go to runtime to compute the hash code.
|
// Otherwise, go to runtime to compute the hash code.
|
||||||
entry_start_position_or_hash.Bind(SmiUntag(CallGetOrCreateHashRaw(key)));
|
entry_start_position_or_hash = SmiUntag(CallGetOrCreateHashRaw(CAST(key)));
|
||||||
Goto(&add_entry);
|
Goto(&add_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1584,7 +1586,8 @@ TF_BUILTIN(MapPrototypeSet, CollectionsBuiltinsAssembler) {
|
|||||||
// We do not have enough space, grow the table and reload the relevant
|
// We do not have enough space, grow the table and reload the relevant
|
||||||
// fields.
|
// fields.
|
||||||
CallRuntime(Runtime::kMapGrow, context, receiver);
|
CallRuntime(Runtime::kMapGrow, context, receiver);
|
||||||
table_var = CAST(LoadObjectField(receiver, JSMap::kTableOffset));
|
table_var =
|
||||||
|
LoadObjectField<OrderedHashMap>(CAST(receiver), JSMap::kTableOffset);
|
||||||
number_of_buckets.Bind(SmiUntag(CAST(UnsafeLoadFixedArrayElement(
|
number_of_buckets.Bind(SmiUntag(CAST(UnsafeLoadFixedArrayElement(
|
||||||
table_var.value(), OrderedHashMap::NumberOfBucketsIndex()))));
|
table_var.value(), OrderedHashMap::NumberOfBucketsIndex()))));
|
||||||
TNode<IntPtrT> const new_number_of_elements = SmiUntag(CAST(LoadObjectField(
|
TNode<IntPtrT> const new_number_of_elements = SmiUntag(CAST(LoadObjectField(
|
||||||
@ -1640,23 +1643,21 @@ void CollectionsBuiltinsAssembler::StoreOrderedHashMapNewEntry(
|
|||||||
}
|
}
|
||||||
|
|
||||||
TF_BUILTIN(MapPrototypeDelete, CollectionsBuiltinsAssembler) {
|
TF_BUILTIN(MapPrototypeDelete, CollectionsBuiltinsAssembler) {
|
||||||
Node* const receiver = Parameter(Descriptor::kReceiver);
|
const TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
|
||||||
Node* key = Parameter(Descriptor::kKey);
|
const TNode<Object> key = CAST(Parameter(Descriptor::kKey));
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
const TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||||
|
|
||||||
ThrowIfNotInstanceType(context, receiver, JS_MAP_TYPE,
|
ThrowIfNotInstanceType(context, receiver, JS_MAP_TYPE,
|
||||||
"Map.prototype.delete");
|
"Map.prototype.delete");
|
||||||
|
|
||||||
TNode<OrderedHashMap> const table =
|
TNode<OrderedHashMap> const table =
|
||||||
CAST(LoadObjectField(receiver, JSMap::kTableOffset));
|
LoadObjectField<OrderedHashMap>(CAST(receiver), JSMap::kTableOffset);
|
||||||
|
|
||||||
VARIABLE(entry_start_position_or_hash, MachineType::PointerRepresentation(),
|
TVARIABLE(IntPtrT, entry_start_position_or_hash, IntPtrConstant(0));
|
||||||
IntPtrConstant(0));
|
|
||||||
Label entry_found(this), not_found(this);
|
Label entry_found(this), not_found(this);
|
||||||
|
|
||||||
TryLookupOrderedHashTableIndex<OrderedHashMap>(table, key, context,
|
TryLookupOrderedHashTableIndex<OrderedHashMap>(
|
||||||
&entry_start_position_or_hash,
|
table, key, &entry_start_position_or_hash, &entry_found, ¬_found);
|
||||||
&entry_found, ¬_found);
|
|
||||||
|
|
||||||
BIND(¬_found);
|
BIND(¬_found);
|
||||||
Return(FalseConstant());
|
Return(FalseConstant());
|
||||||
@ -1701,24 +1702,22 @@ TF_BUILTIN(MapPrototypeDelete, CollectionsBuiltinsAssembler) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TF_BUILTIN(SetPrototypeAdd, CollectionsBuiltinsAssembler) {
|
TF_BUILTIN(SetPrototypeAdd, CollectionsBuiltinsAssembler) {
|
||||||
Node* const receiver = Parameter(Descriptor::kReceiver);
|
const TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
|
||||||
Node* key = Parameter(Descriptor::kKey);
|
TNode<Object> key = CAST(Parameter(Descriptor::kKey));
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
const TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||||
|
|
||||||
ThrowIfNotInstanceType(context, receiver, JS_SET_TYPE, "Set.prototype.add");
|
ThrowIfNotInstanceType(context, receiver, JS_SET_TYPE, "Set.prototype.add");
|
||||||
|
|
||||||
key = NormalizeNumberKey(key);
|
key = NormalizeNumberKey(key);
|
||||||
|
|
||||||
TNode<OrderedHashSet> const table =
|
TNode<OrderedHashSet> const table =
|
||||||
CAST(LoadObjectField(receiver, JSMap::kTableOffset));
|
LoadObjectField<OrderedHashSet>(CAST(receiver), JSMap::kTableOffset);
|
||||||
|
|
||||||
VARIABLE(entry_start_position_or_hash, MachineType::PointerRepresentation(),
|
TVARIABLE(IntPtrT, entry_start_position_or_hash, IntPtrConstant(0));
|
||||||
IntPtrConstant(0));
|
|
||||||
Label entry_found(this), not_found(this);
|
Label entry_found(this), not_found(this);
|
||||||
|
|
||||||
TryLookupOrderedHashTableIndex<OrderedHashSet>(table, key, context,
|
TryLookupOrderedHashTableIndex<OrderedHashSet>(
|
||||||
&entry_start_position_or_hash,
|
table, key, &entry_start_position_or_hash, &entry_found, ¬_found);
|
||||||
&entry_found, ¬_found);
|
|
||||||
|
|
||||||
BIND(&entry_found);
|
BIND(&entry_found);
|
||||||
// The entry was found, there is nothing to do.
|
// The entry was found, there is nothing to do.
|
||||||
@ -1733,7 +1732,7 @@ TF_BUILTIN(SetPrototypeAdd, CollectionsBuiltinsAssembler) {
|
|||||||
&add_entry);
|
&add_entry);
|
||||||
|
|
||||||
// Otherwise, go to runtime to compute the hash code.
|
// Otherwise, go to runtime to compute the hash code.
|
||||||
entry_start_position_or_hash.Bind(SmiUntag(CallGetOrCreateHashRaw(key)));
|
entry_start_position_or_hash = SmiUntag(CallGetOrCreateHashRaw(CAST(key)));
|
||||||
Goto(&add_entry);
|
Goto(&add_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1758,7 +1757,8 @@ TF_BUILTIN(SetPrototypeAdd, CollectionsBuiltinsAssembler) {
|
|||||||
// We do not have enough space, grow the table and reload the relevant
|
// We do not have enough space, grow the table and reload the relevant
|
||||||
// fields.
|
// fields.
|
||||||
CallRuntime(Runtime::kSetGrow, context, receiver);
|
CallRuntime(Runtime::kSetGrow, context, receiver);
|
||||||
table_var = CAST(LoadObjectField(receiver, JSMap::kTableOffset));
|
table_var =
|
||||||
|
LoadObjectField<OrderedHashSet>(CAST(receiver), JSMap::kTableOffset);
|
||||||
number_of_buckets.Bind(SmiUntag(CAST(UnsafeLoadFixedArrayElement(
|
number_of_buckets.Bind(SmiUntag(CAST(UnsafeLoadFixedArrayElement(
|
||||||
table_var.value(), OrderedHashSet::NumberOfBucketsIndex()))));
|
table_var.value(), OrderedHashSet::NumberOfBucketsIndex()))));
|
||||||
TNode<IntPtrT> const new_number_of_elements = SmiUntag(CAST(LoadObjectField(
|
TNode<IntPtrT> const new_number_of_elements = SmiUntag(CAST(LoadObjectField(
|
||||||
@ -1810,23 +1810,21 @@ void CollectionsBuiltinsAssembler::StoreOrderedHashSetNewEntry(
|
|||||||
}
|
}
|
||||||
|
|
||||||
TF_BUILTIN(SetPrototypeDelete, CollectionsBuiltinsAssembler) {
|
TF_BUILTIN(SetPrototypeDelete, CollectionsBuiltinsAssembler) {
|
||||||
Node* const receiver = Parameter(Descriptor::kReceiver);
|
const TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
|
||||||
Node* key = Parameter(Descriptor::kKey);
|
const TNode<Object> key = CAST(Parameter(Descriptor::kKey));
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
const TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||||
|
|
||||||
ThrowIfNotInstanceType(context, receiver, JS_SET_TYPE,
|
ThrowIfNotInstanceType(context, receiver, JS_SET_TYPE,
|
||||||
"Set.prototype.delete");
|
"Set.prototype.delete");
|
||||||
|
|
||||||
TNode<OrderedHashSet> const table =
|
TNode<OrderedHashSet> const table =
|
||||||
CAST(LoadObjectField(receiver, JSMap::kTableOffset));
|
LoadObjectField<OrderedHashSet>(CAST(receiver), JSMap::kTableOffset);
|
||||||
|
|
||||||
VARIABLE(entry_start_position_or_hash, MachineType::PointerRepresentation(),
|
TVARIABLE(IntPtrT, entry_start_position_or_hash, IntPtrConstant(0));
|
||||||
IntPtrConstant(0));
|
|
||||||
Label entry_found(this), not_found(this);
|
Label entry_found(this), not_found(this);
|
||||||
|
|
||||||
TryLookupOrderedHashTableIndex<OrderedHashSet>(table, key, context,
|
TryLookupOrderedHashTableIndex<OrderedHashSet>(
|
||||||
&entry_start_position_or_hash,
|
table, key, &entry_start_position_or_hash, &entry_found, ¬_found);
|
||||||
&entry_found, ¬_found);
|
|
||||||
|
|
||||||
BIND(¬_found);
|
BIND(¬_found);
|
||||||
Return(FalseConstant());
|
Return(FalseConstant());
|
||||||
@ -1867,21 +1865,21 @@ TF_BUILTIN(SetPrototypeDelete, CollectionsBuiltinsAssembler) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TF_BUILTIN(MapPrototypeEntries, CollectionsBuiltinsAssembler) {
|
TF_BUILTIN(MapPrototypeEntries, CollectionsBuiltinsAssembler) {
|
||||||
Node* const receiver = Parameter(Descriptor::kReceiver);
|
const TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
const TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||||
ThrowIfNotInstanceType(context, receiver, JS_MAP_TYPE,
|
ThrowIfNotInstanceType(context, receiver, JS_MAP_TYPE,
|
||||||
"Map.prototype.entries");
|
"Map.prototype.entries");
|
||||||
Return(AllocateJSCollectionIterator<JSMapIterator>(
|
Return(AllocateJSCollectionIterator<JSMapIterator>(
|
||||||
context, Context::MAP_KEY_VALUE_ITERATOR_MAP_INDEX, receiver));
|
context, Context::MAP_KEY_VALUE_ITERATOR_MAP_INDEX, CAST(receiver)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TF_BUILTIN(MapPrototypeGetSize, CollectionsBuiltinsAssembler) {
|
TF_BUILTIN(MapPrototypeGetSize, CollectionsBuiltinsAssembler) {
|
||||||
Node* const receiver = Parameter(Descriptor::kReceiver);
|
const TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
const TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||||
ThrowIfNotInstanceType(context, receiver, JS_MAP_TYPE,
|
ThrowIfNotInstanceType(context, receiver, JS_MAP_TYPE,
|
||||||
"get Map.prototype.size");
|
"get Map.prototype.size");
|
||||||
TNode<OrderedHashMap> const table =
|
TNode<OrderedHashMap> const table =
|
||||||
CAST(LoadObjectField(receiver, JSMap::kTableOffset));
|
LoadObjectField<OrderedHashMap>(CAST(receiver), JSMap::kTableOffset);
|
||||||
Return(LoadObjectField(table, OrderedHashMap::NumberOfElementsOffset()));
|
Return(LoadObjectField(table, OrderedHashMap::NumberOfElementsOffset()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1889,7 +1887,7 @@ TF_BUILTIN(MapPrototypeForEach, CollectionsBuiltinsAssembler) {
|
|||||||
const char* const kMethodName = "Map.prototype.forEach";
|
const char* const kMethodName = "Map.prototype.forEach";
|
||||||
TNode<Int32T> argc =
|
TNode<Int32T> argc =
|
||||||
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
|
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
const TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||||
CodeStubArguments args(this, argc);
|
CodeStubArguments args(this, argc);
|
||||||
TNode<Object> const receiver = args.GetReceiver();
|
TNode<Object> const receiver = args.GetReceiver();
|
||||||
TNode<Object> const callback = args.GetOptionalArgumentValue(0);
|
TNode<Object> const callback = args.GetOptionalArgumentValue(0);
|
||||||
@ -1950,31 +1948,32 @@ TF_BUILTIN(MapPrototypeForEach, CollectionsBuiltinsAssembler) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TF_BUILTIN(MapPrototypeKeys, CollectionsBuiltinsAssembler) {
|
TF_BUILTIN(MapPrototypeKeys, CollectionsBuiltinsAssembler) {
|
||||||
Node* const receiver = Parameter(Descriptor::kReceiver);
|
const TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
const TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||||
ThrowIfNotInstanceType(context, receiver, JS_MAP_TYPE, "Map.prototype.keys");
|
ThrowIfNotInstanceType(context, receiver, JS_MAP_TYPE, "Map.prototype.keys");
|
||||||
Return(AllocateJSCollectionIterator<JSMapIterator>(
|
Return(AllocateJSCollectionIterator<JSMapIterator>(
|
||||||
context, Context::MAP_KEY_ITERATOR_MAP_INDEX, receiver));
|
context, Context::MAP_KEY_ITERATOR_MAP_INDEX, CAST(receiver)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TF_BUILTIN(MapPrototypeValues, CollectionsBuiltinsAssembler) {
|
TF_BUILTIN(MapPrototypeValues, CollectionsBuiltinsAssembler) {
|
||||||
Node* const receiver = Parameter(Descriptor::kReceiver);
|
const TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
const TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||||
ThrowIfNotInstanceType(context, receiver, JS_MAP_TYPE,
|
ThrowIfNotInstanceType(context, receiver, JS_MAP_TYPE,
|
||||||
"Map.prototype.values");
|
"Map.prototype.values");
|
||||||
Return(AllocateJSCollectionIterator<JSMapIterator>(
|
Return(AllocateJSCollectionIterator<JSMapIterator>(
|
||||||
context, Context::MAP_VALUE_ITERATOR_MAP_INDEX, receiver));
|
context, Context::MAP_VALUE_ITERATOR_MAP_INDEX, CAST(receiver)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TF_BUILTIN(MapIteratorPrototypeNext, CollectionsBuiltinsAssembler) {
|
TF_BUILTIN(MapIteratorPrototypeNext, CollectionsBuiltinsAssembler) {
|
||||||
const char* const kMethodName = "Map Iterator.prototype.next";
|
const char* const kMethodName = "Map Iterator.prototype.next";
|
||||||
Node* const receiver = Parameter(Descriptor::kReceiver);
|
const TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
const TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||||
|
|
||||||
// Ensure that the {receiver} is actually a JSMapIterator.
|
// Ensure that the {receiver} is actually a JSMapIterator.
|
||||||
Label if_receiver_valid(this), if_receiver_invalid(this, Label::kDeferred);
|
Label if_receiver_valid(this), if_receiver_invalid(this, Label::kDeferred);
|
||||||
GotoIf(TaggedIsSmi(receiver), &if_receiver_invalid);
|
GotoIf(TaggedIsSmi(receiver), &if_receiver_invalid);
|
||||||
TNode<Uint16T> const receiver_instance_type = LoadInstanceType(receiver);
|
TNode<Uint16T> const receiver_instance_type =
|
||||||
|
LoadInstanceType(CAST(receiver));
|
||||||
GotoIf(
|
GotoIf(
|
||||||
InstanceTypeEqual(receiver_instance_type, JS_MAP_KEY_VALUE_ITERATOR_TYPE),
|
InstanceTypeEqual(receiver_instance_type, JS_MAP_KEY_VALUE_ITERATOR_TYPE),
|
||||||
&if_receiver_valid);
|
&if_receiver_valid);
|
||||||
@ -2042,23 +2041,22 @@ TF_BUILTIN(MapIteratorPrototypeNext, CollectionsBuiltinsAssembler) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TF_BUILTIN(SetPrototypeHas, CollectionsBuiltinsAssembler) {
|
TF_BUILTIN(SetPrototypeHas, CollectionsBuiltinsAssembler) {
|
||||||
Node* const receiver = Parameter(Descriptor::kReceiver);
|
const TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
|
||||||
Node* const key = Parameter(Descriptor::kKey);
|
const TNode<Object> key = CAST(Parameter(Descriptor::kKey));
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
const TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||||
|
|
||||||
ThrowIfNotInstanceType(context, receiver, JS_SET_TYPE, "Set.prototype.has");
|
ThrowIfNotInstanceType(context, receiver, JS_SET_TYPE, "Set.prototype.has");
|
||||||
|
|
||||||
TNode<Object> const table = LoadObjectField(receiver, JSMap::kTableOffset);
|
TNode<Object> const table =
|
||||||
|
LoadObjectField(CAST(receiver), JSMap::kTableOffset);
|
||||||
|
|
||||||
VARIABLE(entry_start_position, MachineType::PointerRepresentation(),
|
TVARIABLE(IntPtrT, entry_start_position, IntPtrConstant(0));
|
||||||
IntPtrConstant(0));
|
|
||||||
VARIABLE(result, MachineRepresentation::kTaggedSigned, IntPtrConstant(0));
|
|
||||||
Label if_key_smi(this), if_key_string(this), if_key_heap_number(this),
|
Label if_key_smi(this), if_key_string(this), if_key_heap_number(this),
|
||||||
if_key_bigint(this), entry_found(this), not_found(this), done(this);
|
if_key_bigint(this), entry_found(this), not_found(this), done(this);
|
||||||
|
|
||||||
GotoIf(TaggedIsSmi(key), &if_key_smi);
|
GotoIf(TaggedIsSmi(key), &if_key_smi);
|
||||||
|
|
||||||
TNode<Map> key_map = LoadMap(key);
|
TNode<Map> key_map = LoadMap(CAST(key));
|
||||||
TNode<Uint16T> key_instance_type = LoadMapInstanceType(key_map);
|
TNode<Uint16T> key_instance_type = LoadMapInstanceType(key_map);
|
||||||
|
|
||||||
GotoIf(IsStringInstanceType(key_instance_type), &if_key_string);
|
GotoIf(IsStringInstanceType(key_instance_type), &if_key_string);
|
||||||
@ -2066,30 +2064,34 @@ TF_BUILTIN(SetPrototypeHas, CollectionsBuiltinsAssembler) {
|
|||||||
GotoIf(IsBigIntInstanceType(key_instance_type), &if_key_bigint);
|
GotoIf(IsBigIntInstanceType(key_instance_type), &if_key_bigint);
|
||||||
|
|
||||||
FindOrderedHashTableEntryForOtherKey<OrderedHashSet>(
|
FindOrderedHashTableEntryForOtherKey<OrderedHashSet>(
|
||||||
context, table, key, &entry_start_position, &entry_found, ¬_found);
|
CAST(table), CAST(key), &entry_start_position, &entry_found, ¬_found);
|
||||||
|
|
||||||
BIND(&if_key_smi);
|
BIND(&if_key_smi);
|
||||||
{
|
{
|
||||||
FindOrderedHashTableEntryForSmiKey<OrderedHashSet>(
|
FindOrderedHashTableEntryForSmiKey<OrderedHashSet>(
|
||||||
table, key, &entry_start_position, &entry_found, ¬_found);
|
CAST(table), CAST(key), &entry_start_position, &entry_found,
|
||||||
|
¬_found);
|
||||||
}
|
}
|
||||||
|
|
||||||
BIND(&if_key_string);
|
BIND(&if_key_string);
|
||||||
{
|
{
|
||||||
FindOrderedHashTableEntryForStringKey<OrderedHashSet>(
|
FindOrderedHashTableEntryForStringKey<OrderedHashSet>(
|
||||||
context, table, key, &entry_start_position, &entry_found, ¬_found);
|
CAST(table), CAST(key), &entry_start_position, &entry_found,
|
||||||
|
¬_found);
|
||||||
}
|
}
|
||||||
|
|
||||||
BIND(&if_key_heap_number);
|
BIND(&if_key_heap_number);
|
||||||
{
|
{
|
||||||
FindOrderedHashTableEntryForHeapNumberKey<OrderedHashSet>(
|
FindOrderedHashTableEntryForHeapNumberKey<OrderedHashSet>(
|
||||||
context, table, key, &entry_start_position, &entry_found, ¬_found);
|
CAST(table), CAST(key), &entry_start_position, &entry_found,
|
||||||
|
¬_found);
|
||||||
}
|
}
|
||||||
|
|
||||||
BIND(&if_key_bigint);
|
BIND(&if_key_bigint);
|
||||||
{
|
{
|
||||||
FindOrderedHashTableEntryForBigIntKey<OrderedHashSet>(
|
FindOrderedHashTableEntryForBigIntKey<OrderedHashSet>(
|
||||||
context, table, key, &entry_start_position, &entry_found, ¬_found);
|
CAST(table), CAST(key), &entry_start_position, &entry_found,
|
||||||
|
¬_found);
|
||||||
}
|
}
|
||||||
|
|
||||||
BIND(&entry_found);
|
BIND(&entry_found);
|
||||||
@ -2100,21 +2102,21 @@ TF_BUILTIN(SetPrototypeHas, CollectionsBuiltinsAssembler) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TF_BUILTIN(SetPrototypeEntries, CollectionsBuiltinsAssembler) {
|
TF_BUILTIN(SetPrototypeEntries, CollectionsBuiltinsAssembler) {
|
||||||
Node* const receiver = Parameter(Descriptor::kReceiver);
|
const TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
const TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||||
ThrowIfNotInstanceType(context, receiver, JS_SET_TYPE,
|
ThrowIfNotInstanceType(context, receiver, JS_SET_TYPE,
|
||||||
"Set.prototype.entries");
|
"Set.prototype.entries");
|
||||||
Return(AllocateJSCollectionIterator<JSSetIterator>(
|
Return(AllocateJSCollectionIterator<JSSetIterator>(
|
||||||
context, Context::SET_KEY_VALUE_ITERATOR_MAP_INDEX, receiver));
|
context, Context::SET_KEY_VALUE_ITERATOR_MAP_INDEX, CAST(receiver)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TF_BUILTIN(SetPrototypeGetSize, CollectionsBuiltinsAssembler) {
|
TF_BUILTIN(SetPrototypeGetSize, CollectionsBuiltinsAssembler) {
|
||||||
Node* const receiver = Parameter(Descriptor::kReceiver);
|
const TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
const TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||||
ThrowIfNotInstanceType(context, receiver, JS_SET_TYPE,
|
ThrowIfNotInstanceType(context, receiver, JS_SET_TYPE,
|
||||||
"get Set.prototype.size");
|
"get Set.prototype.size");
|
||||||
TNode<OrderedHashSet> const table =
|
TNode<OrderedHashSet> const table =
|
||||||
CAST(LoadObjectField(receiver, JSSet::kTableOffset));
|
LoadObjectField<OrderedHashSet>(CAST(receiver), JSSet::kTableOffset);
|
||||||
Return(LoadObjectField(table, OrderedHashSet::NumberOfElementsOffset()));
|
Return(LoadObjectField(table, OrderedHashSet::NumberOfElementsOffset()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2122,7 +2124,7 @@ TF_BUILTIN(SetPrototypeForEach, CollectionsBuiltinsAssembler) {
|
|||||||
const char* const kMethodName = "Set.prototype.forEach";
|
const char* const kMethodName = "Set.prototype.forEach";
|
||||||
TNode<Int32T> argc =
|
TNode<Int32T> argc =
|
||||||
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
|
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
const TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||||
CodeStubArguments args(this, argc);
|
CodeStubArguments args(this, argc);
|
||||||
TNode<Object> const receiver = args.GetReceiver();
|
TNode<Object> const receiver = args.GetReceiver();
|
||||||
TNode<Object> const callback = args.GetOptionalArgumentValue(0);
|
TNode<Object> const callback = args.GetOptionalArgumentValue(0);
|
||||||
@ -2176,23 +2178,24 @@ TF_BUILTIN(SetPrototypeForEach, CollectionsBuiltinsAssembler) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TF_BUILTIN(SetPrototypeValues, CollectionsBuiltinsAssembler) {
|
TF_BUILTIN(SetPrototypeValues, CollectionsBuiltinsAssembler) {
|
||||||
Node* const receiver = Parameter(Descriptor::kReceiver);
|
const TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
const TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||||
ThrowIfNotInstanceType(context, receiver, JS_SET_TYPE,
|
ThrowIfNotInstanceType(context, receiver, JS_SET_TYPE,
|
||||||
"Set.prototype.values");
|
"Set.prototype.values");
|
||||||
Return(AllocateJSCollectionIterator<JSSetIterator>(
|
Return(AllocateJSCollectionIterator<JSSetIterator>(
|
||||||
context, Context::SET_VALUE_ITERATOR_MAP_INDEX, receiver));
|
context, Context::SET_VALUE_ITERATOR_MAP_INDEX, CAST(receiver)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TF_BUILTIN(SetIteratorPrototypeNext, CollectionsBuiltinsAssembler) {
|
TF_BUILTIN(SetIteratorPrototypeNext, CollectionsBuiltinsAssembler) {
|
||||||
const char* const kMethodName = "Set Iterator.prototype.next";
|
const char* const kMethodName = "Set Iterator.prototype.next";
|
||||||
Node* const receiver = Parameter(Descriptor::kReceiver);
|
const TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
const TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||||
|
|
||||||
// Ensure that the {receiver} is actually a JSSetIterator.
|
// Ensure that the {receiver} is actually a JSSetIterator.
|
||||||
Label if_receiver_valid(this), if_receiver_invalid(this, Label::kDeferred);
|
Label if_receiver_valid(this), if_receiver_invalid(this, Label::kDeferred);
|
||||||
GotoIf(TaggedIsSmi(receiver), &if_receiver_invalid);
|
GotoIf(TaggedIsSmi(receiver), &if_receiver_invalid);
|
||||||
TNode<Uint16T> const receiver_instance_type = LoadInstanceType(receiver);
|
TNode<Uint16T> const receiver_instance_type =
|
||||||
|
LoadInstanceType(CAST(receiver));
|
||||||
GotoIf(InstanceTypeEqual(receiver_instance_type, JS_SET_VALUE_ITERATOR_TYPE),
|
GotoIf(InstanceTypeEqual(receiver_instance_type, JS_SET_VALUE_ITERATOR_TYPE),
|
||||||
&if_receiver_valid);
|
&if_receiver_valid);
|
||||||
Branch(
|
Branch(
|
||||||
@ -2253,14 +2256,14 @@ TF_BUILTIN(SetIteratorPrototypeNext, CollectionsBuiltinsAssembler) {
|
|||||||
|
|
||||||
template <typename CollectionType>
|
template <typename CollectionType>
|
||||||
void CollectionsBuiltinsAssembler::TryLookupOrderedHashTableIndex(
|
void CollectionsBuiltinsAssembler::TryLookupOrderedHashTableIndex(
|
||||||
Node* const table, Node* const key, Node* const context, Variable* result,
|
const TNode<CollectionType> table, const TNode<Object> key,
|
||||||
Label* if_entry_found, Label* if_not_found) {
|
TVariable<IntPtrT>* result, Label* if_entry_found, Label* if_not_found) {
|
||||||
Label if_key_smi(this), if_key_string(this), if_key_heap_number(this),
|
Label if_key_smi(this), if_key_string(this), if_key_heap_number(this),
|
||||||
if_key_bigint(this);
|
if_key_bigint(this);
|
||||||
|
|
||||||
GotoIf(TaggedIsSmi(key), &if_key_smi);
|
GotoIf(TaggedIsSmi(key), &if_key_smi);
|
||||||
|
|
||||||
TNode<Map> key_map = LoadMap(key);
|
TNode<Map> key_map = LoadMap(CAST(key));
|
||||||
TNode<Uint16T> key_instance_type = LoadMapInstanceType(key_map);
|
TNode<Uint16T> key_instance_type = LoadMapInstanceType(key_map);
|
||||||
|
|
||||||
GotoIf(IsStringInstanceType(key_instance_type), &if_key_string);
|
GotoIf(IsStringInstanceType(key_instance_type), &if_key_string);
|
||||||
@ -2268,44 +2271,42 @@ void CollectionsBuiltinsAssembler::TryLookupOrderedHashTableIndex(
|
|||||||
GotoIf(IsBigIntInstanceType(key_instance_type), &if_key_bigint);
|
GotoIf(IsBigIntInstanceType(key_instance_type), &if_key_bigint);
|
||||||
|
|
||||||
FindOrderedHashTableEntryForOtherKey<CollectionType>(
|
FindOrderedHashTableEntryForOtherKey<CollectionType>(
|
||||||
context, table, key, result, if_entry_found, if_not_found);
|
table, CAST(key), result, if_entry_found, if_not_found);
|
||||||
|
|
||||||
BIND(&if_key_smi);
|
BIND(&if_key_smi);
|
||||||
{
|
{
|
||||||
FindOrderedHashTableEntryForSmiKey<CollectionType>(
|
FindOrderedHashTableEntryForSmiKey<CollectionType>(
|
||||||
table, key, result, if_entry_found, if_not_found);
|
table, CAST(key), result, if_entry_found, if_not_found);
|
||||||
}
|
}
|
||||||
|
|
||||||
BIND(&if_key_string);
|
BIND(&if_key_string);
|
||||||
{
|
{
|
||||||
FindOrderedHashTableEntryForStringKey<CollectionType>(
|
FindOrderedHashTableEntryForStringKey<CollectionType>(
|
||||||
context, table, key, result, if_entry_found, if_not_found);
|
table, CAST(key), result, if_entry_found, if_not_found);
|
||||||
}
|
}
|
||||||
|
|
||||||
BIND(&if_key_heap_number);
|
BIND(&if_key_heap_number);
|
||||||
{
|
{
|
||||||
FindOrderedHashTableEntryForHeapNumberKey<CollectionType>(
|
FindOrderedHashTableEntryForHeapNumberKey<CollectionType>(
|
||||||
context, table, key, result, if_entry_found, if_not_found);
|
table, CAST(key), result, if_entry_found, if_not_found);
|
||||||
}
|
}
|
||||||
|
|
||||||
BIND(&if_key_bigint);
|
BIND(&if_key_bigint);
|
||||||
{
|
{
|
||||||
FindOrderedHashTableEntryForBigIntKey<CollectionType>(
|
FindOrderedHashTableEntryForBigIntKey<CollectionType>(
|
||||||
context, table, key, result, if_entry_found, if_not_found);
|
table, CAST(key), result, if_entry_found, if_not_found);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TF_BUILTIN(FindOrderedHashMapEntry, CollectionsBuiltinsAssembler) {
|
TF_BUILTIN(FindOrderedHashMapEntry, CollectionsBuiltinsAssembler) {
|
||||||
Node* const table = Parameter(Descriptor::kTable);
|
const TNode<OrderedHashMap> table = CAST(Parameter(Descriptor::kTable));
|
||||||
Node* const key = Parameter(Descriptor::kKey);
|
const TNode<Object> key = CAST(Parameter(Descriptor::kKey));
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
|
||||||
|
|
||||||
VARIABLE(entry_start_position, MachineType::PointerRepresentation(),
|
TVARIABLE(IntPtrT, entry_start_position, IntPtrConstant(0));
|
||||||
IntPtrConstant(0));
|
|
||||||
Label entry_found(this), not_found(this);
|
Label entry_found(this), not_found(this);
|
||||||
|
|
||||||
TryLookupOrderedHashTableIndex<OrderedHashMap>(
|
TryLookupOrderedHashTableIndex<OrderedHashMap>(
|
||||||
table, key, context, &entry_start_position, &entry_found, ¬_found);
|
table, key, &entry_start_position, &entry_found, ¬_found);
|
||||||
|
|
||||||
BIND(&entry_found);
|
BIND(&entry_found);
|
||||||
Return(SmiTag(entry_start_position.value()));
|
Return(SmiTag(entry_start_position.value()));
|
||||||
@ -2324,7 +2325,7 @@ class WeakCollectionsBuiltinsAssembler : public BaseCollectionsAssembler {
|
|||||||
TNode<Object> key, TNode<Object> value,
|
TNode<Object> key, TNode<Object> value,
|
||||||
TNode<IntPtrT> number_of_elements);
|
TNode<IntPtrT> number_of_elements);
|
||||||
|
|
||||||
TNode<Object> AllocateTable(Variant variant, TNode<Context> context,
|
TNode<HeapObject> AllocateTable(Variant variant,
|
||||||
TNode<IntPtrT> at_least_space_for) override;
|
TNode<IntPtrT> at_least_space_for) override;
|
||||||
|
|
||||||
// Generates and sets the identity for a JSRececiver.
|
// Generates and sets the identity for a JSRececiver.
|
||||||
@ -2390,9 +2391,8 @@ void WeakCollectionsBuiltinsAssembler::AddEntry(
|
|||||||
SmiFromIntPtr(number_of_elements), SKIP_WRITE_BARRIER);
|
SmiFromIntPtr(number_of_elements), SKIP_WRITE_BARRIER);
|
||||||
}
|
}
|
||||||
|
|
||||||
TNode<Object> WeakCollectionsBuiltinsAssembler::AllocateTable(
|
TNode<HeapObject> WeakCollectionsBuiltinsAssembler::AllocateTable(
|
||||||
Variant variant, TNode<Context> context,
|
Variant variant, TNode<IntPtrT> at_least_space_for) {
|
||||||
TNode<IntPtrT> at_least_space_for) {
|
|
||||||
// See HashTable::New().
|
// See HashTable::New().
|
||||||
CSA_ASSERT(this,
|
CSA_ASSERT(this,
|
||||||
IntPtrLessThanOrEqual(IntPtrConstant(0), at_least_space_for));
|
IntPtrLessThanOrEqual(IntPtrConstant(0), at_least_space_for));
|
||||||
@ -2631,9 +2631,9 @@ TF_BUILTIN(WeakMapLookupHashIndex, WeakCollectionsBuiltinsAssembler) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TF_BUILTIN(WeakMapGet, WeakCollectionsBuiltinsAssembler) {
|
TF_BUILTIN(WeakMapGet, WeakCollectionsBuiltinsAssembler) {
|
||||||
Node* const receiver = Parameter(Descriptor::kReceiver);
|
const TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
|
||||||
Node* const key = Parameter(Descriptor::kKey);
|
const TNode<Object> key = CAST(Parameter(Descriptor::kKey));
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
const TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||||
|
|
||||||
Label return_undefined(this);
|
Label return_undefined(this);
|
||||||
|
|
||||||
@ -2653,9 +2653,9 @@ TF_BUILTIN(WeakMapGet, WeakCollectionsBuiltinsAssembler) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TF_BUILTIN(WeakMapPrototypeHas, WeakCollectionsBuiltinsAssembler) {
|
TF_BUILTIN(WeakMapPrototypeHas, WeakCollectionsBuiltinsAssembler) {
|
||||||
Node* const receiver = Parameter(Descriptor::kReceiver);
|
const TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
|
||||||
Node* const key = Parameter(Descriptor::kKey);
|
const TNode<Object> key = CAST(Parameter(Descriptor::kKey));
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
const TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||||
|
|
||||||
Label return_false(this);
|
Label return_false(this);
|
||||||
|
|
||||||
@ -2817,9 +2817,9 @@ TF_BUILTIN(WeakSetPrototypeDelete, CodeStubAssembler) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TF_BUILTIN(WeakSetPrototypeHas, WeakCollectionsBuiltinsAssembler) {
|
TF_BUILTIN(WeakSetPrototypeHas, WeakCollectionsBuiltinsAssembler) {
|
||||||
Node* const receiver = Parameter(Descriptor::kReceiver);
|
const TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
|
||||||
Node* const key = Parameter(Descriptor::kKey);
|
const TNode<Object> key = CAST(Parameter(Descriptor::kKey));
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
const TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||||
|
|
||||||
Label return_false(this);
|
Label return_false(this);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user