[vm] Always deduplicate UnlinkedCalls in local object pools

CodeSerializationCluster::Trace uses local object pools to discover
object pool entries used by the Code object, even when code object
uses GOP.

So UnlinkedCall objects should be de-duplicated in the local
object pools to avoid stale references regardless of
--write_v8_snapshot_profile_to and --trace_precompiler_to flags.

TEST=User tested on their app.

Fixes https://github.com/dart-lang/sdk/issues/55343

Change-Id: I781dc6dc75f2fca25c1c107e224dedbaeadbc53a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361240
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Alexander Markov
2024-04-04 20:44:28 +00:00
committed by Commit Queue
parent cf4a4a3c00
commit 0833f8c011
+3 -10
View File
@@ -926,16 +926,9 @@ void ProgramVisitor::DedupUnlinkedCalls(Thread* thread) {
StackZone stack_zone(thread);
DedupUnlinkedCallsVisitor visitor(thread->zone(), thread->isolate_group());
// Note: in bare instructions mode we can still have object pools attached
// to code objects and these pools need to be deduplicated.
// We use these pools to carry information about references between code
// objects and other objects in the snapshots (these references are otherwise
// implicit and go through global object pool). This information is needed
// to produce more informative snapshot profile.
if (FLAG_write_v8_snapshot_profile_to != nullptr ||
FLAG_trace_precompiler_to != nullptr) {
WalkProgram(thread->zone(), thread->isolate_group(), &visitor);
}
// Deduplicate local object pools as they are used to trace
// objects when writing snapshots.
WalkProgram(thread->zone(), thread->isolate_group(), &visitor);
}
void ProgramVisitor::PruneSubclasses(Thread* thread) {