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

Unified Diff: runtime/vm/stack_frame.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_frame.h ('k') | runtime/vm/stack_frame_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stack_frame.cc
diff --git a/runtime/vm/stack_frame.cc b/runtime/vm/stack_frame.cc
index d89797df39c17e626289be29b670818901480573..40674cb107088173d422ee941c4f41caea34a378 100644
--- a/runtime/vm/stack_frame.cc
+++ b/runtime/vm/stack_frame.cc
@@ -68,7 +68,6 @@ void ExitFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) {
void EntryFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) {
- ASSERT(thread() == Thread::Current());
// Visit objects between SP and (FP - callee_save_area).
ASSERT(visitor != NULL);
#if !defined(TARGET_ARCH_DBC)
@@ -86,7 +85,6 @@ void EntryFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) {
void StackFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) {
- ASSERT(thread() == Thread::Current());
ASSERT(visitor != NULL);
// NOTE: This code runs while GC is in progress and runs within
// a NoHandleScope block. Hence it is not ok to use regular Zone or
@@ -346,30 +344,33 @@ static void UnpoisonStack(uword fp) {
}
-StackFrameIterator::StackFrameIterator(bool validate, Thread* thread)
- : validate_(validate),
+StackFrameIterator::StackFrameIterator(ValidationPolicy validation_policy,
+ Thread* thread,
+ CrossThreadPolicy cross_thread_policy)
+ : validate_(validation_policy == kValidateFrames),
entry_(thread),
exit_(thread),
frames_(thread),
current_frame_(NULL),
thread_(thread) {
- ASSERT((thread_ == Thread::Current()) ||
- OS::AllowStackFrameIteratorFromAnotherThread());
+ ASSERT(cross_thread_policy == kAllowCrossThreadIteration ||
+ thread_ == Thread::Current());
SetupLastExitFrameData(); // Setup data for last exit frame.
}
StackFrameIterator::StackFrameIterator(uword last_fp,
- bool validate,
- Thread* thread)
- : validate_(validate),
+ ValidationPolicy validation_policy,
+ Thread* thread,
+ CrossThreadPolicy cross_thread_policy)
+ : validate_(validation_policy == kValidateFrames),
entry_(thread),
exit_(thread),
frames_(thread),
current_frame_(NULL),
thread_(thread) {
- ASSERT((thread_ == Thread::Current()) ||
- OS::AllowStackFrameIteratorFromAnotherThread());
+ ASSERT(cross_thread_policy == kAllowCrossThreadIteration ||
+ thread_ == Thread::Current());
frames_.fp_ = last_fp;
frames_.sp_ = 0;
frames_.pc_ = 0;
@@ -380,16 +381,17 @@ StackFrameIterator::StackFrameIterator(uword last_fp,
StackFrameIterator::StackFrameIterator(uword fp,
uword sp,
uword pc,
- bool validate,
- Thread* thread)
- : validate_(validate),
+ ValidationPolicy validation_policy,
+ Thread* thread,
+ CrossThreadPolicy cross_thread_policy)
+ : validate_(validation_policy == kValidateFrames),
entry_(thread),
exit_(thread),
frames_(thread),
current_frame_(NULL),
thread_(thread) {
- ASSERT((thread_ == Thread::Current()) ||
- OS::AllowStackFrameIteratorFromAnotherThread());
+ ASSERT(cross_thread_policy == kAllowCrossThreadIteration ||
+ thread_ == Thread::Current());
frames_.fp_ = fp;
frames_.sp_ = sp;
frames_.pc_ = pc;
@@ -577,7 +579,9 @@ intptr_t InlinedFunctionsIterator::GetDeoptFpOffset() const {
#if defined(DEBUG)
void ValidateFrames() {
- StackFrameIterator frames(StackFrameIterator::kValidateFrames);
+ StackFrameIterator frames(StackFrameIterator::kValidateFrames,
+ Thread::Current(),
+ StackFrameIterator::kNoCrossThreadIteration);
StackFrame* frame = frames.NextFrame();
while (frame != NULL) {
frame = frames.NextFrame();
« no previous file with comments | « runtime/vm/stack_frame.h ('k') | runtime/vm/stack_frame_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698