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

Side by Side Diff: src/heap-profiler.cc

Issue 6626043: Add an interface for an embedder to provide information about native (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix GetCopy Created 9 years, 9 months 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
OLDNEW
1 // Copyright 2009-2010 the V8 project authors. All rights reserved. 1 // Copyright 2009-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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 357
358 358
359 HeapSnapshot* HeapProfiler::TakeSnapshot(String* name, 359 HeapSnapshot* HeapProfiler::TakeSnapshot(String* name,
360 int type, 360 int type,
361 v8::ActivityControl* control) { 361 v8::ActivityControl* control) {
362 ASSERT(singleton_ != NULL); 362 ASSERT(singleton_ != NULL);
363 return singleton_->TakeSnapshotImpl(name, type, control); 363 return singleton_->TakeSnapshotImpl(name, type, control);
364 } 364 }
365 365
366 366
367 void HeapProfiler::DefineWrapperClass(
368 uint16_t class_id, v8::HeapProfiler::WrapperInfoCallback callback) {
Vitaly Repeshko 2011/03/09 19:10:08 Assert class_id is not kNoClassId.
mnaganov (inactive) 2011/03/10 12:23:35 Done.
369 ASSERT(singleton_ != NULL);
370 if (singleton_->wrapper_callbacks_.length() <= class_id) {
371 singleton_->wrapper_callbacks_.AddBlock(
372 NULL, class_id - singleton_->wrapper_callbacks_.length() + 1);
373 }
374 singleton_->wrapper_callbacks_[class_id] = callback;
375 }
376
377
378 v8::RetainedObjectInfo* HeapProfiler::ExecuteWrapperClassCallback(
379 uint16_t class_id, Object** wrapper) {
380 ASSERT(singleton_ != NULL);
381 if (singleton_->wrapper_callbacks_.length() <= class_id) return NULL;
382 return singleton_->wrapper_callbacks_[class_id](
383 class_id, Utils::ToLocal(Handle<Object>(wrapper)));
384 }
385
386
367 HeapSnapshot* HeapProfiler::TakeSnapshotImpl(const char* name, 387 HeapSnapshot* HeapProfiler::TakeSnapshotImpl(const char* name,
368 int type, 388 int type,
369 v8::ActivityControl* control) { 389 v8::ActivityControl* control) {
370 HeapSnapshot::Type s_type = static_cast<HeapSnapshot::Type>(type); 390 HeapSnapshot::Type s_type = static_cast<HeapSnapshot::Type>(type);
371 HeapSnapshot* result = 391 HeapSnapshot* result =
372 snapshots_->NewSnapshot(s_type, name, next_snapshot_uid_++); 392 snapshots_->NewSnapshot(s_type, name, next_snapshot_uid_++);
373 bool generation_completed = true; 393 bool generation_completed = true;
374 switch (s_type) { 394 switch (s_type) {
375 case HeapSnapshot::kFull: { 395 case HeapSnapshot::kFull: {
376 Heap::CollectAllGarbage(true); 396 Heap::CollectAllGarbage(true);
(...skipping 17 matching lines...) Expand all
394 result = NULL; 414 result = NULL;
395 } 415 }
396 snapshots_->SnapshotGenerationFinished(result); 416 snapshots_->SnapshotGenerationFinished(result);
397 return result; 417 return result;
398 } 418 }
399 419
400 420
401 HeapSnapshot* HeapProfiler::TakeSnapshotImpl(String* name, 421 HeapSnapshot* HeapProfiler::TakeSnapshotImpl(String* name,
402 int type, 422 int type,
403 v8::ActivityControl* control) { 423 v8::ActivityControl* control) {
404 return TakeSnapshotImpl(snapshots_->GetName(name), type, control); 424 return TakeSnapshotImpl(snapshots_->names()->GetName(name), type, control);
405 } 425 }
406 426
407 427
408 int HeapProfiler::GetSnapshotsCount() { 428 int HeapProfiler::GetSnapshotsCount() {
409 ASSERT(singleton_ != NULL); 429 ASSERT(singleton_ != NULL);
410 return singleton_->snapshots_->snapshots()->length(); 430 return singleton_->snapshots_->snapshots()->length();
411 } 431 }
412 432
413 433
414 HeapSnapshot* HeapProfiler::GetSnapshot(int index) { 434 HeapSnapshot* HeapProfiler::GetSnapshot(int index) {
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 AllocatingConstructorHeapProfileIterator(HeapSnapshot* snapshot, 885 AllocatingConstructorHeapProfileIterator(HeapSnapshot* snapshot,
866 int* root_child_index) 886 int* root_child_index)
867 : snapshot_(snapshot), 887 : snapshot_(snapshot),
868 root_child_index_(root_child_index) { 888 root_child_index_(root_child_index) {
869 } 889 }
870 890
871 void Call(const JSObjectsCluster& cluster, 891 void Call(const JSObjectsCluster& cluster,
872 const NumberAndSizeInfo& number_and_size) { 892 const NumberAndSizeInfo& number_and_size) {
873 const char* name = cluster.GetSpecialCaseName(); 893 const char* name = cluster.GetSpecialCaseName();
874 if (name == NULL) { 894 if (name == NULL) {
875 name = snapshot_->collection()->GetFunctionName(cluster.constructor()); 895 name = snapshot_->collection()->names()->GetFunctionName(
896 cluster.constructor());
876 } 897 }
877 AddEntryFromAggregatedSnapshot(snapshot_, 898 AddEntryFromAggregatedSnapshot(snapshot_,
878 root_child_index_, 899 root_child_index_,
879 HeapEntry::kObject, 900 HeapEntry::kObject,
880 name, 901 name,
881 number_and_size.number(), 902 number_and_size.number(),
882 number_and_size.bytes(), 903 number_and_size.bytes(),
883 0, 904 0,
884 0); 905 0);
885 } 906 }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 : snapshot_(snapshot), root_child_index_(root_child_index) { 1027 : snapshot_(snapshot), root_child_index_(root_child_index) {
1007 } 1028 }
1008 ~AggregatedRetainerTreeAllocator() { } 1029 ~AggregatedRetainerTreeAllocator() { }
1009 1030
1010 HeapEntry* AllocateEntry( 1031 HeapEntry* AllocateEntry(
1011 HeapThing ptr, int children_count, int retainers_count) { 1032 HeapThing ptr, int children_count, int retainers_count) {
1012 HeapObject* obj = reinterpret_cast<HeapObject*>(ptr); 1033 HeapObject* obj = reinterpret_cast<HeapObject*>(ptr);
1013 JSObjectsCluster cluster = HeapObjectAsCluster(obj); 1034 JSObjectsCluster cluster = HeapObjectAsCluster(obj);
1014 const char* name = cluster.GetSpecialCaseName(); 1035 const char* name = cluster.GetSpecialCaseName();
1015 if (name == NULL) { 1036 if (name == NULL) {
1016 name = snapshot_->collection()->GetFunctionName(cluster.constructor()); 1037 name = snapshot_->collection()->names()->GetFunctionName(
1038 cluster.constructor());
1017 } 1039 }
1018 return AddEntryFromAggregatedSnapshot( 1040 return AddEntryFromAggregatedSnapshot(
1019 snapshot_, root_child_index_, HeapEntry::kObject, name, 1041 snapshot_, root_child_index_, HeapEntry::kObject, name,
1020 0, 0, children_count, retainers_count); 1042 0, 0, children_count, retainers_count);
1021 } 1043 }
1022 1044
1023 private: 1045 private:
1024 HeapSnapshot* snapshot_; 1046 HeapSnapshot* snapshot_;
1025 int* root_child_index_; 1047 int* root_child_index_;
1026 }; 1048 };
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 GlobalHandles::MakeWeak(handle.location(), 1141 GlobalHandles::MakeWeak(handle.location(),
1120 static_cast<void*>(stack.start()), 1142 static_cast<void*>(stack.start()),
1121 StackWeakReferenceCallback); 1143 StackWeakReferenceCallback);
1122 } 1144 }
1123 1145
1124 1146
1125 #endif // ENABLE_LOGGING_AND_PROFILING 1147 #endif // ENABLE_LOGGING_AND_PROFILING
1126 1148
1127 1149
1128 } } // namespace v8::internal 1150 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap-profiler.h ('k') | src/objects.h » ('j') | src/profile-generator.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698