Bug 719878 - AllFramesIter does not find all frames when the current segment contains only a native call (r=sfink)

--HG--
extra : rebase_source : c9f22d1ee0e2aa0501ad90ffe51a7ed1c13f9f33
This commit is contained in:
Luke Wagner 2012-01-20 16:00:26 -08:00
parent 24d33794fd
commit 30a4dc8306
2 changed files with 17 additions and 11 deletions

View File

@ -1122,22 +1122,27 @@ StackIter::operator==(const StackIter &rhs) const
AllFramesIter::AllFramesIter(StackSpace &space)
: seg_(space.seg_),
fp_(seg_ ? seg_->maybefp() : NULL)
{}
{
settle();
}
AllFramesIter&
AllFramesIter::operator++()
{
JS_ASSERT(!done());
fp_ = fp_->prev();
if (!seg_->contains(fp_)) {
seg_ = seg_->prevInMemory();
while (seg_) {
fp_ = seg_->maybefp();
if (fp_)
return *this;
seg_ = seg_->prevInMemory();
}
JS_ASSERT(!fp_);
}
settle();
return *this;
}
void
AllFramesIter::settle()
{
while (seg_ && (!fp_ || !seg_->contains(fp_))) {
seg_ = seg_->prevInMemory();
fp_ = seg_ ? seg_->maybefp() : NULL;
}
JS_ASSERT(!!seg_ == !!fp_);
JS_ASSERT_IF(fp_, seg_->contains(fp_));
}

View File

@ -1576,6 +1576,7 @@ class AllFramesIter
StackFrame *fp() const { return fp_; }
private:
void settle();
StackSegment *seg_;
StackFrame *fp_;
};