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

Unified Diff: runtime/vm/thread.cc

Issue 2845053003: Fix asserts in StackFrameIterator which were effectively disabled (Closed)
Patch Set: Add StackFrameIterator::{ValidationPolicy,CrossThreadPolicy} enums Created 3 years, 8 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 | « runtime/vm/stack_trace.cc ('k') | runtime/vm/weak_code.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread.cc
diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc
index 12d1ff75a6a32130663659454b1da7cffd182627..0bc57d40c29969da53224ec95f0c73aece6c01df 100644
--- a/runtime/vm/thread.cc
+++ b/runtime/vm/thread.cc
@@ -709,8 +709,26 @@ void Thread::VisitObjectPointers(ObjectPointerVisitor* visitor,
scope = scope->previous();
}
+ // The MarkTask, which calls this method, can run on a different thread. We
+ // therefore assume the mutator is at a safepoint and we can iterate it's
+ // stack.
+ // TODO(vm-team): It would be beneficial to be able to ask the mutator thread
+ // whether it is in fact blocked at the moment (at a "safepoint") so we can
+ // safely iterate it's stack.
+ //
+ // Unfortunately we cannot use `this->IsAtSafepoint()` here because that will
+ // return `false` even though the mutator thread is waiting for mark tasks
+ // (which iterate it's stack) to finish.
+ const StackFrameIterator::CrossThreadPolicy cross_thread_policy =
+ StackFrameIterator::kAllowCrossThreadIteration;
+
+ const StackFrameIterator::ValidationPolicy validation_policy =
+ validate_frames ? StackFrameIterator::kValidateFrames
+ : StackFrameIterator::kDontValidateFrames;
+
// Iterate over all the stack frames and visit objects on the stack.
- StackFrameIterator frames_iterator(top_exit_frame_info(), validate_frames);
+ StackFrameIterator frames_iterator(top_exit_frame_info(), validation_policy,
+ this, cross_thread_policy);
StackFrame* frame = frames_iterator.NextFrame();
while (frame != NULL) {
frame->VisitObjectPointers(visitor);
« no previous file with comments | « runtime/vm/stack_trace.cc ('k') | runtime/vm/weak_code.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698