Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index daa5a4a5bdad825e7d73fc42531df9e23ac848b6..2a5fea22ee8b2be93e441c241fa4cc9ccac1a843 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -9032,6 +9032,23 @@ void String::PrintOn(FILE* file) { |
} |
+bool String::PassesFilter(const char* raw_filter) { |
+ if (*raw_filter == '*') return true; |
+ Vector<const char> filter = CStrVector(raw_filter); |
+ if (filter.length() == 0) return this->length() == 0; |
+ if (filter[0] != '-' && this->IsUtf8EqualTo(filter)) return true; |
+ if (filter[0] == '-' && |
+ !this->IsUtf8EqualTo(filter.SubVector(1, filter.length()))) { |
+ return true; |
+ } |
+ if (filter[filter.length() - 1] == '*' && |
+ this->IsUtf8EqualTo(filter.SubVector(0, filter.length() - 1), true)) { |
+ return true; |
+ } |
+ return false; |
+} |
+ |
+ |
static void TrimEnumCache(Heap* heap, Map* map, DescriptorArray* descriptors) { |
int live_enum = map->EnumLength(); |
if (live_enum == Map::kInvalidEnumCache) { |
@@ -9621,30 +9638,7 @@ Context* JSFunction::NativeContextFromLiterals(FixedArray* literals) { |
bool JSFunction::PassesHydrogenFilter() { |
- 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); |
- if (filter.length() == 0) return name->length() == 0; |
- if (filter[0] != '-' && name->IsUtf8EqualTo(filter)) return true; |
- if (filter[0] == '-' && |
- !name->IsUtf8EqualTo(filter.SubVector(1, filter.length()))) { |
- return true; |
- } |
- if (filter[filter.length() - 1] == '*' && |
- name->IsUtf8EqualTo(filter.SubVector(0, filter.length() - 1), true)) { |
- return true; |
- } |
- return false; |
- } |
- |
- return true; |
+ return shared()->DebugName()->PassesFilter(FLAG_hydrogen_filter); |
} |