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

Unified Diff: runtime/vm/isolate.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
Index: runtime/vm/isolate.cc
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index ce70212bbd033d77f42cea55bac3df1fb43ecccb..50353e820c9f0d1821531bb861e8ff3464d07864 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -1907,6 +1907,45 @@ RawClass* Isolate::GetClassForHeapWalkAt(intptr_t cid) {
}
+void Isolate::AddPendingDeopt(uword fp, uword pc) {
+ // GrowableArray::Add is not atomic and may be interrupt by a profiler
siva 2016/10/10 04:10:26 may be interrupted ...
+ // stack walk.
+ MallocGrowableArray<PendingLazyDeopt>* old_pending_deopts = pending_deopts_;
+ MallocGrowableArray<PendingLazyDeopt>* new_pending_deopts
+ = new MallocGrowableArray<PendingLazyDeopt>(
+ old_pending_deopts->length() + 1);
+ for (intptr_t i = 0; i < old_pending_deopts->length(); i++) {
+ ASSERT((*old_pending_deopts)[i].fp() != fp);
+ new_pending_deopts->Add((*old_pending_deopts)[i]);
+ }
+ PendingLazyDeopt deopt(fp, pc);
+ new_pending_deopts->Add(deopt);
+
+ pending_deopts_ = new_pending_deopts;
+ delete old_pending_deopts;
+}
+
+
+uword Isolate::FindPendingDeopt(uword fp) const {
+ for (intptr_t i = 0; i < pending_deopts_->length(); i++) {
+ if ((*pending_deopts_)[i].fp() == fp) {
+ return (*pending_deopts_)[i].pc();
+ }
+ }
+ FATAL("Missing pending deopt entry");
+ return 0;
siva 2016/10/10 04:10:26 Can another thread be executing this code while Ad
+}
+
+
+void Isolate::ClearPendingDeoptsAtOrBelow(uword fp) const {
+ for (intptr_t i = pending_deopts_->length() - 1; i >= 0; i--) {
+ if ((*pending_deopts_)[i].fp() <= fp) {
+ pending_deopts_->RemoveAt(i);
+ }
+ }
siva 2016/10/10 04:10:26 Same question about this function.
+}
+
+
#ifndef PRODUCT
static const char* ExceptionPauseInfoToServiceEnum(Dart_ExceptionPauseInfo pi) {
switch (pi) {
« runtime/vm/isolate.h ('K') | « runtime/vm/isolate.h ('k') | runtime/vm/stack_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698