OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 #ifdef DEBUG | 924 #ifdef DEBUG |
925 // Returns the number of total pages in this space. | 925 // Returns the number of total pages in this space. |
926 int CountTotalPages(); | 926 int CountTotalPages(); |
927 #endif | 927 #endif |
928 | 928 |
929 friend class PageIterator; | 929 friend class PageIterator; |
930 }; | 930 }; |
931 | 931 |
932 | 932 |
933 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) | 933 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) |
934 // HistogramInfo class for recording a single "bar" of a histogram. This | 934 class NumberAndSizeInfo BASE_EMBEDDED { |
935 // class is used for collecting statistics to print to stdout (when compiled | |
936 // with DEBUG) or to the log file (when compiled with | |
937 // ENABLE_LOGGING_AND_PROFILING). | |
938 class HistogramInfo BASE_EMBEDDED { | |
939 public: | 935 public: |
940 HistogramInfo() : number_(0), bytes_(0) {} | 936 NumberAndSizeInfo() : number_(0), bytes_(0) {} |
941 | 937 |
942 const char* name() { return name_; } | 938 int number() const { return number_; } |
943 void set_name(const char* name) { name_ = name; } | |
944 | |
945 int number() { return number_; } | |
946 void increment_number(int num) { number_ += num; } | 939 void increment_number(int num) { number_ += num; } |
947 | 940 |
948 int bytes() { return bytes_; } | 941 int bytes() const { return bytes_; } |
949 void increment_bytes(int size) { bytes_ += size; } | 942 void increment_bytes(int size) { bytes_ += size; } |
950 | 943 |
951 // Clear the number of objects and size fields, but not the name. | |
952 void clear() { | 944 void clear() { |
953 number_ = 0; | 945 number_ = 0; |
954 bytes_ = 0; | 946 bytes_ = 0; |
955 } | 947 } |
956 | 948 |
957 private: | 949 private: |
958 const char* name_; | |
959 int number_; | 950 int number_; |
960 int bytes_; | 951 int bytes_; |
961 }; | 952 }; |
| 953 |
| 954 |
| 955 // HistogramInfo class for recording a single "bar" of a histogram. This |
| 956 // class is used for collecting statistics to print to stdout (when compiled |
| 957 // with DEBUG) or to the log file (when compiled with |
| 958 // ENABLE_LOGGING_AND_PROFILING). |
| 959 class HistogramInfo: public NumberAndSizeInfo { |
| 960 public: |
| 961 HistogramInfo() : NumberAndSizeInfo() {} |
| 962 |
| 963 const char* name() { return name_; } |
| 964 void set_name(const char* name) { name_ = name; } |
| 965 |
| 966 private: |
| 967 const char* name_; |
| 968 }; |
962 #endif | 969 #endif |
963 | 970 |
964 | 971 |
965 // ----------------------------------------------------------------------------- | 972 // ----------------------------------------------------------------------------- |
966 // SemiSpace in young generation | 973 // SemiSpace in young generation |
967 // | 974 // |
968 // A semispace is a contiguous chunk of memory. The mark-compact collector | 975 // A semispace is a contiguous chunk of memory. The mark-compact collector |
969 // uses the memory in the from space as a marking stack when tracing live | 976 // uses the memory in the from space as a marking stack when tracing live |
970 // objects. | 977 // objects. |
971 | 978 |
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1799 | 1806 |
1800 private: | 1807 private: |
1801 LargeObjectChunk* current_; | 1808 LargeObjectChunk* current_; |
1802 HeapObjectCallback size_func_; | 1809 HeapObjectCallback size_func_; |
1803 }; | 1810 }; |
1804 | 1811 |
1805 | 1812 |
1806 } } // namespace v8::internal | 1813 } } // namespace v8::internal |
1807 | 1814 |
1808 #endif // V8_SPACES_H_ | 1815 #endif // V8_SPACES_H_ |
OLD | NEW |