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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 case kHidden: return "/hidden/"; | 168 case kHidden: return "/hidden/"; |
169 case kObject: return "/object/"; | 169 case kObject: return "/object/"; |
170 case kClosure: return "/closure/"; | 170 case kClosure: return "/closure/"; |
171 case kString: return "/string/"; | 171 case kString: return "/string/"; |
172 case kCode: return "/code/"; | 172 case kCode: return "/code/"; |
173 case kArray: return "/array/"; | 173 case kArray: return "/array/"; |
174 case kRegExp: return "/regexp/"; | 174 case kRegExp: return "/regexp/"; |
175 case kHeapNumber: return "/number/"; | 175 case kHeapNumber: return "/number/"; |
176 case kNative: return "/native/"; | 176 case kNative: return "/native/"; |
177 case kSynthetic: return "/synthetic/"; | 177 case kSynthetic: return "/synthetic/"; |
| 178 case kConsString: return "/concatenated string/"; |
| 179 case kSlicedString: return "/sliced string/"; |
178 default: return "???"; | 180 default: return "???"; |
179 } | 181 } |
180 } | 182 } |
181 | 183 |
182 | 184 |
183 // It is very important to keep objects that form a heap snapshot | 185 // It is very important to keep objects that form a heap snapshot |
184 // as small as possible. | 186 // as small as possible. |
185 namespace { // Avoid littering the global namespace. | 187 namespace { // Avoid littering the global namespace. |
186 | 188 |
187 template <size_t ptr_size> struct SnapshotSizeConstants; | 189 template <size_t ptr_size> struct SnapshotSizeConstants; |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 const char* name = collection_->names()->GetName( | 777 const char* name = collection_->names()->GetName( |
776 GetConstructorName(JSObject::cast(object))); | 778 GetConstructorName(JSObject::cast(object))); |
777 if (object->IsJSGlobalObject()) { | 779 if (object->IsJSGlobalObject()) { |
778 const char* tag = objects_tags_.GetTag(object); | 780 const char* tag = objects_tags_.GetTag(object); |
779 if (tag != NULL) { | 781 if (tag != NULL) { |
780 name = collection_->names()->GetFormatted("%s / %s", name, tag); | 782 name = collection_->names()->GetFormatted("%s / %s", name, tag); |
781 } | 783 } |
782 } | 784 } |
783 return AddEntry(object, HeapEntry::kObject, name); | 785 return AddEntry(object, HeapEntry::kObject, name); |
784 } else if (object->IsString()) { | 786 } else if (object->IsString()) { |
| 787 String* string = String::cast(object); |
| 788 if (string->IsConsString()) |
| 789 return AddEntry(object, |
| 790 HeapEntry::kConsString, |
| 791 "(concatenated string)"); |
| 792 if (string->IsSlicedString()) |
| 793 return AddEntry(object, |
| 794 HeapEntry::kSlicedString, |
| 795 "(sliced string)"); |
785 return AddEntry(object, | 796 return AddEntry(object, |
786 HeapEntry::kString, | 797 HeapEntry::kString, |
787 collection_->names()->GetName(String::cast(object))); | 798 collection_->names()->GetName(String::cast(object))); |
788 } else if (object->IsCode()) { | 799 } else if (object->IsCode()) { |
789 return AddEntry(object, HeapEntry::kCode, ""); | 800 return AddEntry(object, HeapEntry::kCode, ""); |
790 } else if (object->IsSharedFunctionInfo()) { | 801 } else if (object->IsSharedFunctionInfo()) { |
791 String* name = String::cast(SharedFunctionInfo::cast(object)->name()); | 802 String* name = String::cast(SharedFunctionInfo::cast(object)->name()); |
792 return AddEntry(object, | 803 return AddEntry(object, |
793 HeapEntry::kCode, | 804 HeapEntry::kCode, |
794 collection_->names()->GetName(name)); | 805 collection_->names()->GetName(name)); |
(...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2578 JSON_A( | 2589 JSON_A( |
2579 JSON_S("hidden") "," | 2590 JSON_S("hidden") "," |
2580 JSON_S("array") "," | 2591 JSON_S("array") "," |
2581 JSON_S("string") "," | 2592 JSON_S("string") "," |
2582 JSON_S("object") "," | 2593 JSON_S("object") "," |
2583 JSON_S("code") "," | 2594 JSON_S("code") "," |
2584 JSON_S("closure") "," | 2595 JSON_S("closure") "," |
2585 JSON_S("regexp") "," | 2596 JSON_S("regexp") "," |
2586 JSON_S("number") "," | 2597 JSON_S("number") "," |
2587 JSON_S("native") "," | 2598 JSON_S("native") "," |
2588 JSON_S("synthetic")) "," | 2599 JSON_S("synthetic") "," |
| 2600 JSON_S("concatenated string") "," |
| 2601 JSON_S("sliced string")) "," |
2589 JSON_S("string") "," | 2602 JSON_S("string") "," |
2590 JSON_S("number") "," | 2603 JSON_S("number") "," |
2591 JSON_S("number") "," | 2604 JSON_S("number") "," |
2592 JSON_S("number") "," | 2605 JSON_S("number") "," |
2593 JSON_S("number") "," | 2606 JSON_S("number") "," |
2594 JSON_S("number")) "," | 2607 JSON_S("number")) "," |
2595 JSON_S("edge_fields") ":" JSON_A( | 2608 JSON_S("edge_fields") ":" JSON_A( |
2596 JSON_S("type") "," | 2609 JSON_S("type") "," |
2597 JSON_S("name_or_index") "," | 2610 JSON_S("name_or_index") "," |
2598 JSON_S("to_node")) "," | 2611 JSON_S("to_node")) "," |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2705 | 2718 |
2706 | 2719 |
2707 void HeapSnapshotJSONSerializer::SortHashMap( | 2720 void HeapSnapshotJSONSerializer::SortHashMap( |
2708 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 2721 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
2709 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 2722 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
2710 sorted_entries->Add(p); | 2723 sorted_entries->Add(p); |
2711 sorted_entries->Sort(SortUsingEntryValue); | 2724 sorted_entries->Sort(SortUsingEntryValue); |
2712 } | 2725 } |
2713 | 2726 |
2714 } } // namespace v8::internal | 2727 } } // namespace v8::internal |
OLD | NEW |