Bug 1522882: Add wasm function number to Iongraph spew; r=nbp

Differential Revision: https://phabricator.services.mozilla.com/D18192

--HG--
extra : rebase_source : d596d59a40fb660c35df7018bed605a847942ad9
This commit is contained in:
Benjamin Bouvier 2019-01-25 17:10:28 +01:00
Родитель 2ee80e7ac9
Коммит 2e4330200f
5 изменённых файлов: 25 добавлений и 7 удалений

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

@ -21,11 +21,13 @@ using namespace js::jit;
void JSONSpewer::beginFunction(JSScript* script) {
beginObject();
if (script) {
formatProperty("name", "%s:%u", script->filename(), script->lineno());
} else {
property("name", "wasm compilation");
}
formatProperty("name", "%s:%u", script->filename(), script->lineno());
beginListProperty("passes");
}
void JSONSpewer::beginWasmFunction(unsigned funcIndex) {
beginObject();
formatProperty("name", "wasm-func%u", funcIndex);
beginListProperty("passes");
}

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

@ -28,6 +28,7 @@ class JSONSpewer : JSONPrinter {
explicit JSONSpewer(GenericPrinter& out) : JSONPrinter(out) {}
void beginFunction(JSScript* script);
void beginWasmFunction(unsigned funcIndex);
void beginPass(const char* pass);
void spewMDef(MDefinition* def);
void spewMResumePoint(MResumePoint* rp);

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

@ -245,9 +245,15 @@ void GraphSpewer::beginFunction(JSScript* function) {
if (!isSpewing()) {
return;
}
jsonSpewer_.beginFunction(function);
ionspewer.beginFunction();
}
void GraphSpewer::beginWasmFunction(unsigned funcIndex) {
if (!isSpewing()) {
return;
}
jsonSpewer_.beginWasmFunction(funcIndex);
ionspewer.beginFunction();
}
@ -321,6 +327,12 @@ void jit::SpewBeginFunction(MIRGenerator* mir, JSScript* function) {
mir->graphSpewer().beginFunction(function);
}
void jit::SpewBeginWasmFunction(MIRGenerator* mir, unsigned funcIndex) {
MIRGraph* graph = &mir->graph();
mir->graphSpewer().init(graph, nullptr);
mir->graphSpewer().beginWasmFunction(funcIndex);
}
AutoSpewEndFunction::~AutoSpewEndFunction() {
mir_->graphSpewer().endFunction();
}

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

@ -135,6 +135,7 @@ class GraphSpewer {
bool isSpewing() const { return graph_; }
void init(MIRGraph* graph, JSScript* function);
void beginFunction(JSScript* function);
void beginWasmFunction(unsigned funcIndex);
void spewPass(const char* pass);
void spewPass(const char* pass, BacktrackingAllocator* ra);
void endFunction();
@ -143,6 +144,8 @@ class GraphSpewer {
};
void SpewBeginFunction(MIRGenerator* mir, JSScript* function);
void SpewBeginWasmFunction(MIRGenerator* mir, unsigned funcIndex);
class AutoSpewEndFunction {
private:
MIRGenerator* mir_;

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

@ -4070,7 +4070,7 @@ bool wasm::IonCompileFunctions(const ModuleEnvironment& env, LifoAlloc& lifo,
// Compile MIR graph
{
jit::SpewBeginFunction(&mir, nullptr);
jit::SpewBeginWasmFunction(&mir, func.index);
jit::AutoSpewEndFunction spewEndFunction(&mir);
if (!OptimizeMIR(&mir)) {