| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 case kHidden: return "/hidden/"; | 167 case kHidden: return "/hidden/"; |
| 168 case kObject: return "/object/"; | 168 case kObject: return "/object/"; |
| 169 case kClosure: return "/closure/"; | 169 case kClosure: return "/closure/"; |
| 170 case kString: return "/string/"; | 170 case kString: return "/string/"; |
| 171 case kCode: return "/code/"; | 171 case kCode: return "/code/"; |
| 172 case kArray: return "/array/"; | 172 case kArray: return "/array/"; |
| 173 case kRegExp: return "/regexp/"; | 173 case kRegExp: return "/regexp/"; |
| 174 case kHeapNumber: return "/number/"; | 174 case kHeapNumber: return "/number/"; |
| 175 case kNative: return "/native/"; | 175 case kNative: return "/native/"; |
| 176 case kSynthetic: return "/synthetic/"; | 176 case kSynthetic: return "/synthetic/"; |
| 177 case kContext: return "/context/"; | |
| 178 default: return "???"; | 177 default: return "???"; |
| 179 } | 178 } |
| 180 } | 179 } |
| 181 | 180 |
| 182 | 181 |
| 183 // It is very important to keep objects that form a heap snapshot | 182 // It is very important to keep objects that form a heap snapshot |
| 184 // as small as possible. | 183 // as small as possible. |
| 185 namespace { // Avoid littering the global namespace. | 184 namespace { // Avoid littering the global namespace. |
| 186 | 185 |
| 187 template <size_t ptr_size> struct SnapshotSizeConstants; | 186 template <size_t ptr_size> struct SnapshotSizeConstants; |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 } else if (object->IsScript()) { | 819 } else if (object->IsScript()) { |
| 821 Object* name = Script::cast(object)->name(); | 820 Object* name = Script::cast(object)->name(); |
| 822 return AddEntry(object, | 821 return AddEntry(object, |
| 823 HeapEntry::kCode, | 822 HeapEntry::kCode, |
| 824 name->IsString() | 823 name->IsString() |
| 825 ? collection_->names()->GetName(String::cast(name)) | 824 ? collection_->names()->GetName(String::cast(name)) |
| 826 : ""); | 825 : ""); |
| 827 } else if (object->IsNativeContext()) { | 826 } else if (object->IsNativeContext()) { |
| 828 return AddEntry(object, HeapEntry::kHidden, "system / NativeContext"); | 827 return AddEntry(object, HeapEntry::kHidden, "system / NativeContext"); |
| 829 } else if (object->IsContext()) { | 828 } else if (object->IsContext()) { |
| 830 return AddEntry(object, HeapEntry::kContext, "system / Context"); | 829 return AddEntry(object, HeapEntry::kObject, "system / Context"); |
| 831 } else if (object->IsFixedArray() || | 830 } else if (object->IsFixedArray() || |
| 832 object->IsFixedDoubleArray() || | 831 object->IsFixedDoubleArray() || |
| 833 object->IsByteArray() || | 832 object->IsByteArray() || |
| 834 object->IsExternalArray()) { | 833 object->IsExternalArray()) { |
| 835 return AddEntry(object, HeapEntry::kArray, ""); | 834 return AddEntry(object, HeapEntry::kArray, ""); |
| 836 } else if (object->IsHeapNumber()) { | 835 } else if (object->IsHeapNumber()) { |
| 837 return AddEntry(object, HeapEntry::kHeapNumber, "number"); | 836 return AddEntry(object, HeapEntry::kHeapNumber, "number"); |
| 838 } | 837 } |
| 839 return AddEntry(object, HeapEntry::kHidden, GetSystemEntryName(object)); | 838 return AddEntry(object, HeapEntry::kHidden, GetSystemEntryName(object)); |
| 840 } | 839 } |
| (...skipping 1732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2573 JSON_A( | 2572 JSON_A( |
| 2574 JSON_S("hidden") "," | 2573 JSON_S("hidden") "," |
| 2575 JSON_S("array") "," | 2574 JSON_S("array") "," |
| 2576 JSON_S("string") "," | 2575 JSON_S("string") "," |
| 2577 JSON_S("object") "," | 2576 JSON_S("object") "," |
| 2578 JSON_S("code") "," | 2577 JSON_S("code") "," |
| 2579 JSON_S("closure") "," | 2578 JSON_S("closure") "," |
| 2580 JSON_S("regexp") "," | 2579 JSON_S("regexp") "," |
| 2581 JSON_S("number") "," | 2580 JSON_S("number") "," |
| 2582 JSON_S("native") "," | 2581 JSON_S("native") "," |
| 2583 JSON_S("synthetic") "," | 2582 JSON_S("synthetic")) "," |
| 2584 JSON_S("context")) "," | |
| 2585 JSON_S("string") "," | 2583 JSON_S("string") "," |
| 2586 JSON_S("number") "," | 2584 JSON_S("number") "," |
| 2587 JSON_S("number") "," | 2585 JSON_S("number") "," |
| 2588 JSON_S("number") "," | 2586 JSON_S("number") "," |
| 2589 JSON_S("number") "," | 2587 JSON_S("number") "," |
| 2590 JSON_S("number")) "," | 2588 JSON_S("number")) "," |
| 2591 JSON_S("edge_fields") ":" JSON_A( | 2589 JSON_S("edge_fields") ":" JSON_A( |
| 2592 JSON_S("type") "," | 2590 JSON_S("type") "," |
| 2593 JSON_S("name_or_index") "," | 2591 JSON_S("name_or_index") "," |
| 2594 JSON_S("to_node")) "," | 2592 JSON_S("to_node")) "," |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2700 | 2698 |
| 2701 | 2699 |
| 2702 void HeapSnapshotJSONSerializer::SortHashMap( | 2700 void HeapSnapshotJSONSerializer::SortHashMap( |
| 2703 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 2701 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
| 2704 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 2702 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
| 2705 sorted_entries->Add(p); | 2703 sorted_entries->Add(p); |
| 2706 sorted_entries->Sort(SortUsingEntryValue); | 2704 sorted_entries->Sort(SortUsingEntryValue); |
| 2707 } | 2705 } |
| 2708 | 2706 |
| 2709 } } // namespace v8::internal | 2707 } } // namespace v8::internal |
| OLD | NEW |