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
Родитель 1599acb8ce
Коммит f00f89649e
1 изменённых файлов: 10 добавлений и 2 удалений

Просмотреть файл

@ -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);