Skip to content

Commit ebd99c6

Browse files
nico-hartmannCommit Bot
authored andcommitted
Merged: [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. (cherry picked from commit 5d1a7c6) Bug: chromium:1158322 Change-Id: I150f726324435fb89a61286d5a76af616ba81c09 No-Try: true No-Presubmit: true No-Tree-Checks: true Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2656315 Commit-Queue: Nico Hartmann <[email protected]> Reviewed-by: Lutz Vahl <[email protected]> Cr-Commit-Position: refs/branch-heads/8.9@{v8#24} Cr-Branched-From: 16b9bbb-refs/heads/8.9.255@{#1} Cr-Branched-From: d16a2a6-refs/heads/master@{#72039}
1 parent c37881b commit ebd99c6

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/compiler/js-heap-broker.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4091,9 +4091,12 @@ base::Optional<FunctionTemplateInfoRef>
40914091
SharedFunctionInfoRef::function_template_info() const {
40924092
if (data_->should_access_heap()) {
40934093
if (object()->IsApiFunction()) {
4094-
return FunctionTemplateInfoRef(
4095-
broker(), broker()->CanonicalPersistentHandle(
4096-
object()->function_data(kAcquireLoad)));
4094+
ObjectData* data = broker()->TryGetOrCreateData(
4095+
broker()->CanonicalPersistentHandle(
4096+
object()->function_data(kAcquireLoad)),
4097+
false);
4098+
if (data == nullptr) return base::nullopt;
4099+
return FunctionTemplateInfoRef(broker(), data, true);
40974100
}
40984101
return base::nullopt;
40994102
}

src/compiler/serializer-for-background-compilation.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3017,7 +3017,8 @@ SerializerForBackgroundCompilation::ProcessMapForNamedPropertyAccess(
30173017
Handle<SharedFunctionInfo> sfi = function.shared().object();
30183018
if (sfi->IsApiFunction()) {
30193019
FunctionTemplateInfoRef fti_ref(
3020-
broker(), handle(sfi->get_api_func_data(), broker()->isolate()));
3020+
broker(),
3021+
broker()->CanonicalPersistentHandle(sfi->get_api_func_data()));
30213022
if (fti_ref.has_call_code()) {
30223023
fti_ref.SerializeCallCode();
30233024
ProcessReceiverMapForApiCall(fti_ref, receiver_map->object());
@@ -3030,7 +3031,8 @@ SerializerForBackgroundCompilation::ProcessMapForNamedPropertyAccess(
30303031
// For JSCallReducer::ReduceJSCall.
30313032
function.Serialize();
30323033
} else {
3033-
FunctionTemplateInfoRef fti(broker(), access_info.constant());
3034+
FunctionTemplateInfoRef fti(broker(), broker()->CanonicalPersistentHandle(
3035+
access_info.constant()));
30343036
if (fti.has_call_code()) fti.SerializeCallCode();
30353037
}
30363038
} else if (access_info.IsModuleExport()) {

0 commit comments

Comments
 (0)