Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Unified Diff: runtime/vm/code_generator.cc

Issue 2395123003: Make adding a pending deopt atomic. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/isolate.h » ('j') | runtime/vm/isolate.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_generator.cc
diff --git a/runtime/vm/code_generator.cc b/runtime/vm/code_generator.cc
index fcb9f5c074b59aec501bba670c4b508f3d9c51ae..158eb0bebea37c62e140452901c25d1fdaf2b560 100644
--- a/runtime/vm/code_generator.cc
+++ b/runtime/vm/code_generator.cc
@@ -2048,20 +2048,13 @@ void DeoptimizeAt(const Code& optimized_code, StackFrame* frame) {
uword deopt_pc = frame->pc();
ASSERT(optimized_code.ContainsInstructionAt(deopt_pc));
- // N.B.: Update the pending deopt table before updating the frame. The
- // profiler may attempt a stack walk in between.
- MallocGrowableArray<PendingLazyDeopt>* pending_deopts =
- thread->isolate()->pending_deopts();
- for (intptr_t i = 0; i < pending_deopts->length(); i++) {
- ASSERT((*pending_deopts)[i].fp() != frame->fp());
- }
- PendingLazyDeopt pair(frame->fp(), deopt_pc);
- pending_deopts->Add(pair);
-
#if defined(DEBUG)
ValidateFrames();
#endif
+ // N.B.: Update the pending deopt table before updating the frame. The
+ // profiler may attempt a stack walk in between.
+ thread->isolate()->AddPendingDeopt(frame->fp(), deopt_pc);
frame->MarkForLazyDeopt();
if (FLAG_trace_deoptimization) {
@@ -2168,40 +2161,18 @@ DEFINE_LEAF_RUNTIME_ENTRY(intptr_t, DeoptimizeCopyFrame,
#if !defined(TARGET_ARCH_DBC)
if (is_lazy_deopt) {
- uword deopt_pc = 0;
- MallocGrowableArray<PendingLazyDeopt>* pending_deopts =
- isolate->pending_deopts();
- for (intptr_t i = 0; i < pending_deopts->length(); i++) {
- if ((*pending_deopts)[i].fp() == caller_frame->fp()) {
- deopt_pc = (*pending_deopts)[i].pc();
- break;
- }
- }
-#if defined(DEBUG)
- // Check for conflicting entries.
- for (intptr_t i = 0; i < pending_deopts->length(); i++) {
- if ((*pending_deopts)[i].fp() == caller_frame->fp()) {
- ASSERT((*pending_deopts)[i].pc() == deopt_pc);
- }
- }
-#endif
+ uword deopt_pc = isolate->FindPendingDeopt(caller_frame->fp());
if (FLAG_trace_deoptimization) {
THR_Print("Lazy deopt fp=%" Pp " pc=%" Pp "\n",
caller_frame->fp(), deopt_pc);
}
- ASSERT(deopt_pc != 0);
// N.B.: Update frame before updating pending deopt table. The profiler
// may attempt a stack walk in between.
caller_frame->set_pc(deopt_pc);
ASSERT(caller_frame->pc() == deopt_pc);
ASSERT(optimized_code.ContainsInstructionAt(caller_frame->pc()));
-
- for (intptr_t i = pending_deopts->length() - 1; i >= 0; i--) {
- if ((*pending_deopts)[i].fp() <= caller_frame->fp()) {
- pending_deopts->RemoveAt(i);
- }
- }
+ isolate->ClearPendingDeoptsAtOrBelow(caller_frame->fp());
} else {
if (FLAG_trace_deoptimization) {
THR_Print("Eager deopt fp=%" Pp " pc=%" Pp "\n",
« no previous file with comments | « no previous file | runtime/vm/isolate.h » ('j') | runtime/vm/isolate.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698