OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 return | 565 return |
566 sizeof(*this) + | 566 sizeof(*this) + |
567 sizeof(HashMap::Entry) * entries_map_.capacity() + | 567 sizeof(HashMap::Entry) * entries_map_.capacity() + |
568 GetMemoryUsedByList(entries_) + | 568 GetMemoryUsedByList(entries_) + |
569 GetMemoryUsedByList(time_intervals_); | 569 GetMemoryUsedByList(time_intervals_); |
570 } | 570 } |
571 | 571 |
572 | 572 |
573 HeapSnapshotsCollection::HeapSnapshotsCollection(Heap* heap) | 573 HeapSnapshotsCollection::HeapSnapshotsCollection(Heap* heap) |
574 : is_tracking_objects_(false), | 574 : is_tracking_objects_(false), |
575 token_enumerator_(new TokenEnumerator()), | |
576 ids_(heap) { | 575 ids_(heap) { |
577 } | 576 } |
578 | 577 |
579 | 578 |
580 static void DeleteHeapSnapshot(HeapSnapshot** snapshot_ptr) { | 579 static void DeleteHeapSnapshot(HeapSnapshot** snapshot_ptr) { |
581 delete *snapshot_ptr; | 580 delete *snapshot_ptr; |
582 } | 581 } |
583 | 582 |
584 | 583 |
585 HeapSnapshotsCollection::~HeapSnapshotsCollection() { | 584 HeapSnapshotsCollection::~HeapSnapshotsCollection() { |
586 delete token_enumerator_; | |
587 snapshots_.Iterate(DeleteHeapSnapshot); | 585 snapshots_.Iterate(DeleteHeapSnapshot); |
588 } | 586 } |
589 | 587 |
590 | 588 |
591 HeapSnapshot* HeapSnapshotsCollection::NewSnapshot(const char* name, | 589 HeapSnapshot* HeapSnapshotsCollection::NewSnapshot(const char* name, |
592 unsigned uid) { | 590 unsigned uid) { |
593 is_tracking_objects_ = true; // Start watching for heap objects moves. | 591 is_tracking_objects_ = true; // Start watching for heap objects moves. |
594 return new HeapSnapshot(this, name, uid); | 592 return new HeapSnapshot(this, name, uid); |
595 } | 593 } |
596 | 594 |
(...skipping 2069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2666 | 2664 |
2667 | 2665 |
2668 void HeapSnapshotJSONSerializer::SortHashMap( | 2666 void HeapSnapshotJSONSerializer::SortHashMap( |
2669 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 2667 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
2670 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 2668 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
2671 sorted_entries->Add(p); | 2669 sorted_entries->Add(p); |
2672 sorted_entries->Sort(SortUsingEntryValue); | 2670 sorted_entries->Sort(SortUsingEntryValue); |
2673 } | 2671 } |
2674 | 2672 |
2675 } } // namespace v8::internal | 2673 } } // namespace v8::internal |
OLD | NEW |