Chromium Code Reviews| 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 2398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2409 HeapSnapshot* result = new HeapSnapshot(snapshot_->collection(), | 2409 HeapSnapshot* result = new HeapSnapshot(snapshot_->collection(), |
| 2410 snapshot_->title(), | 2410 snapshot_->title(), |
| 2411 snapshot_->uid()); | 2411 snapshot_->uid()); |
| 2412 result->AddRootEntry(); | 2412 result->AddRootEntry(); |
| 2413 const char* text = snapshot_->collection()->names()->GetFormatted( | 2413 const char* text = snapshot_->collection()->names()->GetFormatted( |
| 2414 "The snapshot is too big. " | 2414 "The snapshot is too big. " |
| 2415 "Maximum snapshot size is %" V8_PTR_PREFIX "u MB. " | 2415 "Maximum snapshot size is %" V8_PTR_PREFIX "u MB. " |
| 2416 "Actual snapshot size is %" V8_PTR_PREFIX "u MB.", | 2416 "Actual snapshot size is %" V8_PTR_PREFIX "u MB.", |
| 2417 SnapshotSizeConstants<kPointerSize>::kMaxSerializableSnapshotRawSize / MB, | 2417 SnapshotSizeConstants<kPointerSize>::kMaxSerializableSnapshotRawSize / MB, |
| 2418 (snapshot_->RawSnapshotSize() + MB - 1) / MB); | 2418 (snapshot_->RawSnapshotSize() + MB - 1) / MB); |
| 2419 HeapEntry* message = result->AddEntry(HeapEntry::kString, text, 0, 4); | 2419 HeapEntry* message = result->AddEntry(HeapEntry::kObject, text, 0, 4); |
| 2420 result->root()->SetIndexedReference(HeapGraphEdge::kElement, 1, message); | 2420 result->root()->SetNamedReference(HeapGraphEdge::kShortcut, "", message); |
|
yurys
2013/04/18 07:05:41
Can you add a test for this?
alph
2013/04/18 09:09:08
To trigger this code execution I have to create a
| |
| 2421 result->FillChildren(); | 2421 result->FillChildren(); |
| 2422 return result; | 2422 return result; |
| 2423 } | 2423 } |
| 2424 | 2424 |
| 2425 | 2425 |
| 2426 void HeapSnapshotJSONSerializer::SerializeImpl() { | 2426 void HeapSnapshotJSONSerializer::SerializeImpl() { |
| 2427 ASSERT(0 == snapshot_->root()->index()); | 2427 ASSERT(0 == snapshot_->root()->index()); |
| 2428 writer_->AddCharacter('{'); | 2428 writer_->AddCharacter('{'); |
| 2429 writer_->AddString("\"snapshot\":{"); | 2429 writer_->AddString("\"snapshot\":{"); |
| 2430 SerializeSnapshot(); | 2430 SerializeSnapshot(); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2694 | 2694 |
| 2695 | 2695 |
| 2696 void HeapSnapshotJSONSerializer::SortHashMap( | 2696 void HeapSnapshotJSONSerializer::SortHashMap( |
| 2697 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 2697 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
| 2698 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 2698 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
| 2699 sorted_entries->Add(p); | 2699 sorted_entries->Add(p); |
| 2700 sorted_entries->Sort(SortUsingEntryValue); | 2700 sorted_entries->Sort(SortUsingEntryValue); |
| 2701 } | 2701 } |
| 2702 | 2702 |
| 2703 } } // namespace v8::internal | 2703 } } // namespace v8::internal |
| OLD | NEW |