| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 9014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9025 | 9025 |
| 9026 | 9026 |
| 9027 void String::PrintOn(FILE* file) { | 9027 void String::PrintOn(FILE* file) { |
| 9028 int length = this->length(); | 9028 int length = this->length(); |
| 9029 for (int i = 0; i < length; i++) { | 9029 for (int i = 0; i < length; i++) { |
| 9030 PrintF(file, "%c", Get(i)); | 9030 PrintF(file, "%c", Get(i)); |
| 9031 } | 9031 } |
| 9032 } | 9032 } |
| 9033 | 9033 |
| 9034 | 9034 |
| 9035 bool String::PassesFilter(const char* raw_filter) { |
| 9036 if (*raw_filter == '*') return true; |
| 9037 Vector<const char> filter = CStrVector(raw_filter); |
| 9038 if (filter.length() == 0) return this->length() == 0; |
| 9039 if (filter[0] != '-' && this->IsUtf8EqualTo(filter)) return true; |
| 9040 if (filter[0] == '-' && |
| 9041 !this->IsUtf8EqualTo(filter.SubVector(1, filter.length()))) { |
| 9042 return true; |
| 9043 } |
| 9044 if (filter[filter.length() - 1] == '*' && |
| 9045 this->IsUtf8EqualTo(filter.SubVector(0, filter.length() - 1), true)) { |
| 9046 return true; |
| 9047 } |
| 9048 return false; |
| 9049 } |
| 9050 |
| 9051 |
| 9035 static void TrimEnumCache(Heap* heap, Map* map, DescriptorArray* descriptors) { | 9052 static void TrimEnumCache(Heap* heap, Map* map, DescriptorArray* descriptors) { |
| 9036 int live_enum = map->EnumLength(); | 9053 int live_enum = map->EnumLength(); |
| 9037 if (live_enum == Map::kInvalidEnumCache) { | 9054 if (live_enum == Map::kInvalidEnumCache) { |
| 9038 live_enum = map->NumberOfDescribedProperties(OWN_DESCRIPTORS, DONT_ENUM); | 9055 live_enum = map->NumberOfDescribedProperties(OWN_DESCRIPTORS, DONT_ENUM); |
| 9039 } | 9056 } |
| 9040 if (live_enum == 0) return descriptors->ClearEnumCache(); | 9057 if (live_enum == 0) return descriptors->ClearEnumCache(); |
| 9041 | 9058 |
| 9042 FixedArray* enum_cache = descriptors->GetEnumCache(); | 9059 FixedArray* enum_cache = descriptors->GetEnumCache(); |
| 9043 | 9060 |
| 9044 int to_trim = enum_cache->length() - live_enum; | 9061 int to_trim = enum_cache->length() - live_enum; |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9614 PrintF(out, "%s", *name); | 9631 PrintF(out, "%s", *name); |
| 9615 } | 9632 } |
| 9616 | 9633 |
| 9617 | 9634 |
| 9618 Context* JSFunction::NativeContextFromLiterals(FixedArray* literals) { | 9635 Context* JSFunction::NativeContextFromLiterals(FixedArray* literals) { |
| 9619 return Context::cast(literals->get(JSFunction::kLiteralNativeContextIndex)); | 9636 return Context::cast(literals->get(JSFunction::kLiteralNativeContextIndex)); |
| 9620 } | 9637 } |
| 9621 | 9638 |
| 9622 | 9639 |
| 9623 bool JSFunction::PassesHydrogenFilter() { | 9640 bool JSFunction::PassesHydrogenFilter() { |
| 9624 String* name = shared()->DebugName(); | 9641 return shared()->DebugName()->PassesFilter(FLAG_hydrogen_filter); |
| 9625 // The filter string is a pattern that matches functions in this way: | |
| 9626 // "*" all; the default | |
| 9627 // "-" all but the top-level function | |
| 9628 // "-name" all but the function "name" | |
| 9629 // "" only the top-level function | |
| 9630 // "name" only the function "name" | |
| 9631 // "name*" only functions starting with "name" | |
| 9632 if (*FLAG_hydrogen_filter != '*') { | |
| 9633 Vector<const char> filter = CStrVector(FLAG_hydrogen_filter); | |
| 9634 if (filter.length() == 0) return name->length() == 0; | |
| 9635 if (filter[0] != '-' && name->IsUtf8EqualTo(filter)) return true; | |
| 9636 if (filter[0] == '-' && | |
| 9637 !name->IsUtf8EqualTo(filter.SubVector(1, filter.length()))) { | |
| 9638 return true; | |
| 9639 } | |
| 9640 if (filter[filter.length() - 1] == '*' && | |
| 9641 name->IsUtf8EqualTo(filter.SubVector(0, filter.length() - 1), true)) { | |
| 9642 return true; | |
| 9643 } | |
| 9644 return false; | |
| 9645 } | |
| 9646 | |
| 9647 return true; | |
| 9648 } | 9642 } |
| 9649 | 9643 |
| 9650 | 9644 |
| 9651 MaybeObject* Oddball::Initialize(const char* to_string, | 9645 MaybeObject* Oddball::Initialize(const char* to_string, |
| 9652 Object* to_number, | 9646 Object* to_number, |
| 9653 byte kind) { | 9647 byte kind) { |
| 9654 String* internalized_to_string; | 9648 String* internalized_to_string; |
| 9655 { MaybeObject* maybe_string = | 9649 { MaybeObject* maybe_string = |
| 9656 Isolate::Current()->heap()->InternalizeUtf8String( | 9650 Isolate::Current()->heap()->InternalizeUtf8String( |
| 9657 CStrVector(to_string)); | 9651 CStrVector(to_string)); |
| (...skipping 6294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15952 #define ERROR_MESSAGES_TEXTS(C, T) T, | 15946 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 15953 static const char* error_messages_[] = { | 15947 static const char* error_messages_[] = { |
| 15954 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 15948 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 15955 }; | 15949 }; |
| 15956 #undef ERROR_MESSAGES_TEXTS | 15950 #undef ERROR_MESSAGES_TEXTS |
| 15957 return error_messages_[reason]; | 15951 return error_messages_[reason]; |
| 15958 } | 15952 } |
| 15959 | 15953 |
| 15960 | 15954 |
| 15961 } } // namespace v8::internal | 15955 } } // namespace v8::internal |
| OLD | NEW |