| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } else { | 114 } else { |
| 115 DeleteArray(c_name); | 115 DeleteArray(c_name); |
| 116 } | 116 } |
| 117 return reinterpret_cast<const char*>(cache_entry->value); | 117 return reinterpret_cast<const char*>(cache_entry->value); |
| 118 } | 118 } |
| 119 return ""; | 119 return ""; |
| 120 } | 120 } |
| 121 | 121 |
| 122 | 122 |
| 123 const char* CodeEntry::kEmptyNamePrefix = ""; | 123 const char* CodeEntry::kEmptyNamePrefix = ""; |
| 124 unsigned CodeEntry::next_call_uid_ = 1; | |
| 125 | 124 |
| 126 | 125 |
| 127 void CodeEntry::CopyData(const CodeEntry& source) { | 126 void CodeEntry::CopyData(const CodeEntry& source) { |
| 128 call_uid_ = source.call_uid_; | |
| 129 tag_ = source.tag_; | 127 tag_ = source.tag_; |
| 130 name_prefix_ = source.name_prefix_; | 128 name_prefix_ = source.name_prefix_; |
| 131 name_ = source.name_; | 129 name_ = source.name_; |
| 132 resource_name_ = source.resource_name_; | 130 resource_name_ = source.resource_name_; |
| 133 line_number_ = source.line_number_; | 131 line_number_ = source.line_number_; |
| 134 } | 132 } |
| 135 | 133 |
| 136 | 134 |
| 135 uint32_t CodeEntry::GetCallUid() const { |
| 136 uint32_t hash = ComputeIntegerHash(tag_); |
| 137 hash ^= static_cast<int32_t>(reinterpret_cast<intptr_t>(name_prefix_)); |
| 138 hash ^= static_cast<int32_t>(reinterpret_cast<intptr_t>(name_)); |
| 139 hash ^= static_cast<int32_t>(reinterpret_cast<intptr_t>(resource_name_)); |
| 140 hash ^= static_cast<int32_t>(line_number_); |
| 141 return hash; |
| 142 } |
| 143 |
| 144 |
| 145 bool CodeEntry::IsSameAs(CodeEntry* entry) const { |
| 146 return this == entry |
| 147 || (tag_ == entry->tag_ |
| 148 && name_prefix_ == entry->name_prefix_ |
| 149 && name_ == entry->name_ |
| 150 && resource_name_ == entry->resource_name_ |
| 151 && line_number_ == entry->line_number_); |
| 152 } |
| 153 |
| 154 |
| 137 ProfileNode* ProfileNode::FindChild(CodeEntry* entry) { | 155 ProfileNode* ProfileNode::FindChild(CodeEntry* entry) { |
| 138 HashMap::Entry* map_entry = | 156 HashMap::Entry* map_entry = |
| 139 children_.Lookup(entry, CodeEntryHash(entry), false); | 157 children_.Lookup(entry, CodeEntryHash(entry), false); |
| 140 return map_entry != NULL ? | 158 return map_entry != NULL ? |
| 141 reinterpret_cast<ProfileNode*>(map_entry->value) : NULL; | 159 reinterpret_cast<ProfileNode*>(map_entry->value) : NULL; |
| 142 } | 160 } |
| 143 | 161 |
| 144 | 162 |
| 145 ProfileNode* ProfileNode::FindOrAddChild(CodeEntry* entry) { | 163 ProfileNode* ProfileNode::FindOrAddChild(CodeEntry* entry) { |
| 146 HashMap::Entry* map_entry = | 164 HashMap::Entry* map_entry = |
| (...skipping 2333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2480 void HeapSnapshotJSONSerializer::SortHashMap( | 2498 void HeapSnapshotJSONSerializer::SortHashMap( |
| 2481 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 2499 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
| 2482 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 2500 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
| 2483 sorted_entries->Add(p); | 2501 sorted_entries->Add(p); |
| 2484 sorted_entries->Sort(SortUsingEntryValue); | 2502 sorted_entries->Sort(SortUsingEntryValue); |
| 2485 } | 2503 } |
| 2486 | 2504 |
| 2487 } } // namespace v8::internal | 2505 } } // namespace v8::internal |
| 2488 | 2506 |
| 2489 #endif // ENABLE_LOGGING_AND_PROFILING | 2507 #endif // ENABLE_LOGGING_AND_PROFILING |
| OLD | NEW |