| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 17 matching lines...) Expand all Loading... |
| 28 #ifndef V8_PROFILE_GENERATOR_INL_H_ | 28 #ifndef V8_PROFILE_GENERATOR_INL_H_ |
| 29 #define V8_PROFILE_GENERATOR_INL_H_ | 29 #define V8_PROFILE_GENERATOR_INL_H_ |
| 30 | 30 |
| 31 #ifdef ENABLE_LOGGING_AND_PROFILING | 31 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 32 | 32 |
| 33 #include "profile-generator.h" | 33 #include "profile-generator.h" |
| 34 | 34 |
| 35 namespace v8 { | 35 namespace v8 { |
| 36 namespace internal { | 36 namespace internal { |
| 37 | 37 |
| 38 const char* StringsStorage::GetFunctionName(String* name) { |
| 39 return GetFunctionName(GetName(name)); |
| 40 } |
| 41 |
| 42 |
| 43 const char* StringsStorage::GetFunctionName(const char* name) { |
| 44 return strlen(name) > 0 ? name : ProfileGenerator::kAnonymousFunctionName; |
| 45 } |
| 46 |
| 47 |
| 38 CodeEntry::CodeEntry(int security_token_id) | 48 CodeEntry::CodeEntry(int security_token_id) |
| 39 : call_uid_(0), | 49 : call_uid_(0), |
| 40 tag_(Logger::FUNCTION_TAG), | 50 tag_(Logger::FUNCTION_TAG), |
| 41 name_prefix_(kEmptyNamePrefix), | 51 name_prefix_(kEmptyNamePrefix), |
| 42 name_(""), | 52 name_(""), |
| 43 resource_name_(""), | 53 resource_name_(""), |
| 44 line_number_(0), | 54 line_number_(0), |
| 45 security_token_id_(security_token_id) { | 55 security_token_id_(security_token_id) { |
| 46 } | 56 } |
| 47 | 57 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 100 |
| 91 void CodeMap::MoveCode(Address from, Address to) { | 101 void CodeMap::MoveCode(Address from, Address to) { |
| 92 tree_.Move(from, to); | 102 tree_.Move(from, to); |
| 93 } | 103 } |
| 94 | 104 |
| 95 void CodeMap::DeleteCode(Address addr) { | 105 void CodeMap::DeleteCode(Address addr) { |
| 96 tree_.Remove(addr); | 106 tree_.Remove(addr); |
| 97 } | 107 } |
| 98 | 108 |
| 99 | 109 |
| 100 const char* CpuProfilesCollection::GetFunctionName(String* name) { | 110 template<class Visitor> |
| 101 return GetFunctionName(GetName(name)); | 111 void HeapEntriesMap::UpdateEntries(Visitor* visitor) { |
| 102 } | 112 for (HashMap::Entry* p = entries_.Start(); |
| 103 | 113 p != NULL; |
| 104 | 114 p = entries_.Next(p)) { |
| 105 const char* CpuProfilesCollection::GetFunctionName(const char* name) { | 115 if (!IsAlias(p->value)) { |
| 106 return strlen(name) > 0 ? name : ProfileGenerator::kAnonymousFunctionName; | 116 EntryInfo* entry_info = reinterpret_cast<EntryInfo*>(p->value); |
| 117 entry_info->entry = visitor->GetEntry( |
| 118 reinterpret_cast<HeapObject*>(p->key), |
| 119 entry_info->children_count, |
| 120 entry_info->retainers_count); |
| 121 entry_info->children_count = 0; |
| 122 entry_info->retainers_count = 0; |
| 123 } |
| 124 } |
| 107 } | 125 } |
| 108 | 126 |
| 109 | 127 |
| 110 CodeEntry* ProfileGenerator::EntryForVMState(StateTag tag) { | 128 CodeEntry* ProfileGenerator::EntryForVMState(StateTag tag) { |
| 111 switch (tag) { | 129 switch (tag) { |
| 112 case GC: | 130 case GC: |
| 113 return gc_entry_; | 131 return gc_entry_; |
| 114 case JS: | 132 case JS: |
| 115 case COMPILER: | 133 case COMPILER: |
| 116 // DOM events handlers are reported as OTHER / EXTERNAL entries. | 134 // DOM events handlers are reported as OTHER / EXTERNAL entries. |
| 117 // To avoid confusing people, let's put all these entries into | 135 // To avoid confusing people, let's put all these entries into |
| 118 // one bucket. | 136 // one bucket. |
| 119 case OTHER: | 137 case OTHER: |
| 120 case EXTERNAL: | 138 case EXTERNAL: |
| 121 return program_entry_; | 139 return program_entry_; |
| 122 default: return NULL; | 140 default: return NULL; |
| 123 } | 141 } |
| 124 } | 142 } |
| 125 | 143 |
| 126 } } // namespace v8::internal | 144 } } // namespace v8::internal |
| 127 | 145 |
| 128 #endif // ENABLE_LOGGING_AND_PROFILING | 146 #endif // ENABLE_LOGGING_AND_PROFILING |
| 129 | 147 |
| 130 #endif // V8_PROFILE_GENERATOR_INL_H_ | 148 #endif // V8_PROFILE_GENERATOR_INL_H_ |
| OLD | NEW |