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

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

Issue 6685052: Version 3.2.2. Fixed a number of crash and correctness bugs. Improved Cranksh... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: 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
« no previous file with comments | « src/heap-profiler.h ('k') | src/hydrogen.h » ('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 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) {
369 ASSERT(singleton_ != NULL);
370 ASSERT(class_id != v8::HeapProfiler::kPersistentHandleNoClassId);
371 if (singleton_->wrapper_callbacks_.length() <= class_id) {
372 singleton_->wrapper_callbacks_.AddBlock(
373 NULL, class_id - singleton_->wrapper_callbacks_.length() + 1);
374 }
375 singleton_->wrapper_callbacks_[class_id] = callback;
376 }
377
378
379 v8::RetainedObjectInfo* HeapProfiler::ExecuteWrapperClassCallback(
380 uint16_t class_id, Object** wrapper) {
381 ASSERT(singleton_ != NULL);
382 if (singleton_->wrapper_callbacks_.length() <= class_id) return NULL;
383 return singleton_->wrapper_callbacks_[class_id](
384 class_id, Utils::ToLocal(Handle<Object>(wrapper)));
385 }
386
387
367 HeapSnapshot* HeapProfiler::TakeSnapshotImpl(const char* name, 388 HeapSnapshot* HeapProfiler::TakeSnapshotImpl(const char* name,
368 int type, 389 int type,
369 v8::ActivityControl* control) { 390 v8::ActivityControl* control) {
370 HeapSnapshot::Type s_type = static_cast<HeapSnapshot::Type>(type); 391 HeapSnapshot::Type s_type = static_cast<HeapSnapshot::Type>(type);
371 HeapSnapshot* result = 392 HeapSnapshot* result =
372 snapshots_->NewSnapshot(s_type, name, next_snapshot_uid_++); 393 snapshots_->NewSnapshot(s_type, name, next_snapshot_uid_++);
373 bool generation_completed = true; 394 bool generation_completed = true;
374 switch (s_type) { 395 switch (s_type) {
375 case HeapSnapshot::kFull: { 396 case HeapSnapshot::kFull: {
376 Heap::CollectAllGarbage(true); 397 Heap::CollectAllGarbage(true);
(...skipping 17 matching lines...) Expand all
394 result = NULL; 415 result = NULL;
395 } 416 }
396 snapshots_->SnapshotGenerationFinished(result); 417 snapshots_->SnapshotGenerationFinished(result);
397 return result; 418 return result;
398 } 419 }
399 420
400 421
401 HeapSnapshot* HeapProfiler::TakeSnapshotImpl(String* name, 422 HeapSnapshot* HeapProfiler::TakeSnapshotImpl(String* name,
402 int type, 423 int type,
403 v8::ActivityControl* control) { 424 v8::ActivityControl* control) {
404 return TakeSnapshotImpl(snapshots_->GetName(name), type, control); 425 return TakeSnapshotImpl(snapshots_->names()->GetName(name), type, control);
405 } 426 }
406 427
407 428
408 int HeapProfiler::GetSnapshotsCount() { 429 int HeapProfiler::GetSnapshotsCount() {
409 ASSERT(singleton_ != NULL); 430 ASSERT(singleton_ != NULL);
410 return singleton_->snapshots_->snapshots()->length(); 431 return singleton_->snapshots_->snapshots()->length();
411 } 432 }
412 433
413 434
414 HeapSnapshot* HeapProfiler::GetSnapshot(int index) { 435 HeapSnapshot* HeapProfiler::GetSnapshot(int index) {
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 AllocatingConstructorHeapProfileIterator(HeapSnapshot* snapshot, 886 AllocatingConstructorHeapProfileIterator(HeapSnapshot* snapshot,
866 int* root_child_index) 887 int* root_child_index)
867 : snapshot_(snapshot), 888 : snapshot_(snapshot),
868 root_child_index_(root_child_index) { 889 root_child_index_(root_child_index) {
869 } 890 }
870 891
871 void Call(const JSObjectsCluster& cluster, 892 void Call(const JSObjectsCluster& cluster,
872 const NumberAndSizeInfo& number_and_size) { 893 const NumberAndSizeInfo& number_and_size) {
873 const char* name = cluster.GetSpecialCaseName(); 894 const char* name = cluster.GetSpecialCaseName();
874 if (name == NULL) { 895 if (name == NULL) {
875 name = snapshot_->collection()->GetFunctionName(cluster.constructor()); 896 name = snapshot_->collection()->names()->GetFunctionName(
897 cluster.constructor());
876 } 898 }
877 AddEntryFromAggregatedSnapshot(snapshot_, 899 AddEntryFromAggregatedSnapshot(snapshot_,
878 root_child_index_, 900 root_child_index_,
879 HeapEntry::kObject, 901 HeapEntry::kObject,
880 name, 902 name,
881 number_and_size.number(), 903 number_and_size.number(),
882 number_and_size.bytes(), 904 number_and_size.bytes(),
883 0, 905 0,
884 0); 906 0);
885 } 907 }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 : snapshot_(snapshot), root_child_index_(root_child_index) { 1028 : snapshot_(snapshot), root_child_index_(root_child_index) {
1007 } 1029 }
1008 ~AggregatedRetainerTreeAllocator() { } 1030 ~AggregatedRetainerTreeAllocator() { }
1009 1031
1010 HeapEntry* AllocateEntry( 1032 HeapEntry* AllocateEntry(
1011 HeapThing ptr, int children_count, int retainers_count) { 1033 HeapThing ptr, int children_count, int retainers_count) {
1012 HeapObject* obj = reinterpret_cast<HeapObject*>(ptr); 1034 HeapObject* obj = reinterpret_cast<HeapObject*>(ptr);
1013 JSObjectsCluster cluster = HeapObjectAsCluster(obj); 1035 JSObjectsCluster cluster = HeapObjectAsCluster(obj);
1014 const char* name = cluster.GetSpecialCaseName(); 1036 const char* name = cluster.GetSpecialCaseName();
1015 if (name == NULL) { 1037 if (name == NULL) {
1016 name = snapshot_->collection()->GetFunctionName(cluster.constructor()); 1038 name = snapshot_->collection()->names()->GetFunctionName(
1039 cluster.constructor());
1017 } 1040 }
1018 return AddEntryFromAggregatedSnapshot( 1041 return AddEntryFromAggregatedSnapshot(
1019 snapshot_, root_child_index_, HeapEntry::kObject, name, 1042 snapshot_, root_child_index_, HeapEntry::kObject, name,
1020 0, 0, children_count, retainers_count); 1043 0, 0, children_count, retainers_count);
1021 } 1044 }
1022 1045
1023 private: 1046 private:
1024 HeapSnapshot* snapshot_; 1047 HeapSnapshot* snapshot_;
1025 int* root_child_index_; 1048 int* root_child_index_;
1026 }; 1049 };
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 GlobalHandles::MakeWeak(handle.location(), 1142 GlobalHandles::MakeWeak(handle.location(),
1120 static_cast<void*>(stack.start()), 1143 static_cast<void*>(stack.start()),
1121 StackWeakReferenceCallback); 1144 StackWeakReferenceCallback);
1122 } 1145 }
1123 1146
1124 1147
1125 #endif // ENABLE_LOGGING_AND_PROFILING 1148 #endif // ENABLE_LOGGING_AND_PROFILING
1126 1149
1127 1150
1128 } } // namespace v8::internal 1151 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap-profiler.h ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698