Change --hydrogen-filter to allow specifying a negative filter for optimized functions.

When prepending a '-' to the function name, the function will not be optimized.

--hydrogen-filter=foo works as before.

--hydrogen-filter=-foo means don't optimize foo.
Review URL: https://chromiumcodereview.appspot.com/9691042

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11036 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 2e7cb8aa
...@@ -71,13 +71,6 @@ void CodeGenerator::MakeCodePrologue(CompilationInfo* info) { ...@@ -71,13 +71,6 @@ void CodeGenerator::MakeCodePrologue(CompilationInfo* info) {
} else { } else {
print_source = FLAG_print_source; print_source = FLAG_print_source;
print_ast = FLAG_print_ast; print_ast = FLAG_print_ast;
Vector<const char> filter = CStrVector(FLAG_hydrogen_filter);
if (print_source && !filter.is_empty()) {
print_source = info->function()->name()->IsEqualTo(filter);
}
if (print_ast && !filter.is_empty()) {
print_ast = info->function()->name()->IsEqualTo(filter);
}
ftype = "user-defined"; ftype = "user-defined";
} }
...@@ -124,11 +117,9 @@ void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) { ...@@ -124,11 +117,9 @@ void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) {
bool print_code = Isolate::Current()->bootstrapper()->IsActive() bool print_code = Isolate::Current()->bootstrapper()->IsActive()
? FLAG_print_builtin_code ? FLAG_print_builtin_code
: (FLAG_print_code || (info->IsOptimizing() && FLAG_print_opt_code)); : (FLAG_print_code || (info->IsOptimizing() && FLAG_print_opt_code));
Vector<const char> filter = CStrVector(FLAG_hydrogen_filter); if (print_code) {
FunctionLiteral* function = info->function();
bool match = filter.is_empty() || function->debug_name()->IsEqualTo(filter);
if (print_code && match) {
// Print the source code if available. // Print the source code if available.
FunctionLiteral* function = info->function();
Handle<Script> script = info->script(); Handle<Script> script = info->script();
if (!script->IsUndefined() && !script->source()->IsUndefined()) { if (!script->IsUndefined() && !script->source()->IsUndefined()) {
PrintF("--- Raw source ---\n"); PrintF("--- Raw source ---\n");
......
...@@ -243,12 +243,15 @@ static bool MakeCrankshaftCode(CompilationInfo* info) { ...@@ -243,12 +243,15 @@ static bool MakeCrankshaftCode(CompilationInfo* info) {
} }
// Take --hydrogen-filter into account. // Take --hydrogen-filter into account.
Vector<const char> filter = CStrVector(FLAG_hydrogen_filter);
Handle<String> name = info->function()->debug_name(); Handle<String> name = info->function()->debug_name();
bool match = filter.is_empty() || name->IsEqualTo(filter); if (*FLAG_hydrogen_filter != '\0') {
if (!match) { Vector<const char> filter = CStrVector(FLAG_hydrogen_filter);
info->SetCode(code); if ((filter[0] == '-'
return true; && name->IsEqualTo(filter.SubVector(1, filter.length())))
|| (filter[0] != '-' && !name->IsEqualTo(filter))) {
info->SetCode(code);
return true;
}
} }
// Recompile the unoptimized version of the code if the current version // Recompile the unoptimized version of the code if the current version
......
...@@ -159,7 +159,7 @@ DEFINE_bool(string_slices, true, "use string slices") ...@@ -159,7 +159,7 @@ DEFINE_bool(string_slices, true, "use string slices")
// Flags for Crankshaft. // Flags for Crankshaft.
DEFINE_bool(crankshaft, true, "use crankshaft") DEFINE_bool(crankshaft, true, "use crankshaft")
DEFINE_string(hydrogen_filter, "", "hydrogen use/trace filter") DEFINE_string(hydrogen_filter, "", "optimization filter")
DEFINE_bool(use_range, true, "use hydrogen range analysis") DEFINE_bool(use_range, true, "use hydrogen range analysis")
DEFINE_bool(eliminate_dead_phis, true, "eliminate dead phis") DEFINE_bool(eliminate_dead_phis, true, "eliminate dead phis")
DEFINE_bool(use_gvn, true, "use hydrogen global value numbering") DEFINE_bool(use_gvn, true, "use hydrogen global value numbering")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment