mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 801775 - Filter IonMonkey C1/Ion spew based on scripts' origin. r=sstangl
This commit is contained in:
parent
bf3de8f80f
commit
00b2d8a0b4
@ -26,6 +26,7 @@ static IonSpewer ionspewer;
|
|||||||
|
|
||||||
static bool LoggingChecked = false;
|
static bool LoggingChecked = false;
|
||||||
static uint32_t LoggingBits = 0;
|
static uint32_t LoggingBits = 0;
|
||||||
|
static uint32_t filteredOutCompilations = 0;
|
||||||
|
|
||||||
static const char *ChannelNames[] =
|
static const char *ChannelNames[] =
|
||||||
{
|
{
|
||||||
@ -34,6 +35,32 @@ static const char *ChannelNames[] =
|
|||||||
#undef IONSPEW_CHANNEL
|
#undef IONSPEW_CHANNEL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static bool
|
||||||
|
FilterContainsLocation(const char *filename, const size_t line = size_t(-1))
|
||||||
|
{
|
||||||
|
static const char *filter = getenv("IONFILTER");
|
||||||
|
|
||||||
|
// If there is no filter we accept all outputs.
|
||||||
|
if (!filter || !filter[0])
|
||||||
|
return true;
|
||||||
|
|
||||||
|
static 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], NULL, 10);
|
||||||
|
if (read_line == line)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
index = strstr(index + filelen, filename);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ion::EnableIonDebugLogging()
|
ion::EnableIonDebugLogging()
|
||||||
{
|
{
|
||||||
@ -93,12 +120,25 @@ IonSpewer::init()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
IonSpewer::isSpewingFunction() const
|
||||||
|
{
|
||||||
|
return inited_ && graph;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
IonSpewer::beginFunction(MIRGraph *graph, HandleScript function)
|
IonSpewer::beginFunction(MIRGraph *graph, HandleScript function)
|
||||||
{
|
{
|
||||||
if (!inited_)
|
if (!inited_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!FilterContainsLocation(function->filename, function->lineno)) {
|
||||||
|
JS_ASSERT(!this->function);
|
||||||
|
// filter out logs during the compilation.
|
||||||
|
filteredOutCompilations++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this->graph = graph;
|
this->graph = graph;
|
||||||
this->function = function;
|
this->function = function;
|
||||||
|
|
||||||
@ -109,7 +149,7 @@ IonSpewer::beginFunction(MIRGraph *graph, HandleScript function)
|
|||||||
void
|
void
|
||||||
IonSpewer::spewPass(const char *pass)
|
IonSpewer::spewPass(const char *pass)
|
||||||
{
|
{
|
||||||
if (!inited_)
|
if (!isSpewingFunction())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
c1Spewer.spewPass(pass);
|
c1Spewer.spewPass(pass);
|
||||||
@ -122,7 +162,7 @@ IonSpewer::spewPass(const char *pass)
|
|||||||
void
|
void
|
||||||
IonSpewer::spewPass(const char *pass, LinearScanAllocator *ra)
|
IonSpewer::spewPass(const char *pass, LinearScanAllocator *ra)
|
||||||
{
|
{
|
||||||
if (!inited_)
|
if (!isSpewingFunction())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
c1Spewer.spewPass(pass);
|
c1Spewer.spewPass(pass);
|
||||||
@ -137,11 +177,15 @@ IonSpewer::spewPass(const char *pass, LinearScanAllocator *ra)
|
|||||||
void
|
void
|
||||||
IonSpewer::endFunction()
|
IonSpewer::endFunction()
|
||||||
{
|
{
|
||||||
if (!inited_)
|
if (!isSpewingFunction()) {
|
||||||
|
filteredOutCompilations--;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
c1Spewer.endFunction();
|
c1Spewer.endFunction();
|
||||||
jsonSpewer.endFunction();
|
jsonSpewer.endFunction();
|
||||||
|
|
||||||
|
this->graph = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -311,14 +355,13 @@ ion::IonSpewHeader(IonSpewChannel channel)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
fprintf(stderr, "[%s] ", ChannelNames[channel]);
|
fprintf(stderr, "[%s] ", ChannelNames[channel]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ion::IonSpewEnabled(IonSpewChannel channel)
|
ion::IonSpewEnabled(IonSpewChannel channel)
|
||||||
{
|
{
|
||||||
JS_ASSERT(LoggingChecked);
|
JS_ASSERT(LoggingChecked);
|
||||||
return LoggingBits & (1 << uint32_t(channel));
|
return (LoggingBits & (1 << uint32_t(channel))) && !filteredOutCompilations;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -79,7 +79,6 @@ class IonSpewer
|
|||||||
JSONSpewer jsonSpewer;
|
JSONSpewer jsonSpewer;
|
||||||
bool inited_;
|
bool inited_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IonSpewer()
|
IonSpewer()
|
||||||
: graph(NULL), function(NullPtr()), inited_(false)
|
: graph(NULL), function(NullPtr()), inited_(false)
|
||||||
@ -90,6 +89,7 @@ class IonSpewer
|
|||||||
|
|
||||||
bool init();
|
bool init();
|
||||||
void beginFunction(MIRGraph *graph, HandleScript);
|
void beginFunction(MIRGraph *graph, HandleScript);
|
||||||
|
bool isSpewingFunction() const;
|
||||||
void spewPass(const char *pass);
|
void spewPass(const char *pass);
|
||||||
void spewPass(const char *pass, LinearScanAllocator *ra);
|
void spewPass(const char *pass, LinearScanAllocator *ra);
|
||||||
void endFunction();
|
void endFunction();
|
||||||
|
Loading…
Reference in New Issue
Block a user