Commit b086aa70 authored by Patrick Thier's avatar Patrick Thier Committed by V8 LUCI CQ

[csa] Load hash in TryToName with Acquire semantics

Add support to atomically load (untagged) values from objects to CSA.

Bug: v8:12007
Change-Id: If0c4f20f20e021ace3b1e3a874c0405574d313e1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3627513
Commit-Queue: Patrick Thier <pthier@chromium.org>
Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80444}
parent 30a8616a
......@@ -8089,8 +8089,8 @@ void CodeStubAssembler::TryToName(TNode<Object> key, Label* if_keyisindex,
Label if_thinstring(this), if_has_cached_index(this),
if_forwarding_index(this);
// TODO(v8:12007): LoadNameRawHashField() should be an acquire load.
TNode<Uint32T> raw_hash_field = LoadNameRawHashField(CAST(key));
TNode<Uint32T> raw_hash_field = AtomicLoadObjectField<Uint32T>(
AtomicMemoryOrder::kAcqRel, CAST(key), Name::kRawHashFieldOffset);
GotoIf(IsClearWord32(raw_hash_field,
Name::kDoesNotContainCachedArrayIndexMask),
&if_has_cached_index);
......
......@@ -1274,6 +1274,16 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
return Load<Simd128T>(ptr);
}
template <class T, typename std::enable_if<
std::is_convertible<TNode<T>, TNode<UntaggedT>>::value,
int>::type = 0>
TNode<T> AtomicLoadObjectField(AtomicMemoryOrder order,
TNode<HeapObject> object, int offset) {
return UncheckedCast<T>(
AtomicLoadFromObject(MachineTypeOf<T>::value, order, object,
IntPtrConstant(offset - kHeapObjectTag)));
}
// Reference is the CSA-equivalent of a Torque reference value, representing
// an inner pointer into a HeapObject.
//
......
......@@ -713,6 +713,15 @@ Node* CodeAssembler::LoadFromObject(MachineType type, TNode<Object> object,
return raw_assembler()->LoadFromObject(type, object, offset);
}
Node* CodeAssembler::AtomicLoadFromObject(MachineType type,
AtomicMemoryOrder order,
TNode<Object> object,
TNode<IntPtrT> offset) {
DCHECK(!raw_assembler()->IsMapOffsetConstantMinusTag(offset));
return raw_assembler()->AtomicLoad(AtomicLoadParameters(type, order), object,
offset);
}
#ifdef V8_MAP_PACKING
Node* CodeAssembler::PackMapWord(Node* value) {
TNode<IntPtrT> map_word =
......
......@@ -761,6 +761,8 @@ class V8_EXPORT_PRIVATE CodeAssembler {
Node* LoadFromObject(MachineType type, TNode<Object> object,
TNode<IntPtrT> offset);
Node* AtomicLoadFromObject(MachineType type, AtomicMemoryOrder order,
TNode<Object> object, TNode<IntPtrT> offset);
#ifdef V8_MAP_PACKING
Node* PackMapWord(Node* value);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment