[vm/concurrency] Avoid O(n) traversal of isolates to find pending deopt

To avoid a O(n) traversal of isolates in order to find pending deopts,
we'll move the pending deopt state to the Thread. It's really a property
of a thread: when the thread's stack gets unwound - via return or
exceptional flow - we remove pending deopts.

This CL also encapsulates the pending deopt logic into a [PendingDeopts]
class - thereby avoiding logic around manipulating this array being
spread around. It simplifies the already very big [Isolate] class.

TEST=Refactoring of existing code.

Issue https://github.com/dart-lang/sdk/issues/36097
Closes https://github.com/dart-lang/sdk/issues/45168

Change-Id: I5a9b18c577f21a0f2a88332b1bc26641ec39d2af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188521
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
This commit is contained in:
Martin Kustermann
2021-03-03 09:31:53 +00:00
committed by commit-bot@chromium.org
parent 197fe0c193
commit 700ba716cd
11 changed files with 182 additions and 138 deletions
+1 -1
View File
@@ -143,7 +143,7 @@ class StackFrame : public ValueObject {
fp() + (kSavedCallerPcSlotFromFp * kWordSize)));
ASSERT(raw_pc != StubCode::DeoptimizeLazyFromThrow().EntryPoint());
if (raw_pc == StubCode::DeoptimizeLazyFromReturn().EntryPoint()) {
return isolate_group()->FindPendingDeoptAtSafepoint(GetCallerFp());
return thread_->pending_deopts().FindPendingDeopt(GetCallerFp());
}
return raw_pc;
}