| 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 RetainerHeapProfile* js_retainer_profile() { return &js_retainer_profile_; } | 334 RetainerHeapProfile* js_retainer_profile() { return &js_retainer_profile_; } |
| 335 | 335 |
| 336 private: | 336 private: |
| 337 HistogramInfo* info_; | 337 HistogramInfo* info_; |
| 338 ConstructorHeapProfile js_cons_profile_; | 338 ConstructorHeapProfile js_cons_profile_; |
| 339 RetainerHeapProfile js_retainer_profile_; | 339 RetainerHeapProfile js_retainer_profile_; |
| 340 }; | 340 }; |
| 341 | 341 |
| 342 | 342 |
| 343 class HeapEntriesMap; | 343 class HeapEntriesMap; |
| 344 class HeapEntriesAllocator; |
| 344 class HeapSnapshot; | 345 class HeapSnapshot; |
| 345 | 346 |
| 346 class AggregatedHeapSnapshotGenerator { | 347 class AggregatedHeapSnapshotGenerator { |
| 347 public: | 348 public: |
| 348 explicit AggregatedHeapSnapshotGenerator(AggregatedHeapSnapshot* snapshot); | 349 explicit AggregatedHeapSnapshotGenerator(AggregatedHeapSnapshot* snapshot); |
| 349 void GenerateSnapshot(); | 350 void GenerateSnapshot(); |
| 350 void FillHeapSnapshot(HeapSnapshot* snapshot); | 351 void FillHeapSnapshot(HeapSnapshot* snapshot); |
| 351 | 352 |
| 352 static const int kAllStringsType = LAST_TYPE + 1; | 353 static const int kAllStringsType = LAST_TYPE + 1; |
| 353 | 354 |
| 354 private: | 355 private: |
| 355 void CalculateStringsStats(); | 356 void CalculateStringsStats(); |
| 356 void CollectStats(HeapObject* obj); | 357 void CollectStats(HeapObject* obj); |
| 357 template<class Iterator> | 358 template<class Iterator> |
| 358 void IterateRetainers(HeapEntriesMap* entries_map); | 359 void IterateRetainers( |
| 360 HeapEntriesAllocator* allocator, HeapEntriesMap* entries_map); |
| 359 | 361 |
| 360 AggregatedHeapSnapshot* agg_snapshot_; | 362 AggregatedHeapSnapshot* agg_snapshot_; |
| 361 }; | 363 }; |
| 362 | 364 |
| 363 | 365 |
| 364 class ProducerHeapProfile { | 366 class ProducerHeapProfile { |
| 365 public: | 367 public: |
| 366 void Setup(); | 368 void Setup(); |
| 367 void RecordJSObjectAllocation(Object* obj) { | 369 void RecordJSObjectAllocation(Object* obj) { |
| 368 if (FLAG_log_producers) DoRecordJSObjectAllocation(obj); | 370 if (FLAG_log_producers) DoRecordJSObjectAllocation(obj); |
| 369 } | 371 } |
| 370 | 372 |
| 371 private: | 373 private: |
| 372 ProducerHeapProfile() : can_log_(false) { } | 374 ProducerHeapProfile() : can_log_(false) { } |
| 373 | 375 |
| 374 void DoRecordJSObjectAllocation(Object* obj); | 376 void DoRecordJSObjectAllocation(Object* obj); |
| 375 Isolate* isolate_; | 377 Isolate* isolate_; |
| 376 bool can_log_; | 378 bool can_log_; |
| 377 | 379 |
| 378 friend class Isolate; | 380 friend class Isolate; |
| 379 | 381 |
| 380 DISALLOW_COPY_AND_ASSIGN(ProducerHeapProfile); | 382 DISALLOW_COPY_AND_ASSIGN(ProducerHeapProfile); |
| 381 }; | 383 }; |
| 382 | 384 |
| 383 #endif // ENABLE_LOGGING_AND_PROFILING | 385 #endif // ENABLE_LOGGING_AND_PROFILING |
| 384 | 386 |
| 385 } } // namespace v8::internal | 387 } } // namespace v8::internal |
| 386 | 388 |
| 387 #endif // V8_HEAP_PROFILER_H_ | 389 #endif // V8_HEAP_PROFILER_H_ |
| OLD | NEW |