Bug 1041688 - Improve IonScriptCounts -D output, r=jandem.

This commit is contained in:
Brian Hackett 2014-08-22 11:13:01 -07:00
Родитель c9effe53d4
Коммит 8e5ac9f1ae
4 изменённых файлов: 29 добавлений и 5 удалений

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

@ -3145,18 +3145,30 @@ CodeGenerator::maybeCreateScriptCounts()
MBasicBlock *block = graph.getBlock(i)->mir();
uint32_t offset = 0;
char *description = nullptr;
if (script) {
// Find a PC offset in the outermost script to use. If this block
// is from an inlined script, find a location in the outer script
// to associate information about the inlining with.
if (MResumePoint *resume = block->entryResumePoint()) {
// Find a PC offset in the outermost script to use. If this
// block is from an inlined script, find a location in the
// outer script to associate information about the inlining
// with.
while (resume->caller())
resume = resume->caller();
offset = script->pcToOffset(resume->pc());
if (block->entryResumePoint()->caller()) {
// Get the filename and line number of the inner script.
JSScript *innerScript = block->info().script();
description = (char *) js_calloc(200);
if (description) {
JS_snprintf(description, 200, "%s:%d",
innerScript->filename(), innerScript->lineno());
}
}
}
}
if (!counts->block(i).init(block->id(), offset, block->numSuccessors())) {
if (!counts->block(i).init(block->id(), offset, description, block->numSuccessors())) {
js_delete(counts);
return nullptr;
}

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

@ -642,6 +642,9 @@ struct IonBlockCounts
// was generated from.
uint32_t offset_;
// File and line of the inner script this block was generated from.
char *description_;
// ids for successors of this block.
uint32_t numSuccessors_;
uint32_t *successors_;
@ -654,9 +657,10 @@ struct IonBlockCounts
public:
bool init(uint32_t id, uint32_t offset, uint32_t numSuccessors) {
bool init(uint32_t id, uint32_t offset, char *description, uint32_t numSuccessors) {
id_ = id;
offset_ = offset;
description_ = description;
numSuccessors_ = numSuccessors;
if (numSuccessors) {
successors_ = js_pod_calloc<uint32_t>(numSuccessors);
@ -667,6 +671,7 @@ struct IonBlockCounts
}
void destroy() {
js_free(description_);
js_free(successors_);
js_free(code_);
}
@ -679,6 +684,10 @@ struct IonBlockCounts
return offset_;
}
const char *description() const {
return description_;
}
size_t numSuccessors() const {
return numSuccessors_;
}

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

@ -2343,6 +2343,7 @@ TypeCompartment::print(JSContext *cx, bool force)
{
#ifdef DEBUG
gc::AutoSuppressGC suppressGC(cx);
JSAutoRequest request(cx);
JSCompartment *compartment = this->compartment();
AutoEnterAnalysis enter(nullptr, compartment);

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

@ -225,6 +225,8 @@ js::DumpIonScriptCounts(Sprinter *sp, jit::IonScriptCounts *ionCounts)
for (size_t i = 0; i < ionCounts->numBlocks(); i++) {
const jit::IonBlockCounts &block = ionCounts->block(i);
Sprint(sp, "BB #%lu [%05u]", block.id(), block.offset());
if (block.description())
Sprint(sp, " [inlined %s]", block.description());
for (size_t j = 0; j < block.numSuccessors(); j++)
Sprint(sp, " -> #%lu", block.successor(j));
Sprint(sp, " :: %llu hits\n", block.hitCount());