| 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 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 void Apply(HeapEntry* entry) { } | 945 void Apply(HeapEntry* entry) { } |
| 946 }; | 946 }; |
| 947 | 947 |
| 948 void HeapEntry::PaintAllReachable() { | 948 void HeapEntry::PaintAllReachable() { |
| 949 NullClass null; | 949 NullClass null; |
| 950 ApplyAndPaintAllReachable(&null); | 950 ApplyAndPaintAllReachable(&null); |
| 951 } | 951 } |
| 952 | 952 |
| 953 | 953 |
| 954 void HeapEntry::Print(int max_depth, int indent) { | 954 void HeapEntry::Print(int max_depth, int indent) { |
| 955 OS::Print("%6d %6d %6d [%ld] ", | 955 OS::Print("%6d %6d %6d [%llu, %d] ", |
| 956 self_size(), ReachableSize(), RetainedSize(), id_); | 956 self_size(), ReachableSize(), RetainedSize(), id_, painted_); |
| 957 if (type() != kString) { | 957 if (type() != kString) { |
| 958 OS::Print("%s %.40s\n", TypeAsString(), name_); | 958 OS::Print("%s %.40s\n", TypeAsString(), name_); |
| 959 } else { | 959 } else { |
| 960 OS::Print("\""); | 960 OS::Print("\""); |
| 961 const char* c = name_; | 961 const char* c = name_; |
| 962 while (*c && (c - name_) <= 40) { | 962 while (*c && (c - name_) <= 40) { |
| 963 if (*c != '\n') | 963 if (*c != '\n') |
| 964 OS::Print("%c", *c); | 964 OS::Print("%c", *c); |
| 965 else | 965 else |
| 966 OS::Print("\\n"); | 966 OS::Print("\\n"); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1230 } // namespace | 1230 } // namespace |
| 1231 | 1231 |
| 1232 HeapSnapshot::HeapSnapshot(HeapSnapshotsCollection* collection, | 1232 HeapSnapshot::HeapSnapshot(HeapSnapshotsCollection* collection, |
| 1233 HeapSnapshot::Type type, | 1233 HeapSnapshot::Type type, |
| 1234 const char* title, | 1234 const char* title, |
| 1235 unsigned uid) | 1235 unsigned uid) |
| 1236 : collection_(collection), | 1236 : collection_(collection), |
| 1237 type_(type), | 1237 type_(type), |
| 1238 title_(title), | 1238 title_(title), |
| 1239 uid_(uid), | 1239 uid_(uid), |
| 1240 root_entry_index_(-1), | 1240 root_entry_(NULL), |
| 1241 raw_entries_(NULL), | 1241 raw_entries_(NULL), |
| 1242 entries_sorted_(false) { | 1242 entries_sorted_(false) { |
| 1243 STATIC_ASSERT( | 1243 STATIC_ASSERT( |
| 1244 sizeof(HeapGraphEdge) == | 1244 sizeof(HeapGraphEdge) == |
| 1245 SnapshotSizeConstants<sizeof(void*)>::kExpectedHeapGraphEdgeSize); // NOL
INT | 1245 SnapshotSizeConstants<sizeof(void*)>::kExpectedHeapGraphEdgeSize); // NOL
INT |
| 1246 STATIC_ASSERT( | 1246 STATIC_ASSERT( |
| 1247 sizeof(HeapEntry) == | 1247 sizeof(HeapEntry) == |
| 1248 SnapshotSizeConstants<sizeof(void*)>::kExpectedHeapEntrySize); // NOLINT | 1248 SnapshotSizeConstants<sizeof(void*)>::kExpectedHeapEntrySize); // NOLINT |
| 1249 } | 1249 } |
| 1250 | 1250 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1269 raw_entries_size_ = | 1269 raw_entries_size_ = |
| 1270 HeapEntry::EntriesSize(entries_count, children_count, retainers_count); | 1270 HeapEntry::EntriesSize(entries_count, children_count, retainers_count); |
| 1271 #endif | 1271 #endif |
| 1272 } | 1272 } |
| 1273 | 1273 |
| 1274 | 1274 |
| 1275 HeapEntry* HeapSnapshot::AddEntry(HeapObject* object, | 1275 HeapEntry* HeapSnapshot::AddEntry(HeapObject* object, |
| 1276 int children_count, | 1276 int children_count, |
| 1277 int retainers_count) { | 1277 int retainers_count) { |
| 1278 if (object == kInternalRootObject) { | 1278 if (object == kInternalRootObject) { |
| 1279 ASSERT(root_entry_index_ == -1); | 1279 ASSERT(root_entry_ == NULL); |
| 1280 root_entry_index_ = entries_.length(); | |
| 1281 ASSERT(retainers_count == 0); | 1280 ASSERT(retainers_count == 0); |
| 1282 return AddEntry( | 1281 root_entry_ = AddEntry( |
| 1283 HeapEntry::kInternal, "", 0, 0, children_count, retainers_count); | 1282 HeapEntry::kInternal, "", 0, 0, children_count, retainers_count); |
| 1283 return root_entry_; |
| 1284 } else if (object->IsJSFunction()) { | 1284 } else if (object->IsJSFunction()) { |
| 1285 JSFunction* func = JSFunction::cast(object); | 1285 JSFunction* func = JSFunction::cast(object); |
| 1286 SharedFunctionInfo* shared = func->shared(); | 1286 SharedFunctionInfo* shared = func->shared(); |
| 1287 String* name = String::cast(shared->name())->length() > 0 ? | 1287 String* name = String::cast(shared->name())->length() > 0 ? |
| 1288 String::cast(shared->name()) : shared->inferred_name(); | 1288 String::cast(shared->name()) : shared->inferred_name(); |
| 1289 return AddEntry(object, | 1289 return AddEntry(object, |
| 1290 HeapEntry::kClosure, | 1290 HeapEntry::kClosure, |
| 1291 collection_->GetFunctionName(name), | 1291 collection_->GetFunctionName(name), |
| 1292 children_count, | 1292 children_count, |
| 1293 retainers_count); | 1293 retainers_count); |
| (...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2502 void HeapSnapshotJSONSerializer::SortHashMap( | 2502 void HeapSnapshotJSONSerializer::SortHashMap( |
| 2503 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 2503 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
| 2504 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)) |
| 2505 sorted_entries->Add(p); | 2505 sorted_entries->Add(p); |
| 2506 sorted_entries->Sort(SortUsingEntryValue); | 2506 sorted_entries->Sort(SortUsingEntryValue); |
| 2507 } | 2507 } |
| 2508 | 2508 |
| 2509 } } // namespace v8::internal | 2509 } } // namespace v8::internal |
| 2510 | 2510 |
| 2511 #endif // ENABLE_LOGGING_AND_PROFILING | 2511 #endif // ENABLE_LOGGING_AND_PROFILING |
| OLD | NEW |