deps: V8: cherry-pick 94e8282325a1 · nodejs/node@6d50966
@@ -399,23 +399,23 @@ TNode<IntPtrT> BaseCollectionsAssembler::EstimatedInitialSize(
399399 [=] { return IntPtrConstant(0); });
400400}
401401402-void BaseCollectionsAssembler::GotoIfCannotBeWeakKey(
403-const TNode<Object> obj, Label* if_cannot_be_weak_key) {
402+void BaseCollectionsAssembler::GotoIfCannotBeHeldWeakly(
403+const TNode<Object> obj, Label* if_cannot_be_held_weakly) {
404404 Label check_symbol_key(this);
405405 Label end(this);
406-GotoIf(TaggedIsSmi(obj), if_cannot_be_weak_key);
406+GotoIf(TaggedIsSmi(obj), if_cannot_be_held_weakly);
407407 TNode<Uint16T> instance_type = LoadMapInstanceType(LoadMap(CAST(obj)));
408408GotoIfNot(IsJSReceiverInstanceType(instance_type), &check_symbol_key);
409409// TODO(v8:12547) Shared structs should only be able to point to shared values
410410// in weak collections. For now, disallow them as weak collection keys.
411-GotoIf(IsJSSharedStructInstanceType(instance_type), if_cannot_be_weak_key);
411+GotoIf(IsJSSharedStructInstanceType(instance_type), if_cannot_be_held_weakly);
412412Goto(&end);
413413Bind(&check_symbol_key);
414-GotoIfNot(HasHarmonySymbolAsWeakmapKeyFlag(), if_cannot_be_weak_key);
415-GotoIfNot(IsSymbolInstanceType(instance_type), if_cannot_be_weak_key);
414+GotoIfNot(HasHarmonySymbolAsWeakmapKeyFlag(), if_cannot_be_held_weakly);
415+GotoIfNot(IsSymbolInstanceType(instance_type), if_cannot_be_held_weakly);
416416 TNode<Uint32T> flags = LoadSymbolFlags(CAST(obj));
417417GotoIf(Word32And(flags, Symbol::IsInPublicSymbolTableBit::kMask),
418-if_cannot_be_weak_key);
418+if_cannot_be_held_weakly);
419419Goto(&end);
420420Bind(&end);
421421}
@@ -2573,17 +2573,17 @@ TF_BUILTIN(WeakMapLookupHashIndex, WeakCollectionsBuiltinsAssembler) {
25732573auto table = Parameter<EphemeronHashTable>(Descriptor::kTable);
25742574auto key = Parameter<Object>(Descriptor::kKey);
257525752576- Label if_cannot_be_weak_key(this);
2576+ Label if_cannot_be_held_weakly(this);
257725772578-GotoIfCannotBeWeakKey(key, &if_cannot_be_weak_key);
2578+GotoIfCannotBeHeldWeakly(key, &if_cannot_be_held_weakly);
257925792580- TNode<IntPtrT> hash = GetHash(CAST(key), &if_cannot_be_weak_key);
2580+ TNode<IntPtrT> hash = GetHash(CAST(key), &if_cannot_be_held_weakly);
25812581 TNode<IntPtrT> capacity = LoadTableCapacity(table);
25822582 TNode<IntPtrT> key_index = FindKeyIndexForKey(
2583- table, key, hash, EntryMask(capacity), &if_cannot_be_weak_key);
2583+ table, key, hash, EntryMask(capacity), &if_cannot_be_held_weakly);
25842584Return(SmiTag(ValueIndexFromKeyIndex(key_index)));
258525852586-BIND(&if_cannot_be_weak_key);
2586+BIND(&if_cannot_be_held_weakly);
25872587Return(SmiConstant(-1));
25882588}
25892589@@ -2638,22 +2638,22 @@ TF_BUILTIN(WeakCollectionDelete, WeakCollectionsBuiltinsAssembler) {
26382638auto collection = Parameter<JSWeakCollection>(Descriptor::kCollection);
26392639auto key = Parameter<Object>(Descriptor::kKey);
264026402641- Label call_runtime(this), if_cannot_be_weak_key(this);
2641+ Label call_runtime(this), if_cannot_be_held_weakly(this);
264226422643-GotoIfCannotBeWeakKey(key, &if_cannot_be_weak_key);
2643+GotoIfCannotBeHeldWeakly(key, &if_cannot_be_held_weakly);
264426442645- TNode<IntPtrT> hash = GetHash(CAST(key), &if_cannot_be_weak_key);
2645+ TNode<IntPtrT> hash = GetHash(CAST(key), &if_cannot_be_held_weakly);
26462646 TNode<EphemeronHashTable> table = LoadTable(collection);
26472647 TNode<IntPtrT> capacity = LoadTableCapacity(table);
26482648 TNode<IntPtrT> key_index = FindKeyIndexForKey(
2649- table, key, hash, EntryMask(capacity), &if_cannot_be_weak_key);
2649+ table, key, hash, EntryMask(capacity), &if_cannot_be_held_weakly);
26502650 TNode<IntPtrT> number_of_elements = LoadNumberOfElements(table, -1);
26512651GotoIf(ShouldShrink(capacity, number_of_elements), &call_runtime);
2652265226532653RemoveEntry(table, key_index, number_of_elements);
26542654Return(TrueConstant());
265526552656-BIND(&if_cannot_be_weak_key);
2656+BIND(&if_cannot_be_held_weakly);
26572657Return(FalseConstant());
2658265826592659BIND(&call_runtime);
@@ -2735,7 +2735,7 @@ TF_BUILTIN(WeakMapPrototypeSet, WeakCollectionsBuiltinsAssembler) {
27352735"WeakMap.prototype.set");
2736273627372737 Label throw_invalid_key(this);
2738-GotoIfCannotBeWeakKey(key, &throw_invalid_key);
2738+GotoIfCannotBeHeldWeakly(key, &throw_invalid_key);
2739273927402740Return(
27412741CallBuiltin(Builtin::kWeakCollectionSet, context, receiver, key, value));
@@ -2753,7 +2753,7 @@ TF_BUILTIN(WeakSetPrototypeAdd, WeakCollectionsBuiltinsAssembler) {
27532753"WeakSet.prototype.add");
2754275427552755 Label throw_invalid_value(this);
2756-GotoIfCannotBeWeakKey(value, &throw_invalid_value);
2756+GotoIfCannotBeHeldWeakly(value, &throw_invalid_value);
2757275727582758Return(CallBuiltin(Builtin::kWeakCollectionSet, context, receiver, value,
27592759TrueConstant()));