Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(808)

Unified Diff: runtime/vm/code_generator.cc

Issue 25446003: Improve --optimization-filter to accept a comma-separated list of strings. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_generator.cc
===================================================================
--- runtime/vm/code_generator.cc (revision 27994)
+++ runtime/vm/code_generator.cc (working copy)
@@ -1239,11 +1239,28 @@
function.set_usage_counter(kLowInvocationCount);
return false;
}
- if ((FLAG_optimization_filter != NULL) &&
- (strstr(function.ToFullyQualifiedCString(),
- FLAG_optimization_filter) == NULL)) {
- function.set_usage_counter(kLowInvocationCount);
- return false;
+ if (FLAG_optimization_filter != NULL) {
+ // FLAG_optimization_filter is a comma-separated list of strings that are
+ // matched against the fully-qualified function name.
+ char* save_ptr; // Needed for strtok_r.
+ const char* function_name = function.ToFullyQualifiedCString();
+ intptr_t len = strlen(FLAG_optimization_filter) + 1; // Length with \0.
+ char* filter = new char[len];
+ strncpy(filter, FLAG_optimization_filter, len); // strtok modifies arg 1.
+ char* token = strtok_r(filter, ",", &save_ptr);
+ bool found = false;
+ while (token != NULL) {
Kevin Millikin (Google) 2013/10/14 11:09:28 Without the found flag :) char* token = NULL; do
+ if (strstr(function_name, token) != NULL) {
+ found = true;
+ break;
+ }
+ token = strtok_r(NULL, ",", &save_ptr);
+ }
+ delete[] filter;
+ if (!found) {
+ function.set_usage_counter(kLowInvocationCount);
+ return false;
+ }
}
if (!function.is_optimizable()) {
if (FLAG_trace_failed_optimization_attempts) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698