Bug 1057082 - Part 2 - Fix JitcodeGlobalEntry comparison function and add helper debug methods. r=luke

This commit is contained in:
Kannan Vijayan 2014-09-12 13:56:43 -04:00
Родитель e87ece8d18
Коммит 96255113a0
1 изменённых файлов: 18 добавлений и 1 удалений

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

@ -123,7 +123,24 @@ JitcodeGlobalEntry::compare(const JitcodeGlobalEntry &ent1, const JitcodeGlobalE
// Ensure no overlaps for non-query lookups.
JS_ASSERT_IF(!ent1.isQuery() && !ent2.isQuery(), !ent1.overlapsWith(ent2));
return ComparePointers(ent1.nativeStartAddr(), ent2.nativeStartAddr());
// For two non-query entries, just comapare the start addresses.
if (!ent1.isQuery() && !ent2.isQuery())
return ComparePointers(ent1.nativeStartAddr(), ent2.nativeStartAddr());
void *ptr = ent1.isQuery() ? ent1.nativeStartAddr() : ent2.nativeStartAddr();
const JitcodeGlobalEntry &ent = ent1.isQuery() ? ent2 : ent1;
int flip = ent1.isQuery() ? 1 : -1;
if (ent.startsBelowPointer(ptr)) {
if (ent.endsAbovePointer(ptr))
return 0;
// query ptr > entry
return flip * 1;
}
// query ptr < entry
return flip * -1;
}
bool