OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1805 | 1805 |
1806 // ObjectStats are kept in two arrays, counts and sizes. Related stats are | 1806 // ObjectStats are kept in two arrays, counts and sizes. Related stats are |
1807 // stored in a contiguous linear buffer. Stats groups are stored one after | 1807 // stored in a contiguous linear buffer. Stats groups are stored one after |
1808 // another. | 1808 // another. |
1809 enum { | 1809 enum { |
1810 FIRST_CODE_KIND_SUB_TYPE = LAST_TYPE + 1, | 1810 FIRST_CODE_KIND_SUB_TYPE = LAST_TYPE + 1, |
1811 FIRST_FIXED_ARRAY_SUB_TYPE = | 1811 FIRST_FIXED_ARRAY_SUB_TYPE = |
1812 FIRST_CODE_KIND_SUB_TYPE + Code::NUMBER_OF_KINDS, | 1812 FIRST_CODE_KIND_SUB_TYPE + Code::NUMBER_OF_KINDS, |
1813 FIRST_CODE_AGE_SUB_TYPE = | 1813 FIRST_CODE_AGE_SUB_TYPE = |
1814 FIRST_FIXED_ARRAY_SUB_TYPE + LAST_FIXED_ARRAY_SUB_TYPE + 1, | 1814 FIRST_FIXED_ARRAY_SUB_TYPE + LAST_FIXED_ARRAY_SUB_TYPE + 1, |
1815 OBJECT_STATS_COUNT = FIRST_CODE_AGE_SUB_TYPE + Code::kLastCodeAge + 1 | 1815 OBJECT_STATS_COUNT = FIRST_CODE_AGE_SUB_TYPE + Code::kCodeAgeCount + 1 |
1816 }; | 1816 }; |
1817 | 1817 |
1818 void RecordObjectStats(InstanceType type, size_t size) { | 1818 void RecordObjectStats(InstanceType type, size_t size) { |
1819 ASSERT(type <= LAST_TYPE); | 1819 ASSERT(type <= LAST_TYPE); |
1820 object_counts_[type]++; | 1820 object_counts_[type]++; |
1821 object_sizes_[type] += size; | 1821 object_sizes_[type] += size; |
1822 } | 1822 } |
1823 | 1823 |
1824 void RecordCodeSubTypeStats(int code_sub_type, int code_age, size_t size) { | 1824 void RecordCodeSubTypeStats(int code_sub_type, int code_age, size_t size) { |
1825 ASSERT(code_sub_type < Code::NUMBER_OF_KINDS); | 1825 int code_sub_type_index = FIRST_CODE_KIND_SUB_TYPE + code_sub_type; |
1826 ASSERT(code_age < Code::kLastCodeAge); | 1826 int code_age_index = |
1827 object_counts_[FIRST_CODE_KIND_SUB_TYPE + code_sub_type]++; | 1827 FIRST_CODE_AGE_SUB_TYPE + code_age - Code::kFirstCodeAge; |
1828 object_sizes_[FIRST_CODE_KIND_SUB_TYPE + code_sub_type] += size; | 1828 ASSERT(code_sub_type_index >= FIRST_CODE_KIND_SUB_TYPE && |
1829 object_counts_[FIRST_CODE_AGE_SUB_TYPE + code_age]++; | 1829 code_sub_type_index < FIRST_CODE_AGE_SUB_TYPE); |
1830 object_sizes_[FIRST_CODE_AGE_SUB_TYPE + code_age] += size; | 1830 ASSERT(code_age_index >= FIRST_CODE_AGE_SUB_TYPE && |
| 1831 code_age_index < OBJECT_STATS_COUNT); |
| 1832 object_counts_[code_sub_type_index]++; |
| 1833 object_sizes_[code_sub_type_index] += size; |
| 1834 object_counts_[code_age_index]++; |
| 1835 object_sizes_[code_age_index] += size; |
1831 } | 1836 } |
1832 | 1837 |
1833 void RecordFixedArraySubTypeStats(int array_sub_type, size_t size) { | 1838 void RecordFixedArraySubTypeStats(int array_sub_type, size_t size) { |
1834 ASSERT(array_sub_type <= LAST_FIXED_ARRAY_SUB_TYPE); | 1839 ASSERT(array_sub_type <= LAST_FIXED_ARRAY_SUB_TYPE); |
1835 object_counts_[FIRST_FIXED_ARRAY_SUB_TYPE + array_sub_type]++; | 1840 object_counts_[FIRST_FIXED_ARRAY_SUB_TYPE + array_sub_type]++; |
1836 object_sizes_[FIRST_FIXED_ARRAY_SUB_TYPE + array_sub_type] += size; | 1841 object_sizes_[FIRST_FIXED_ARRAY_SUB_TYPE + array_sub_type] += size; |
1837 } | 1842 } |
1838 | 1843 |
1839 void CheckpointObjectStats(); | 1844 void CheckpointObjectStats(); |
1840 | 1845 |
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3070 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 3075 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
3071 | 3076 |
3072 private: | 3077 private: |
3073 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 3078 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
3074 }; | 3079 }; |
3075 #endif // DEBUG | 3080 #endif // DEBUG |
3076 | 3081 |
3077 } } // namespace v8::internal | 3082 } } // namespace v8::internal |
3078 | 3083 |
3079 #endif // V8_HEAP_H_ | 3084 #endif // V8_HEAP_H_ |
OLD | NEW |