Commit 4e4b3f05 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[compiler] Create canonical persistent handles in more places

Bug: v8:7790
Change-Id: I27a13c213c33e742cd66ed85e9c10c71b78a9384
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2410182
Auto-Submit: Georg Neis <neis@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: 's avatarSantiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69902}
parent 362b2c23
...@@ -2362,7 +2362,7 @@ ContextRef ContextRef::previous(size_t* depth, ...@@ -2362,7 +2362,7 @@ ContextRef ContextRef::previous(size_t* depth,
current = Context::cast(current.unchecked_previous()); current = Context::cast(current.unchecked_previous());
(*depth)--; (*depth)--;
} }
return ContextRef(broker(), handle(current, broker()->isolate())); return ContextRef(broker(), broker()->CanonicalPersistentHandle(current));
} }
if (*depth == 0) return *this; if (*depth == 0) return *this;
...@@ -3002,8 +3002,8 @@ ObjectRef JSObjectRef::RawFastPropertyAt(FieldIndex index) const { ...@@ -3002,8 +3002,8 @@ ObjectRef JSObjectRef::RawFastPropertyAt(FieldIndex index) const {
broker()->mode()); broker()->mode());
AllowHandleDereferenceIfNeeded allow_handle_dereference(data()->kind(), AllowHandleDereferenceIfNeeded allow_handle_dereference(data()->kind(),
broker()->mode()); broker()->mode());
return ObjectRef(broker(), handle(object()->RawFastPropertyAt(index), return ObjectRef(broker(), broker()->CanonicalPersistentHandle(
broker()->isolate())); object()->RawFastPropertyAt(index)));
} }
JSObjectData* object_data = data()->AsJSObject(); JSObjectData* object_data = data()->AsJSObject();
CHECK(index.is_inobject()); CHECK(index.is_inobject());
...@@ -3014,6 +3014,7 @@ ObjectRef JSObjectRef::RawFastPropertyAt(FieldIndex index) const { ...@@ -3014,6 +3014,7 @@ ObjectRef JSObjectRef::RawFastPropertyAt(FieldIndex index) const {
bool AllocationSiteRef::IsFastLiteral() const { bool AllocationSiteRef::IsFastLiteral() const {
if (data_->should_access_heap()) { if (data_->should_access_heap()) {
CHECK_NE(data_->kind(), ObjectDataKind::kNeverSerializedHeapObject);
AllowHeapAllocationIfNeeded allow_heap_allocation( AllowHeapAllocationIfNeeded allow_heap_allocation(
data()->kind(), broker()->mode()); // For TryMigrateInstance. data()->kind(), broker()->mode()); // For TryMigrateInstance.
AllowHandleAllocationIfNeeded allow_handle_allocation(data()->kind(), AllowHandleAllocationIfNeeded allow_handle_allocation(data()->kind(),
...@@ -3100,8 +3101,8 @@ NameRef MapRef::GetPropertyKey(InternalIndex descriptor_index) const { ...@@ -3100,8 +3101,8 @@ NameRef MapRef::GetPropertyKey(InternalIndex descriptor_index) const {
broker()->mode()); broker()->mode());
return NameRef( return NameRef(
broker(), broker(),
handle(object()->instance_descriptors().GetKey(descriptor_index), broker()->CanonicalPersistentHandle(
broker()->isolate())); object()->instance_descriptors().GetKey(descriptor_index)));
} }
DescriptorArrayData* descriptors = data()->AsMap()->instance_descriptors(); DescriptorArrayData* descriptors = data()->AsMap()->instance_descriptors();
return NameRef(broker(), return NameRef(broker(),
...@@ -3203,7 +3204,8 @@ ObjectRef FixedArrayRef::get(int i) const { ...@@ -3203,7 +3204,8 @@ ObjectRef FixedArrayRef::get(int i) const {
broker()->mode()); broker()->mode());
AllowHandleDereferenceIfNeeded allow_handle_dereference(data()->kind(), AllowHandleDereferenceIfNeeded allow_handle_dereference(data()->kind(),
broker()->mode()); broker()->mode());
return ObjectRef(broker(), handle(object()->get(i), broker()->isolate())); return ObjectRef(broker(),
broker()->CanonicalPersistentHandle(object()->get(i)));
} }
return ObjectRef(broker(), data()->AsFixedArray()->Get(i)); return ObjectRef(broker(), data()->AsFixedArray()->Get(i));
} }
...@@ -3241,7 +3243,8 @@ Handle<Object> BytecodeArrayRef::GetConstantAtIndex(int index) const { ...@@ -3241,7 +3243,8 @@ Handle<Object> BytecodeArrayRef::GetConstantAtIndex(int index) const {
broker()->mode()); broker()->mode());
AllowHandleDereferenceIfNeeded allow_handle_dereference(data()->kind(), AllowHandleDereferenceIfNeeded allow_handle_dereference(data()->kind(),
broker()->mode()); broker()->mode());
return handle(object()->constant_pool().get(index), broker()->isolate()); return broker()->CanonicalPersistentHandle(
object()->constant_pool().get(index));
} }
return data()->AsBytecodeArray()->GetConstantAtIndex(index, return data()->AsBytecodeArray()->GetConstantAtIndex(index,
broker()->isolate()); broker()->isolate());
...@@ -3420,7 +3423,7 @@ BIMODAL_ACCESSOR_C(PropertyCell, PropertyDetails, property_details) ...@@ -3420,7 +3423,7 @@ BIMODAL_ACCESSOR_C(PropertyCell, PropertyDetails, property_details)
base::Optional<CallHandlerInfoRef> FunctionTemplateInfoRef::call_code() const { base::Optional<CallHandlerInfoRef> FunctionTemplateInfoRef::call_code() const {
if (data_->should_access_heap()) { if (data_->should_access_heap()) {
return CallHandlerInfoRef( return CallHandlerInfoRef(
broker(), handle(object()->call_code(), broker()->isolate())); broker(), broker()->CanonicalPersistentHandle(object()->call_code()));
} }
ObjectData* call_code = data()->AsFunctionTemplateInfo()->call_code(); ObjectData* call_code = data()->AsFunctionTemplateInfo()->call_code();
if (!call_code) return base::nullopt; if (!call_code) return base::nullopt;
...@@ -3545,7 +3548,7 @@ base::Optional<ObjectRef> MapRef::GetStrongValue( ...@@ -3545,7 +3548,7 @@ base::Optional<ObjectRef> MapRef::GetStrongValue(
object()->instance_descriptors().GetValue(descriptor_index); object()->instance_descriptors().GetValue(descriptor_index);
HeapObject object; HeapObject object;
if (value.GetHeapObjectIfStrong(&object)) { if (value.GetHeapObjectIfStrong(&object)) {
return ObjectRef(broker(), handle(object, broker()->isolate())); return ObjectRef(broker(), broker()->CanonicalPersistentHandle((object)));
} }
return base::nullopt; return base::nullopt;
} }
...@@ -3649,8 +3652,8 @@ ScopeInfoRef ScopeInfoRef::OuterScopeInfo() const { ...@@ -3649,8 +3652,8 @@ ScopeInfoRef ScopeInfoRef::OuterScopeInfo() const {
broker()->mode()); broker()->mode());
AllowHandleDereferenceIfNeeded allow_handle_dereference(data()->kind(), AllowHandleDereferenceIfNeeded allow_handle_dereference(data()->kind(),
broker()->mode()); broker()->mode());
return ScopeInfoRef( return ScopeInfoRef(broker(), broker()->CanonicalPersistentHandle(
broker(), handle(object()->OuterScopeInfo(), broker()->isolate())); object()->OuterScopeInfo()));
} }
return ScopeInfoRef(broker(), data()->AsScopeInfo()->outer_scope_info()); return ScopeInfoRef(broker(), data()->AsScopeInfo()->outer_scope_info());
} }
...@@ -3712,7 +3715,7 @@ SharedFunctionInfoRef FeedbackVectorRef::shared_function_info() const { ...@@ -3712,7 +3715,7 @@ SharedFunctionInfoRef FeedbackVectorRef::shared_function_info() const {
broker()->mode()); broker()->mode());
return SharedFunctionInfoRef( return SharedFunctionInfoRef(
broker(), broker(),
handle(object()->shared_function_info(), broker()->isolate())); broker()->CanonicalPersistentHandle(object()->shared_function_info()));
} }
return SharedFunctionInfoRef( return SharedFunctionInfoRef(
...@@ -3885,8 +3888,8 @@ base::Optional<CellRef> SourceTextModuleRef::GetCell(int cell_index) const { ...@@ -3885,8 +3888,8 @@ base::Optional<CellRef> SourceTextModuleRef::GetCell(int cell_index) const {
broker()->mode()); broker()->mode());
AllowHandleDereferenceIfNeeded allow_handle_dereference(data()->kind(), AllowHandleDereferenceIfNeeded allow_handle_dereference(data()->kind(),
broker()->mode()); broker()->mode());
return CellRef(broker(), return CellRef(broker(), broker()->CanonicalPersistentHandle(
handle(object()->GetCell(cell_index), broker()->isolate())); object()->GetCell(cell_index)));
} }
ObjectData* cell = ObjectData* cell =
data()->AsSourceTextModule()->GetCell(broker(), cell_index); data()->AsSourceTextModule()->GetCell(broker(), cell_index);
...@@ -3900,8 +3903,8 @@ ObjectRef SourceTextModuleRef::import_meta() const { ...@@ -3900,8 +3903,8 @@ ObjectRef SourceTextModuleRef::import_meta() const {
broker()->mode()); broker()->mode());
AllowHandleDereferenceIfNeeded allow_handle_dereference(data()->kind(), AllowHandleDereferenceIfNeeded allow_handle_dereference(data()->kind(),
broker()->mode()); broker()->mode());
return ObjectRef(broker(), return ObjectRef(
handle(object()->import_meta(), broker()->isolate())); broker(), broker()->CanonicalPersistentHandle(object()->import_meta()));
} }
return ObjectRef(broker(), return ObjectRef(broker(),
data()->AsSourceTextModule()->GetImportMeta(broker())); data()->AsSourceTextModule()->GetImportMeta(broker()));
...@@ -3992,8 +3995,8 @@ base::Optional<JSObjectRef> AllocationSiteRef::boilerplate() const { ...@@ -3992,8 +3995,8 @@ base::Optional<JSObjectRef> AllocationSiteRef::boilerplate() const {
broker()->mode()); broker()->mode());
AllowHandleDereferenceIfNeeded allow_handle_dereference(data()->kind(), AllowHandleDereferenceIfNeeded allow_handle_dereference(data()->kind(),
broker()->mode()); broker()->mode());
return JSObjectRef(broker(), return JSObjectRef(
handle(object()->boilerplate(), broker()->isolate())); broker(), broker()->CanonicalPersistentHandle(object()->boilerplate()));
} }
ObjectData* boilerplate = data()->AsAllocationSite()->boilerplate(); ObjectData* boilerplate = data()->AsAllocationSite()->boilerplate();
if (boilerplate) { if (boilerplate) {
...@@ -4013,8 +4016,8 @@ FixedArrayBaseRef JSObjectRef::elements() const { ...@@ -4013,8 +4016,8 @@ FixedArrayBaseRef JSObjectRef::elements() const {
broker()->mode()); broker()->mode());
AllowHandleDereferenceIfNeeded allow_handle_dereference(data()->kind(), AllowHandleDereferenceIfNeeded allow_handle_dereference(data()->kind(),
broker()->mode()); broker()->mode());
return FixedArrayBaseRef(broker(), return FixedArrayBaseRef(
handle(object()->elements(), broker()->isolate())); broker(), broker()->CanonicalPersistentHandle(object()->elements()));
} }
return FixedArrayBaseRef(broker(), data()->AsJSObject()->elements()); return FixedArrayBaseRef(broker(), data()->AsJSObject()->elements());
} }
...@@ -4272,7 +4275,8 @@ SharedFunctionInfoRef::function_template_info() const { ...@@ -4272,7 +4275,8 @@ SharedFunctionInfoRef::function_template_info() const {
if (data_->should_access_heap()) { if (data_->should_access_heap()) {
if (object()->IsApiFunction()) { if (object()->IsApiFunction()) {
return FunctionTemplateInfoRef( return FunctionTemplateInfoRef(
broker(), handle(object()->function_data(), broker()->isolate())); broker(),
broker()->CanonicalPersistentHandle(object()->function_data()));
} }
return base::nullopt; return base::nullopt;
} }
......
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