Commit 5d1a7c64 authored by Nico Hartmann's avatar Nico Hartmann Committed by Commit Bot

[TurboFan] Optional FunctionTemplateInfo with heap access

This CL makes direct heap access consistent with the serialized mode by
correctly skipping optimizations if we encounter a FunctionTemplateInfo
that is unknown to the broker, because we haven't seen it during
serialization.

Bug: chromium:1158322
Change-Id: I10ad6f307bbd5a17f27890390179bd9e2d35418c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2639958Reviewed-by: 's avatarMichael Stanton <mvstanton@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Commit-Queue: Michael Stanton <mvstanton@chromium.org>
Auto-Submit: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72295}
parent 21c74f4f
...@@ -4291,9 +4291,12 @@ base::Optional<FunctionTemplateInfoRef> ...@@ -4291,9 +4291,12 @@ base::Optional<FunctionTemplateInfoRef>
SharedFunctionInfoRef::function_template_info() const { SharedFunctionInfoRef::function_template_info() const {
if (data_->should_access_heap()) { if (data_->should_access_heap()) {
if (object()->IsApiFunction()) { if (object()->IsApiFunction()) {
return FunctionTemplateInfoRef( ObjectData* data = broker()->TryGetOrCreateData(
broker(), broker()->CanonicalPersistentHandle( broker()->CanonicalPersistentHandle(
object()->function_data(kAcquireLoad))); object()->function_data(kAcquireLoad)),
false);
if (data == nullptr) return base::nullopt;
return FunctionTemplateInfoRef(broker(), data, true);
} }
return base::nullopt; return base::nullopt;
} }
......
...@@ -3021,7 +3021,8 @@ SerializerForBackgroundCompilation::ProcessMapForNamedPropertyAccess( ...@@ -3021,7 +3021,8 @@ SerializerForBackgroundCompilation::ProcessMapForNamedPropertyAccess(
Handle<SharedFunctionInfo> sfi = function.shared().object(); Handle<SharedFunctionInfo> sfi = function.shared().object();
if (sfi->IsApiFunction()) { if (sfi->IsApiFunction()) {
FunctionTemplateInfoRef fti_ref( FunctionTemplateInfoRef fti_ref(
broker(), handle(sfi->get_api_func_data(), broker()->isolate())); broker(),
broker()->CanonicalPersistentHandle(sfi->get_api_func_data()));
if (fti_ref.has_call_code()) { if (fti_ref.has_call_code()) {
fti_ref.SerializeCallCode(); fti_ref.SerializeCallCode();
ProcessReceiverMapForApiCall(fti_ref, receiver_map->object()); ProcessReceiverMapForApiCall(fti_ref, receiver_map->object());
...@@ -3034,7 +3035,8 @@ SerializerForBackgroundCompilation::ProcessMapForNamedPropertyAccess( ...@@ -3034,7 +3035,8 @@ SerializerForBackgroundCompilation::ProcessMapForNamedPropertyAccess(
// For JSCallReducer::ReduceJSCall. // For JSCallReducer::ReduceJSCall.
function.Serialize(); function.Serialize();
} else { } else {
FunctionTemplateInfoRef fti(broker(), access_info.constant()); FunctionTemplateInfoRef fti(broker(), broker()->CanonicalPersistentHandle(
access_info.constant()));
if (fti.has_call_code()) fti.SerializeCallCode(); if (fti.has_call_code()) fti.SerializeCallCode();
} }
} else if (access_info.IsModuleExport()) { } else if (access_info.IsModuleExport()) {
......
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