Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/profile-generator.cc

Issue 5256004: Expose an API method for getting JSObject constructor name (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/profile-generator.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 } else if (object->IsJSRegExp()) { 1288 } else if (object->IsJSRegExp()) {
1289 JSRegExp* re = JSRegExp::cast(object); 1289 JSRegExp* re = JSRegExp::cast(object);
1290 return AddEntry(object, 1290 return AddEntry(object,
1291 HeapEntry::kRegExp, 1291 HeapEntry::kRegExp,
1292 collection_->GetName(re->Pattern()), 1292 collection_->GetName(re->Pattern()),
1293 children_count, 1293 children_count,
1294 retainers_count); 1294 retainers_count);
1295 } else if (object->IsJSObject()) { 1295 } else if (object->IsJSObject()) {
1296 return AddEntry(object, 1296 return AddEntry(object,
1297 HeapEntry::kObject, 1297 HeapEntry::kObject,
1298 collection_->GetName( 1298 collection_->GetName(GetConstructorNameForHeapProfile(
1299 JSObject::cast(object)->constructor_name()), 1299 JSObject::cast(object))),
1300 children_count, 1300 children_count,
1301 retainers_count); 1301 retainers_count);
1302 } else if (object->IsString()) { 1302 } else if (object->IsString()) {
1303 return AddEntry(object, 1303 return AddEntry(object,
1304 HeapEntry::kString, 1304 HeapEntry::kString,
1305 collection_->GetName(String::cast(object)), 1305 collection_->GetName(String::cast(object)),
1306 children_count, 1306 children_count,
1307 retainers_count); 1307 retainers_count);
1308 } else if (object->IsCode()) { 1308 } else if (object->IsCode()) {
1309 return AddEntry(object, 1309 return AddEntry(object,
(...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after
2762 } 2762 }
2763 2763
2764 2764
2765 void HeapSnapshotJSONSerializer::SortHashMap( 2765 void HeapSnapshotJSONSerializer::SortHashMap(
2766 HashMap* map, List<HashMap::Entry*>* sorted_entries) { 2766 HashMap* map, List<HashMap::Entry*>* sorted_entries) {
2767 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) 2767 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p))
2768 sorted_entries->Add(p); 2768 sorted_entries->Add(p);
2769 sorted_entries->Sort(SortUsingEntryValue); 2769 sorted_entries->Sort(SortUsingEntryValue);
2770 } 2770 }
2771 2771
2772
2773 String* GetConstructorNameForHeapProfile(JSObject* object) {
2774 if (object->IsJSFunction()) return Heap::closure_symbol();
2775 return object->constructor_name();
2776 }
2777
2772 } } // namespace v8::internal 2778 } } // namespace v8::internal
2773 2779
2774 #endif // ENABLE_LOGGING_AND_PROFILING 2780 #endif // ENABLE_LOGGING_AND_PROFILING
OLDNEW
« no previous file with comments | « src/profile-generator.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698