[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/+/2639958
Reviewed-by: Michael Stanton <mvstanton@chromium.org>
Reviewed-by: Georg 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}
This commit is contained in:
Nico Hartmann 2021-01-25 14:18:19 +01:00 committed by Commit Bot
parent 21c74f4f96
commit 5d1a7c6440
2 changed files with 10 additions and 5 deletions

View File

@ -4291,9 +4291,12 @@ base::Optional<FunctionTemplateInfoRef>
SharedFunctionInfoRef::function_template_info() const {
if (data_->should_access_heap()) {
if (object()->IsApiFunction()) {
return FunctionTemplateInfoRef(
broker(), broker()->CanonicalPersistentHandle(
object()->function_data(kAcquireLoad)));
ObjectData* data = broker()->TryGetOrCreateData(
broker()->CanonicalPersistentHandle(
object()->function_data(kAcquireLoad)),
false);
if (data == nullptr) return base::nullopt;
return FunctionTemplateInfoRef(broker(), data, true);
}
return base::nullopt;
}

View File

@ -3021,7 +3021,8 @@ SerializerForBackgroundCompilation::ProcessMapForNamedPropertyAccess(
Handle<SharedFunctionInfo> sfi = function.shared().object();
if (sfi->IsApiFunction()) {
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()) {
fti_ref.SerializeCallCode();
ProcessReceiverMapForApiCall(fti_ref, receiver_map->object());
@ -3034,7 +3035,8 @@ SerializerForBackgroundCompilation::ProcessMapForNamedPropertyAccess(
// For JSCallReducer::ReduceJSCall.
function.Serialize();
} else {
FunctionTemplateInfoRef fti(broker(), access_info.constant());
FunctionTemplateInfoRef fti(broker(), broker()->CanonicalPersistentHandle(
access_info.constant()));
if (fti.has_call_code()) fti.SerializeCallCode();
}
} else if (access_info.IsModuleExport()) {