OLD | NEW |
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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 | 366 |
367 HeapSnapshot* HeapProfiler::TakeSnapshotImpl(const char* name, | 367 HeapSnapshot* HeapProfiler::TakeSnapshotImpl(const char* name, |
368 int type, | 368 int type, |
369 v8::ActivityControl* control) { | 369 v8::ActivityControl* control) { |
370 HeapSnapshot::Type s_type = static_cast<HeapSnapshot::Type>(type); | 370 HeapSnapshot::Type s_type = static_cast<HeapSnapshot::Type>(type); |
371 HeapSnapshot* result = | 371 HeapSnapshot* result = |
372 snapshots_->NewSnapshot(s_type, name, next_snapshot_uid_++); | 372 snapshots_->NewSnapshot(s_type, name, next_snapshot_uid_++); |
373 bool generation_completed = true; | 373 bool generation_completed = true; |
374 switch (s_type) { | 374 switch (s_type) { |
375 case HeapSnapshot::kFull: { | 375 case HeapSnapshot::kFull: { |
376 Heap::CollectAllGarbage(true); | 376 Heap::CollectAllGarbage(Heap::kSweepPreciselyMask); |
377 HeapSnapshotGenerator generator(result, control); | 377 HeapSnapshotGenerator generator(result, control); |
378 generation_completed = generator.GenerateSnapshot(); | 378 generation_completed = generator.GenerateSnapshot(); |
379 break; | 379 break; |
380 } | 380 } |
381 case HeapSnapshot::kAggregated: { | 381 case HeapSnapshot::kAggregated: { |
382 Heap::CollectAllGarbage(true); | 382 Heap::CollectAllGarbage(Heap::kSweepPreciselyMask); |
383 AggregatedHeapSnapshot agg_snapshot; | 383 AggregatedHeapSnapshot agg_snapshot; |
384 AggregatedHeapSnapshotGenerator generator(&agg_snapshot); | 384 AggregatedHeapSnapshotGenerator generator(&agg_snapshot); |
385 generator.GenerateSnapshot(); | 385 generator.GenerateSnapshot(); |
386 generator.FillHeapSnapshot(result); | 386 generator.FillHeapSnapshot(result); |
387 break; | 387 break; |
388 } | 388 } |
389 default: | 389 default: |
390 UNREACHABLE(); | 390 UNREACHABLE(); |
391 } | 391 } |
392 if (!generation_completed) { | 392 if (!generation_completed) { |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 | 802 |
803 void AggregatedHeapSnapshotGenerator::CollectStats(HeapObject* obj) { | 803 void AggregatedHeapSnapshotGenerator::CollectStats(HeapObject* obj) { |
804 InstanceType type = obj->map()->instance_type(); | 804 InstanceType type = obj->map()->instance_type(); |
805 ASSERT(0 <= type && type <= LAST_TYPE); | 805 ASSERT(0 <= type && type <= LAST_TYPE); |
806 agg_snapshot_->info()[type].increment_number(1); | 806 agg_snapshot_->info()[type].increment_number(1); |
807 agg_snapshot_->info()[type].increment_bytes(obj->Size()); | 807 agg_snapshot_->info()[type].increment_bytes(obj->Size()); |
808 } | 808 } |
809 | 809 |
810 | 810 |
811 void AggregatedHeapSnapshotGenerator::GenerateSnapshot() { | 811 void AggregatedHeapSnapshotGenerator::GenerateSnapshot() { |
812 HeapIterator iterator(HeapIterator::kFilterUnreachable); | 812 HeapIterator iterator; |
813 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 813 for (HeapObject* obj = iterator.Next(); obj != NULL; obj = iterator.Next()) { |
814 CollectStats(obj); | 814 CollectStats(obj); |
815 agg_snapshot_->js_cons_profile()->CollectStats(obj); | 815 agg_snapshot_->js_cons_profile()->CollectStats(obj); |
816 agg_snapshot_->js_retainer_profile()->CollectStats(obj); | 816 agg_snapshot_->js_retainer_profile()->CollectStats(obj); |
817 } | 817 } |
818 CalculateStringsStats(); | 818 CalculateStringsStats(); |
819 agg_snapshot_->js_retainer_profile()->CoarseAndAggregate(); | 819 agg_snapshot_->js_retainer_profile()->CoarseAndAggregate(); |
820 } | 820 } |
821 | 821 |
822 | 822 |
823 class CountingConstructorHeapProfileIterator { | 823 class CountingConstructorHeapProfileIterator { |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 GlobalHandles::MakeWeak(handle.location(), | 1110 GlobalHandles::MakeWeak(handle.location(), |
1111 static_cast<void*>(stack.start()), | 1111 static_cast<void*>(stack.start()), |
1112 StackWeakReferenceCallback); | 1112 StackWeakReferenceCallback); |
1113 } | 1113 } |
1114 | 1114 |
1115 | 1115 |
1116 #endif // ENABLE_LOGGING_AND_PROFILING | 1116 #endif // ENABLE_LOGGING_AND_PROFILING |
1117 | 1117 |
1118 | 1118 |
1119 } } // namespace v8::internal | 1119 } } // namespace v8::internal |
OLD | NEW |