Bug 978262 - Ignore duplicate frames when getting BHR stack. r=froydnj

This commit is contained in:
Jim Chen 2014-03-05 08:47:46 -05:00
parent 1599acb8ce
commit f00f89649e

View File

@ -183,12 +183,20 @@ ThreadStackHelper::FillStackBuffer() {
// Go from front to back
const volatile StackEntry* entry = mPseudoStack->mStack;
const volatile StackEntry* end = entry + mPseudoStack->stackSize();
// Deduplicate identical, consecutive frames
const char* prevLabel = nullptr;
for (; reservedSize-- && entry != end; entry++) {
/* We only accept non-copy labels, because
we are unable to actually copy labels here */
if (!entry->isCopyLabel()) {
mStackBuffer.infallibleAppend(entry->label());
if (entry->isCopyLabel()) {
continue;
}
const char* const label = entry->label();
if (label == prevLabel) {
continue;
}
mStackBuffer.infallibleAppend(label);
prevLabel = label;
}
// If we exited early due to buffer size, expand the buffer for next time
mMaxStackSize += (end - entry);