JS_DumpPCCounts(JSContext *cx, HandleScript script) { JS_ASSERT(script->hasScriptCounts()); Sprinter sprinter(cx); if (!sprinter.init()) return; fprintf(stdout, "--- SCRIPT %s:%d ---\n", script->filename(), (int) script->lineno()); js_DumpPCCounts(cx, script, &sprinter); fputs(sprinter.string(), stdout); fprintf(stdout, "--- END SCRIPT %s:%d ---\n", script->filename(), (int) script->lineno()); }
static bool FilterContainsLocation(HandleScript function) { static const char *filter = getenv("IONFILTER"); // If there is no filter we accept all outputs. if (!filter || !filter[0]) return true; // Disable asm.js output when filter is set. if (!function) return false; const char *filename = function->filename(); const size_t line = function->lineno(); const size_t filelen = strlen(filename); const char *index = strstr(filter, filename); while (index) { if (index == filter || index[-1] == ',') { if (index[filelen] == 0 || index[filelen] == ',') return true; if (index[filelen] == ':' && line != size_t(-1)) { size_t read_line = strtoul(&index[filelen + 1], nullptr, 10); if (read_line == line) return true; } } index = strstr(index + filelen, filename); } return false; }
void C1Spewer::beginFunction(MIRGraph *graph, HandleScript script) { if (!spewout_) return; this->graph = graph; fprintf(spewout_, "begin_compilation\n"); if (script) { fprintf(spewout_, " name \"%s:%d\"\n", script->filename(), (int)script->lineno()); fprintf(spewout_, " method \"%s:%d\"\n", script->filename(), (int)script->lineno()); } else { fprintf(spewout_, " name \"asm.js compilation\"\n"); fprintf(spewout_, " method \"asm.js compilation\"\n"); } fprintf(spewout_, " date %d\n", (int)time(nullptr)); fprintf(spewout_, "end_compilation\n"); }