Commit e4f63bae authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[compiler] Move GetFieldType to DescriptorArrayRef

Also access the DescriptorArray through GetFieldType concurrently if
the FLAG_turbo_direct_heap_access is on.

Bug: v8:7790
Cq-Include-Trybots: luci.v8.try:v8_linux64_tsan_isolates_rel_ng
Cq-Include-Trybots: luci.v8.try:v8_linux64_tsan_no_cm_rel_ng
Cq-Include-Trybots: luci.v8.try:v8_linux64_tsan_rel_ng
Change-Id: I2506fe44a3be9f3474934300d52849f278899e70
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2720299Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73149}
parent c613eb97
......@@ -563,6 +563,7 @@ class DescriptorArrayRef : public HeapObjectRef {
PropertyDetails GetPropertyDetails(InternalIndex descriptor_index) const;
NameRef GetPropertyKey(InternalIndex descriptor_index) const;
ObjectRef GetFieldType(InternalIndex descriptor_index) const;
base::Optional<ObjectRef> GetStrongValue(
InternalIndex descriptor_index) const;
};
......
......@@ -3227,16 +3227,7 @@ MapRef MapRef::FindFieldOwner(InternalIndex descriptor_index) const {
ObjectRef MapRef::GetFieldType(InternalIndex descriptor_index) const {
CHECK_LT(descriptor_index.as_int(), NumberOfOwnDescriptors());
if (data_->should_access_heap()) {
Handle<FieldType> field_type(object()
->instance_descriptors(kRelaxedLoad)
.GetFieldType(descriptor_index),
broker()->isolate());
return ObjectRef(broker(), field_type);
}
DescriptorArrayData* descriptors =
data()->AsMap()->instance_descriptors()->AsDescriptorArray();
return ObjectRef(broker(), descriptors->GetFieldType(descriptor_index));
return instance_descriptors().GetFieldType(descriptor_index);
}
base::Optional<ObjectRef> StringRef::GetCharAsStringOrUndefined(
......@@ -4154,6 +4145,22 @@ NameRef DescriptorArrayRef::GetPropertyKey(
data()->AsDescriptorArray()->GetPropertyKey(descriptor_index));
}
ObjectRef DescriptorArrayRef::GetFieldType(
InternalIndex descriptor_index) const {
if (data_->should_access_heap() || FLAG_turbo_direct_heap_access) {
// This method only gets called for the creation of FieldTypeDependencies.
// These calls happen when the broker is either disabled or serializing,
// which means that GetOrCreateData would be able to successfully create the
// ObjectRef for the cases where we haven't seen the FieldType before.
DCHECK(broker()->mode() == JSHeapBroker::kDisabled ||
broker()->mode() == JSHeapBroker::kSerializing);
return ObjectRef(broker(), broker()->CanonicalPersistentHandle(
object()->GetFieldType(descriptor_index)));
}
return ObjectRef(broker(),
data()->AsDescriptorArray()->GetFieldType(descriptor_index));
}
base::Optional<ObjectRef> DescriptorArrayRef::GetStrongValue(
InternalIndex descriptor_index) const {
if (data_->should_access_heap() || FLAG_turbo_direct_heap_access) {
......
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