OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HEAP_HEAP_H_ | 5 #ifndef V8_HEAP_HEAP_H_ |
6 #define V8_HEAP_HEAP_H_ | 6 #define V8_HEAP_HEAP_H_ |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 // Number of "runtime allocations" done so far. | 1015 // Number of "runtime allocations" done so far. |
1016 uint32_t allocations_count() { return allocations_count_; } | 1016 uint32_t allocations_count() { return allocations_count_; } |
1017 | 1017 |
1018 // Returns deterministic "time" value in ms. Works only with | 1018 // Returns deterministic "time" value in ms. Works only with |
1019 // FLAG_verify_predictable. | 1019 // FLAG_verify_predictable. |
1020 double synthetic_time() { return allocations_count_ / 2.0; } | 1020 double synthetic_time() { return allocations_count_ / 2.0; } |
1021 | 1021 |
1022 // Print short heap statistics. | 1022 // Print short heap statistics. |
1023 void PrintShortHeapStatistics(); | 1023 void PrintShortHeapStatistics(); |
1024 | 1024 |
| 1025 size_t object_count_last_gc(size_t index) { |
| 1026 return index < OBJECT_STATS_COUNT ? object_counts_last_time_[index] : 0; |
| 1027 } |
| 1028 size_t object_size_last_gc(size_t index) { |
| 1029 return index < OBJECT_STATS_COUNT ? object_sizes_last_time_[index] : 0; |
| 1030 } |
| 1031 |
1025 // Write barrier support for address[offset] = o. | 1032 // Write barrier support for address[offset] = o. |
1026 INLINE(void RecordWrite(Address address, int offset)); | 1033 INLINE(void RecordWrite(Address address, int offset)); |
1027 | 1034 |
1028 // Write barrier support for address[start : start + len[ = o. | 1035 // Write barrier support for address[start : start + len[ = o. |
1029 INLINE(void RecordWrites(Address address, int start, int len)); | 1036 INLINE(void RecordWrites(Address address, int start, int len)); |
1030 | 1037 |
1031 enum HeapState { NOT_IN_GC, SCAVENGE, MARK_COMPACT }; | 1038 enum HeapState { NOT_IN_GC, SCAVENGE, MARK_COMPACT }; |
1032 inline HeapState gc_state() { return gc_state_; } | 1039 inline HeapState gc_state() { return gc_state_; } |
1033 | 1040 |
1034 inline bool IsInGCPostProcessing() { return gc_post_processing_depth_ > 0; } | 1041 inline bool IsInGCPostProcessing() { return gc_post_processing_depth_ > 0; } |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1445 | 1452 |
1446 void RecordFixedArraySubTypeStats(int array_sub_type, size_t size) { | 1453 void RecordFixedArraySubTypeStats(int array_sub_type, size_t size) { |
1447 DCHECK(array_sub_type <= LAST_FIXED_ARRAY_SUB_TYPE); | 1454 DCHECK(array_sub_type <= LAST_FIXED_ARRAY_SUB_TYPE); |
1448 object_counts_[FIRST_FIXED_ARRAY_SUB_TYPE + array_sub_type]++; | 1455 object_counts_[FIRST_FIXED_ARRAY_SUB_TYPE + array_sub_type]++; |
1449 object_sizes_[FIRST_FIXED_ARRAY_SUB_TYPE + array_sub_type] += size; | 1456 object_sizes_[FIRST_FIXED_ARRAY_SUB_TYPE + array_sub_type] += size; |
1450 } | 1457 } |
1451 | 1458 |
1452 void TraceObjectStats(); | 1459 void TraceObjectStats(); |
1453 void TraceObjectStat(const char* name, int count, int size, double time); | 1460 void TraceObjectStat(const char* name, int count, int size, double time); |
1454 void CheckpointObjectStats(); | 1461 void CheckpointObjectStats(); |
| 1462 bool GetObjectTypeName(size_t index, const char** object_type, |
| 1463 const char** object_sub_type); |
1455 | 1464 |
1456 void RegisterStrongRoots(Object** start, Object** end); | 1465 void RegisterStrongRoots(Object** start, Object** end); |
1457 void UnregisterStrongRoots(Object** start); | 1466 void UnregisterStrongRoots(Object** start); |
1458 | 1467 |
1459 // Taking this lock prevents the GC from entering a phase that relocates | 1468 // Taking this lock prevents the GC from entering a phase that relocates |
1460 // object references. | 1469 // object references. |
1461 class RelocationLock { | 1470 class RelocationLock { |
1462 public: | 1471 public: |
1463 explicit RelocationLock(Heap* heap) : heap_(heap) { | 1472 explicit RelocationLock(Heap* heap) : heap_(heap) { |
1464 heap_->relocation_mutex_.Lock(); | 1473 heap_->relocation_mutex_.Lock(); |
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2639 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2648 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2640 | 2649 |
2641 private: | 2650 private: |
2642 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2651 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2643 }; | 2652 }; |
2644 #endif // DEBUG | 2653 #endif // DEBUG |
2645 } | 2654 } |
2646 } // namespace v8::internal | 2655 } // namespace v8::internal |
2647 | 2656 |
2648 #endif // V8_HEAP_HEAP_H_ | 2657 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |