| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 tag_ = source.tag_; | 127 tag_ = source.tag_; |
| 128 name_prefix_ = source.name_prefix_; | 128 name_prefix_ = source.name_prefix_; |
| 129 name_ = source.name_; | 129 name_ = source.name_; |
| 130 resource_name_ = source.resource_name_; | 130 resource_name_ = source.resource_name_; |
| 131 line_number_ = source.line_number_; | 131 line_number_ = source.line_number_; |
| 132 } | 132 } |
| 133 | 133 |
| 134 | 134 |
| 135 uint32_t CodeEntry::GetCallUid() const { | 135 uint32_t CodeEntry::GetCallUid() const { |
| 136 uint32_t hash = ComputeIntegerHash(tag_); | 136 uint32_t hash = ComputeIntegerHash(tag_); |
| 137 hash ^= static_cast<int32_t>(reinterpret_cast<intptr_t>(name_prefix_)); | 137 hash ^= ComputeIntegerHash( |
| 138 hash ^= static_cast<int32_t>(reinterpret_cast<intptr_t>(name_)); | 138 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(name_prefix_))); |
| 139 hash ^= static_cast<int32_t>(reinterpret_cast<intptr_t>(resource_name_)); | 139 hash ^= ComputeIntegerHash( |
| 140 hash ^= static_cast<int32_t>(line_number_); | 140 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(name_))); |
| 141 hash ^= ComputeIntegerHash( |
| 142 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(resource_name_))); |
| 143 hash ^= ComputeIntegerHash(line_number_); |
| 141 return hash; | 144 return hash; |
| 142 } | 145 } |
| 143 | 146 |
| 144 | 147 |
| 145 bool CodeEntry::IsSameAs(CodeEntry* entry) const { | 148 bool CodeEntry::IsSameAs(CodeEntry* entry) const { |
| 146 return this == entry | 149 return this == entry |
| 147 || (tag_ == entry->tag_ | 150 || (tag_ == entry->tag_ |
| 148 && name_prefix_ == entry->name_prefix_ | 151 && name_prefix_ == entry->name_prefix_ |
| 149 && name_ == entry->name_ | 152 && name_ == entry->name_ |
| 150 && resource_name_ == entry->resource_name_ | 153 && resource_name_ == entry->resource_name_ |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 | 438 |
| 436 const CodeMap::CodeTreeConfig::Key CodeMap::CodeTreeConfig::kNoKey = NULL; | 439 const CodeMap::CodeTreeConfig::Key CodeMap::CodeTreeConfig::kNoKey = NULL; |
| 437 const CodeMap::CodeTreeConfig::Value CodeMap::CodeTreeConfig::kNoValue = | 440 const CodeMap::CodeTreeConfig::Value CodeMap::CodeTreeConfig::kNoValue = |
| 438 CodeMap::CodeEntryInfo(NULL, 0); | 441 CodeMap::CodeEntryInfo(NULL, 0); |
| 439 | 442 |
| 440 | 443 |
| 441 void CodeMap::AddAlias(Address start, CodeEntry* entry, Address code_start) { | 444 void CodeMap::AddAlias(Address start, CodeEntry* entry, Address code_start) { |
| 442 CodeTree::Locator locator; | 445 CodeTree::Locator locator; |
| 443 if (tree_.Find(code_start, &locator)) { | 446 if (tree_.Find(code_start, &locator)) { |
| 444 const CodeEntryInfo& code_info = locator.value(); | 447 const CodeEntryInfo& code_info = locator.value(); |
| 445 entry->CopyData(*code_info.entry); | 448 if (tree_.Insert(start, &locator)) { |
| 446 tree_.Insert(start, &locator); | 449 entry->CopyData(*code_info.entry); |
| 447 locator.set_value(CodeEntryInfo(entry, code_info.size)); | 450 locator.set_value(CodeEntryInfo(entry, code_info.size)); |
| 451 } |
| 448 } | 452 } |
| 449 } | 453 } |
| 450 | 454 |
| 451 | 455 |
| 452 CodeEntry* CodeMap::FindEntry(Address addr) { | 456 CodeEntry* CodeMap::FindEntry(Address addr) { |
| 453 CodeTree::Locator locator; | 457 CodeTree::Locator locator; |
| 454 if (tree_.FindGreatestLessThan(addr, &locator)) { | 458 if (tree_.FindGreatestLessThan(addr, &locator)) { |
| 455 // locator.key() <= addr. Need to check that addr is within entry. | 459 // locator.key() <= addr. Need to check that addr is within entry. |
| 456 const CodeEntryInfo& entry = locator.value(); | 460 const CodeEntryInfo& entry = locator.value(); |
| 457 if (addr < (locator.key() + entry.size)) | 461 if (addr < (locator.key() + entry.size)) |
| (...skipping 2040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2498 void HeapSnapshotJSONSerializer::SortHashMap( | 2502 void HeapSnapshotJSONSerializer::SortHashMap( |
| 2499 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 2503 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
| 2500 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 2504 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
| 2501 sorted_entries->Add(p); | 2505 sorted_entries->Add(p); |
| 2502 sorted_entries->Sort(SortUsingEntryValue); | 2506 sorted_entries->Sort(SortUsingEntryValue); |
| 2503 } | 2507 } |
| 2504 | 2508 |
| 2505 } } // namespace v8::internal | 2509 } } // namespace v8::internal |
| 2506 | 2510 |
| 2507 #endif // ENABLE_LOGGING_AND_PROFILING | 2511 #endif // ENABLE_LOGGING_AND_PROFILING |
| OLD | NEW |