| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 DeleteArray(reinterpret_cast<const char*>(p->value)); | 103 DeleteArray(reinterpret_cast<const char*>(p->value)); |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 | 107 |
| 108 const char* StringsStorage::GetCopy(const char* src) { | 108 const char* StringsStorage::GetCopy(const char* src) { |
| 109 int len = static_cast<int>(strlen(src)); | 109 int len = static_cast<int>(strlen(src)); |
| 110 Vector<char> dst = Vector<char>::New(len + 1); | 110 Vector<char> dst = Vector<char>::New(len + 1); |
| 111 OS::StrNCpy(dst, src, len); | 111 OS::StrNCpy(dst, src, len); |
| 112 dst[len] = '\0'; | 112 dst[len] = '\0'; |
| 113 uint32_t hash = HashSequentialString(dst.start(), len); | 113 uint32_t hash = HashSequentialString(dst.start(), len, ISOLATE->HasherSeed()); |
| 114 return AddOrDisposeString(dst.start(), hash); | 114 return AddOrDisposeString(dst.start(), hash); |
| 115 } | 115 } |
| 116 | 116 |
| 117 | 117 |
| 118 const char* StringsStorage::GetFormatted(const char* format, ...) { | 118 const char* StringsStorage::GetFormatted(const char* format, ...) { |
| 119 va_list args; | 119 va_list args; |
| 120 va_start(args, format); | 120 va_start(args, format); |
| 121 const char* result = GetVFormatted(format, args); | 121 const char* result = GetVFormatted(format, args); |
| 122 va_end(args); | 122 va_end(args); |
| 123 return result; | 123 return result; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 136 } | 136 } |
| 137 | 137 |
| 138 | 138 |
| 139 const char* StringsStorage::GetVFormatted(const char* format, va_list args) { | 139 const char* StringsStorage::GetVFormatted(const char* format, va_list args) { |
| 140 Vector<char> str = Vector<char>::New(1024); | 140 Vector<char> str = Vector<char>::New(1024); |
| 141 int len = OS::VSNPrintF(str, format, args); | 141 int len = OS::VSNPrintF(str, format, args); |
| 142 if (len == -1) { | 142 if (len == -1) { |
| 143 DeleteArray(str.start()); | 143 DeleteArray(str.start()); |
| 144 return format; | 144 return format; |
| 145 } | 145 } |
| 146 uint32_t hash = HashSequentialString(str.start(), len); | 146 uint32_t hash = HashSequentialString(str.start(), len, ISOLATE->HasherSeed()); |
| 147 return AddOrDisposeString(str.start(), hash); | 147 return AddOrDisposeString(str.start(), hash); |
| 148 } | 148 } |
| 149 | 149 |
| 150 | 150 |
| 151 const char* StringsStorage::GetName(String* name) { | 151 const char* StringsStorage::GetName(String* name) { |
| 152 if (name->IsString()) { | 152 if (name->IsString()) { |
| 153 int length = Min(kMaxNameSize, name->length()); | 153 int length = Min(kMaxNameSize, name->length()); |
| 154 SmartArrayPointer<char> data = | 154 SmartArrayPointer<char> data = |
| 155 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL, 0, length); | 155 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL, 0, length); |
| 156 uint32_t hash = HashSequentialString(*data, length); | 156 uint32_t hash = |
| 157 HashSequentialString(*data, length, name->GetIsolate()->HasherSeed()); |
| 157 return AddOrDisposeString(data.Detach(), hash); | 158 return AddOrDisposeString(data.Detach(), hash); |
| 158 } | 159 } |
| 159 return ""; | 160 return ""; |
| 160 } | 161 } |
| 161 | 162 |
| 162 | 163 |
| 163 const char* StringsStorage::GetName(int index) { | 164 const char* StringsStorage::GetName(int index) { |
| 164 return GetFormatted("%d", index); | 165 return GetFormatted("%d", index); |
| 165 } | 166 } |
| 166 | 167 |
| (...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1494 raw_entry, AddressHash(reinterpret_cast<Address>(raw_entry))); | 1495 raw_entry, AddressHash(reinterpret_cast<Address>(raw_entry))); |
| 1495 } | 1496 } |
| 1496 delete entries_; | 1497 delete entries_; |
| 1497 entries_ = new_entries; | 1498 entries_ = new_entries; |
| 1498 } | 1499 } |
| 1499 | 1500 |
| 1500 | 1501 |
| 1501 uint64_t HeapObjectsMap::GenerateId(v8::RetainedObjectInfo* info) { | 1502 uint64_t HeapObjectsMap::GenerateId(v8::RetainedObjectInfo* info) { |
| 1502 uint64_t id = static_cast<uint64_t>(info->GetHash()); | 1503 uint64_t id = static_cast<uint64_t>(info->GetHash()); |
| 1503 const char* label = info->GetLabel(); | 1504 const char* label = info->GetLabel(); |
| 1504 id ^= HashSequentialString(label, static_cast<int>(strlen(label))); | 1505 id ^= HashSequentialString(label, |
| 1506 static_cast<int>(strlen(label)), |
| 1507 ISOLATE->HasherSeed()); |
| 1505 intptr_t element_count = info->GetElementCount(); | 1508 intptr_t element_count = info->GetElementCount(); |
| 1506 if (element_count != -1) | 1509 if (element_count != -1) |
| 1507 id ^= ComputeIntegerHash(static_cast<uint32_t>(element_count)); | 1510 id ^= ComputeIntegerHash(static_cast<uint32_t>(element_count)); |
| 1508 return id << 1; | 1511 return id << 1; |
| 1509 } | 1512 } |
| 1510 | 1513 |
| 1511 | 1514 |
| 1512 HeapSnapshotsCollection::HeapSnapshotsCollection() | 1515 HeapSnapshotsCollection::HeapSnapshotsCollection() |
| 1513 : is_tracking_objects_(false), | 1516 : is_tracking_objects_(false), |
| 1514 snapshots_uids_(HeapSnapshotsMatch), | 1517 snapshots_uids_(HeapSnapshotsMatch), |
| (...skipping 2114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3629 | 3632 |
| 3630 | 3633 |
| 3631 void HeapSnapshotJSONSerializer::SortHashMap( | 3634 void HeapSnapshotJSONSerializer::SortHashMap( |
| 3632 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 3635 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
| 3633 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 3636 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
| 3634 sorted_entries->Add(p); | 3637 sorted_entries->Add(p); |
| 3635 sorted_entries->Sort(SortUsingEntryValue); | 3638 sorted_entries->Sort(SortUsingEntryValue); |
| 3636 } | 3639 } |
| 3637 | 3640 |
| 3638 } } // namespace v8::internal | 3641 } } // namespace v8::internal |
| OLD | NEW |