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 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1866 intptr_t amount_of_external_allocated_memory() { | 1866 intptr_t amount_of_external_allocated_memory() { |
1867 return amount_of_external_allocated_memory_; | 1867 return amount_of_external_allocated_memory_; |
1868 } | 1868 } |
1869 | 1869 |
1870 // ObjectStats are kept in two arrays, counts and sizes. Related stats are | 1870 // ObjectStats are kept in two arrays, counts and sizes. Related stats are |
1871 // stored in a contiguous linear buffer. Stats groups are stored one after | 1871 // stored in a contiguous linear buffer. Stats groups are stored one after |
1872 // another. | 1872 // another. |
1873 enum { | 1873 enum { |
1874 FIRST_CODE_KIND_SUB_TYPE = LAST_TYPE + 1, | 1874 FIRST_CODE_KIND_SUB_TYPE = LAST_TYPE + 1, |
1875 FIRST_FIXED_ARRAY_SUB_TYPE = | 1875 FIRST_FIXED_ARRAY_SUB_TYPE = |
1876 FIRST_CODE_KIND_SUB_TYPE + Code::LAST_CODE_KIND + 1, | 1876 FIRST_CODE_KIND_SUB_TYPE + Code::NUMBER_OF_KINDS, |
1877 OBJECT_STATS_COUNT = | 1877 OBJECT_STATS_COUNT = |
1878 FIRST_FIXED_ARRAY_SUB_TYPE + LAST_FIXED_ARRAY_SUB_TYPE + 1 | 1878 FIRST_FIXED_ARRAY_SUB_TYPE + LAST_FIXED_ARRAY_SUB_TYPE + 1 |
1879 }; | 1879 }; |
1880 | 1880 |
1881 void RecordObjectStats(InstanceType type, int sub_type, size_t size) { | 1881 void RecordObjectStats(InstanceType type, int sub_type, size_t size) { |
1882 ASSERT(type <= LAST_TYPE); | 1882 ASSERT(type <= LAST_TYPE); |
1883 if (sub_type < 0) { | 1883 if (sub_type < 0) { |
1884 object_counts_[type]++; | 1884 object_counts_[type]++; |
1885 object_sizes_[type] += size; | 1885 object_sizes_[type] += size; |
1886 } else { | 1886 } else { |
1887 if (type == CODE_TYPE) { | 1887 if (type == CODE_TYPE) { |
1888 ASSERT(sub_type <= Code::LAST_CODE_KIND); | 1888 ASSERT(sub_type < Code::NUMBER_OF_KINDS); |
1889 object_counts_[FIRST_CODE_KIND_SUB_TYPE + sub_type]++; | 1889 object_counts_[FIRST_CODE_KIND_SUB_TYPE + sub_type]++; |
1890 object_sizes_[FIRST_CODE_KIND_SUB_TYPE + sub_type] += size; | 1890 object_sizes_[FIRST_CODE_KIND_SUB_TYPE + sub_type] += size; |
1891 } else if (type == FIXED_ARRAY_TYPE) { | 1891 } else if (type == FIXED_ARRAY_TYPE) { |
1892 ASSERT(sub_type <= LAST_FIXED_ARRAY_SUB_TYPE); | 1892 ASSERT(sub_type <= LAST_FIXED_ARRAY_SUB_TYPE); |
1893 object_counts_[FIRST_FIXED_ARRAY_SUB_TYPE + sub_type]++; | 1893 object_counts_[FIRST_FIXED_ARRAY_SUB_TYPE + sub_type]++; |
1894 object_sizes_[FIRST_FIXED_ARRAY_SUB_TYPE + sub_type] += size; | 1894 object_sizes_[FIRST_FIXED_ARRAY_SUB_TYPE + sub_type] += size; |
1895 } | 1895 } |
1896 } | 1896 } |
1897 } | 1897 } |
1898 | 1898 |
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3077 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 3077 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
3078 | 3078 |
3079 private: | 3079 private: |
3080 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 3080 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
3081 }; | 3081 }; |
3082 #endif // DEBUG | 3082 #endif // DEBUG |
3083 | 3083 |
3084 } } // namespace v8::internal | 3084 } } // namespace v8::internal |
3085 | 3085 |
3086 #endif // V8_HEAP_H_ | 3086 #endif // V8_HEAP_H_ |
OLD | NEW |