Add --trace-hydrogen-filter flag.
The flag restricts hydrogen.cfg output to functions passing the filter, similar to what --hydrogen-filter does for optimization in general. This is useful for investigating large repro cases where tracing all functions would lead to an impractically large hydrogen.cfg file, but restricting optimization using --hydrogen-filter is undesirable (e.g. because it might cause the issue to no longer reproduce). R=mstarzinger@chromium.org Review URL: https://codereview.chromium.org/22926025 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16302 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
dbbbaa3a38
commit
7557ca80ba
@ -362,7 +362,7 @@ OptimizingCompiler::Status OptimizingCompiler::CreateGraph() {
|
||||
}
|
||||
|
||||
// Take --hydrogen-filter into account.
|
||||
if (!info()->closure()->PassesHydrogenFilter()) {
|
||||
if (!info()->closure()->PassesFilter(FLAG_hydrogen_filter)) {
|
||||
info()->AbortOptimization();
|
||||
return SetLastStatus(BAILED_OUT);
|
||||
}
|
||||
@ -1258,9 +1258,10 @@ CompilationPhase::~CompilationPhase() {
|
||||
bool CompilationPhase::ShouldProduceTraceOutput() const {
|
||||
// Trace if the appropriate trace flag is set and the phase name's first
|
||||
// character is in the FLAG_trace_phase command line parameter.
|
||||
bool tracing_on = info()->IsStub() ?
|
||||
FLAG_trace_hydrogen_stubs :
|
||||
FLAG_trace_hydrogen;
|
||||
bool tracing_on = info()->IsStub()
|
||||
? FLAG_trace_hydrogen_stubs
|
||||
: (FLAG_trace_hydrogen &&
|
||||
info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter));
|
||||
return (tracing_on &&
|
||||
OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL);
|
||||
}
|
||||
|
@ -256,6 +256,7 @@ DEFINE_bool(collect_megamorphic_maps_from_stub_cache,
|
||||
"crankshaft harvests type feedback from stub cache")
|
||||
DEFINE_bool(hydrogen_stats, false, "print statistics for hydrogen")
|
||||
DEFINE_bool(trace_hydrogen, false, "trace generated hydrogen to file")
|
||||
DEFINE_string(trace_hydrogen_filter, "*", "hydrogen tracing filter")
|
||||
DEFINE_bool(trace_hydrogen_stubs, false, "trace generated hydrogen for stubs")
|
||||
DEFINE_string(trace_hydrogen_file, NULL, "trace hydrogen to given file name")
|
||||
DEFINE_string(trace_phase, "HLZ", "trace generated IR for specified phases")
|
||||
|
@ -9620,17 +9620,17 @@ Context* JSFunction::NativeContextFromLiterals(FixedArray* literals) {
|
||||
}
|
||||
|
||||
|
||||
bool JSFunction::PassesHydrogenFilter() {
|
||||
// The filter is a pattern that matches function names in this way:
|
||||
// "*" all; the default
|
||||
// "-" all but the top-level function
|
||||
// "-name" all but the function "name"
|
||||
// "" only the top-level function
|
||||
// "name" only the function "name"
|
||||
// "name*" only functions starting with "name"
|
||||
bool JSFunction::PassesFilter(const char* raw_filter) {
|
||||
if (*raw_filter == '*') return true;
|
||||
String* name = shared()->DebugName();
|
||||
// The filter string is a pattern that matches functions in this way:
|
||||
// "*" all; the default
|
||||
// "-" all but the top-level function
|
||||
// "-name" all but the function "name"
|
||||
// "" only the top-level function
|
||||
// "name" only the function "name"
|
||||
// "name*" only functions starting with "name"
|
||||
if (*FLAG_hydrogen_filter != '*') {
|
||||
Vector<const char> filter = CStrVector(FLAG_hydrogen_filter);
|
||||
Vector<const char> filter = CStrVector(raw_filter);
|
||||
if (filter.length() == 0) return name->length() == 0;
|
||||
if (filter[0] != '-' && name->IsUtf8EqualTo(filter)) return true;
|
||||
if (filter[0] == '-' &&
|
||||
@ -9642,9 +9642,6 @@ bool JSFunction::PassesHydrogenFilter() {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -7081,7 +7081,8 @@ class JSFunction: public JSObject {
|
||||
// Retrieve the native context from a function's literal array.
|
||||
static Context* NativeContextFromLiterals(FixedArray* literals);
|
||||
|
||||
bool PassesHydrogenFilter();
|
||||
// Used for flags such as --hydrogen-filter.
|
||||
bool PassesFilter(const char* raw_filter);
|
||||
|
||||
// Layout descriptors. The last property (from kNonWeakFieldsEndOffset to
|
||||
// kSize) is weak and has special handling during garbage collection.
|
||||
|
@ -127,7 +127,7 @@ static void GetICCounts(Code* shared_code,
|
||||
void RuntimeProfiler::Optimize(JSFunction* function, const char* reason) {
|
||||
ASSERT(function->IsOptimizable());
|
||||
|
||||
if (FLAG_trace_opt && function->PassesHydrogenFilter()) {
|
||||
if (FLAG_trace_opt && function->PassesFilter(FLAG_hydrogen_filter)) {
|
||||
PrintF("[marking ");
|
||||
function->ShortPrint();
|
||||
PrintF(" for recompilation, reason: %s", reason);
|
||||
|
Loading…
Reference in New Issue
Block a user