OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3599 | 3599 |
3600 void HeapSnapshotJSONSerializer::SerializeSnapshot() { | 3600 void HeapSnapshotJSONSerializer::SerializeSnapshot() { |
3601 writer_->AddString("\"title\":\""); | 3601 writer_->AddString("\"title\":\""); |
3602 writer_->AddString(snapshot_->title()); | 3602 writer_->AddString(snapshot_->title()); |
3603 writer_->AddString("\""); | 3603 writer_->AddString("\""); |
3604 writer_->AddString(",\"uid\":"); | 3604 writer_->AddString(",\"uid\":"); |
3605 writer_->AddNumber(snapshot_->uid()); | 3605 writer_->AddNumber(snapshot_->uid()); |
3606 writer_->AddString(",\"meta\":"); | 3606 writer_->AddString(",\"meta\":"); |
3607 // The object describing node serialization layout. | 3607 // The object describing node serialization layout. |
3608 // We use a set of macros to improve readability. | 3608 // We use a set of macros to improve readability. |
3609 #define JSON_A(s) "["s"]" | 3609 #define JSON_A(s) "[" s "]" |
3610 #define JSON_O(s) "{"s"}" | 3610 #define JSON_O(s) "{" s "}" |
3611 #define JSON_S(s) "\""s"\"" | 3611 #define JSON_S(s) "\"" s "\"" |
3612 writer_->AddString(JSON_O( | 3612 writer_->AddString(JSON_O( |
3613 JSON_S("node_fields") ":" JSON_A( | 3613 JSON_S("node_fields") ":" JSON_A( |
3614 JSON_S("type") "," | 3614 JSON_S("type") "," |
3615 JSON_S("name") "," | 3615 JSON_S("name") "," |
3616 JSON_S("id") "," | 3616 JSON_S("id") "," |
3617 JSON_S("self_size") "," | 3617 JSON_S("self_size") "," |
3618 JSON_S("retained_size") "," | 3618 JSON_S("retained_size") "," |
3619 JSON_S("dominator") "," | 3619 JSON_S("dominator") "," |
3620 JSON_S("edges_index")) "," | 3620 JSON_S("edges_index")) "," |
3621 JSON_S("node_types") ":" JSON_A( | 3621 JSON_S("node_types") ":" JSON_A( |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3748 | 3748 |
3749 | 3749 |
3750 void HeapSnapshotJSONSerializer::SortHashMap( | 3750 void HeapSnapshotJSONSerializer::SortHashMap( |
3751 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 3751 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
3752 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 3752 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
3753 sorted_entries->Add(p); | 3753 sorted_entries->Add(p); |
3754 sorted_entries->Sort(SortUsingEntryValue); | 3754 sorted_entries->Sort(SortUsingEntryValue); |
3755 } | 3755 } |
3756 | 3756 |
3757 } } // namespace v8::internal | 3757 } } // namespace v8::internal |
OLD | NEW |