| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } else { | 113 } else { |
| 114 DeleteArray(c_name); | 114 DeleteArray(c_name); |
| 115 } | 115 } |
| 116 return reinterpret_cast<const char*>(cache_entry->value); | 116 return reinterpret_cast<const char*>(cache_entry->value); |
| 117 } | 117 } |
| 118 return ""; | 118 return ""; |
| 119 } | 119 } |
| 120 | 120 |
| 121 | 121 |
| 122 const char* CodeEntry::kEmptyNamePrefix = ""; | 122 const char* CodeEntry::kEmptyNamePrefix = ""; |
| 123 unsigned CodeEntry::next_call_uid_ = 1; | |
| 124 | 123 |
| 125 | 124 |
| 126 void CodeEntry::CopyData(const CodeEntry& source) { | 125 void CodeEntry::CopyData(const CodeEntry& source) { |
| 127 call_uid_ = source.call_uid_; | |
| 128 tag_ = source.tag_; | 126 tag_ = source.tag_; |
| 129 name_prefix_ = source.name_prefix_; | 127 name_prefix_ = source.name_prefix_; |
| 130 name_ = source.name_; | 128 name_ = source.name_; |
| 131 resource_name_ = source.resource_name_; | 129 resource_name_ = source.resource_name_; |
| 132 line_number_ = source.line_number_; | 130 line_number_ = source.line_number_; |
| 133 } | 131 } |
| 134 | 132 |
| 135 | 133 |
| 134 uint32_t CodeEntry::GetCallUid() const { |
| 135 uint32_t hash = ComputeIntegerHash(tag_); |
| 136 hash ^= static_cast<int32_t>(reinterpret_cast<intptr_t>(name_prefix_)); |
| 137 hash ^= static_cast<int32_t>(reinterpret_cast<intptr_t>(name_)); |
| 138 hash ^= static_cast<int32_t>(reinterpret_cast<intptr_t>(resource_name_)); |
| 139 hash ^= static_cast<int32_t>(line_number_); |
| 140 return hash; |
| 141 } |
| 142 |
| 143 |
| 144 bool CodeEntry::IsSameAs(CodeEntry* entry) const { |
| 145 return this == entry |
| 146 || (tag_ == entry->tag_ |
| 147 && name_prefix_ == entry->name_prefix_ |
| 148 && name_ == entry->name_ |
| 149 && resource_name_ == entry->resource_name_ |
| 150 && line_number_ == entry->line_number_); |
| 151 } |
| 152 |
| 153 |
| 136 ProfileNode* ProfileNode::FindChild(CodeEntry* entry) { | 154 ProfileNode* ProfileNode::FindChild(CodeEntry* entry) { |
| 137 HashMap::Entry* map_entry = | 155 HashMap::Entry* map_entry = |
| 138 children_.Lookup(entry, CodeEntryHash(entry), false); | 156 children_.Lookup(entry, CodeEntryHash(entry), false); |
| 139 return map_entry != NULL ? | 157 return map_entry != NULL ? |
| 140 reinterpret_cast<ProfileNode*>(map_entry->value) : NULL; | 158 reinterpret_cast<ProfileNode*>(map_entry->value) : NULL; |
| 141 } | 159 } |
| 142 | 160 |
| 143 | 161 |
| 144 ProfileNode* ProfileNode::FindOrAddChild(CodeEntry* entry) { | 162 ProfileNode* ProfileNode::FindOrAddChild(CodeEntry* entry) { |
| 145 HashMap::Entry* map_entry = | 163 HashMap::Entry* map_entry = |
| (...skipping 1982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2128 HeapEntry* entry = added_entries[i]; | 2146 HeapEntry* entry = added_entries[i]; |
| 2129 if (entry->painted_reachable()) | 2147 if (entry->painted_reachable()) |
| 2130 diff->AddAddedEntry(add_child_index++, added_entry_index++, entry); | 2148 diff->AddAddedEntry(add_child_index++, added_entry_index++, entry); |
| 2131 } | 2149 } |
| 2132 return diff; | 2150 return diff; |
| 2133 } | 2151 } |
| 2134 | 2152 |
| 2135 } } // namespace v8::internal | 2153 } } // namespace v8::internal |
| 2136 | 2154 |
| 2137 #endif // ENABLE_LOGGING_AND_PROFILING | 2155 #endif // ENABLE_LOGGING_AND_PROFILING |
| OLD | NEW |