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 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 heap_histograms[i].name(), | 1134 heap_histograms[i].name(), |
1135 heap_histograms[i].number(), | 1135 heap_histograms[i].number(), |
1136 heap_histograms[i].bytes()); | 1136 heap_histograms[i].bytes()); |
1137 } | 1137 } |
1138 } | 1138 } |
1139 PrintF("\n"); | 1139 PrintF("\n"); |
1140 | 1140 |
1141 // Summarize string types. | 1141 // Summarize string types. |
1142 int string_number = 0; | 1142 int string_number = 0; |
1143 int string_bytes = 0; | 1143 int string_bytes = 0; |
1144 #define INCREMENT(type, size, name) \ | 1144 #define INCREMENT(type, size, name, camel_name) \ |
1145 string_number += heap_histograms[type].number(); \ | 1145 string_number += heap_histograms[type].number(); \ |
1146 string_bytes += heap_histograms[type].bytes(); | 1146 string_bytes += heap_histograms[type].bytes(); |
1147 STRING_TYPE_LIST(INCREMENT) | 1147 STRING_TYPE_LIST(INCREMENT) |
1148 #undef INCREMENT | 1148 #undef INCREMENT |
1149 if (string_number > 0) { | 1149 if (string_number > 0) { |
1150 PrintF(" %-33s%10d (%10d bytes)\n\n", "STRING_TYPE", string_number, | 1150 PrintF(" %-33s%10d (%10d bytes)\n\n", "STRING_TYPE", string_number, |
1151 string_bytes); | 1151 string_bytes); |
1152 } | 1152 } |
1153 | 1153 |
1154 if (FLAG_collect_heap_spill_statistics && print_spill) { | 1154 if (FLAG_collect_heap_spill_statistics && print_spill) { |
(...skipping 23 matching lines...) Expand all Loading... |
1178 while (it.has_next()) RecordAllocation(it.next()); | 1178 while (it.has_next()) RecordAllocation(it.next()); |
1179 } | 1179 } |
1180 | 1180 |
1181 | 1181 |
1182 #ifdef ENABLE_LOGGING_AND_PROFILING | 1182 #ifdef ENABLE_LOGGING_AND_PROFILING |
1183 static void DoReportStatistics(HistogramInfo* info, const char* description) { | 1183 static void DoReportStatistics(HistogramInfo* info, const char* description) { |
1184 LOG(HeapSampleBeginEvent("NewSpace", description)); | 1184 LOG(HeapSampleBeginEvent("NewSpace", description)); |
1185 // Lump all the string types together. | 1185 // Lump all the string types together. |
1186 int string_number = 0; | 1186 int string_number = 0; |
1187 int string_bytes = 0; | 1187 int string_bytes = 0; |
1188 #define INCREMENT(type, size, name) \ | 1188 #define INCREMENT(type, size, name, camel_name) \ |
1189 string_number += info[type].number(); \ | 1189 string_number += info[type].number(); \ |
1190 string_bytes += info[type].bytes(); | 1190 string_bytes += info[type].bytes(); |
1191 STRING_TYPE_LIST(INCREMENT) | 1191 STRING_TYPE_LIST(INCREMENT) |
1192 #undef INCREMENT | 1192 #undef INCREMENT |
1193 if (string_number > 0) { | 1193 if (string_number > 0) { |
1194 LOG(HeapSampleItemEvent("STRING_TYPE", string_number, string_bytes)); | 1194 LOG(HeapSampleItemEvent("STRING_TYPE", string_number, string_bytes)); |
1195 } | 1195 } |
1196 | 1196 |
1197 // Then do the other types. | 1197 // Then do the other types. |
1198 for (int i = FIRST_NONSTRING_TYPE; i <= LAST_TYPE; ++i) { | 1198 for (int i = FIRST_NONSTRING_TYPE; i <= LAST_TYPE; ++i) { |
1199 if (info[i].number() > 0) { | 1199 if (info[i].number() > 0) { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 ASSERT(IsAligned(size_in_bytes, kPointerSize)); | 1259 ASSERT(IsAligned(size_in_bytes, kPointerSize)); |
1260 | 1260 |
1261 // We write a map and possibly size information to the block. If the block | 1261 // We write a map and possibly size information to the block. If the block |
1262 // is big enough to be a ByteArray with at least one extra word (the next | 1262 // is big enough to be a ByteArray with at least one extra word (the next |
1263 // pointer), we set its map to be the byte array map and its size to an | 1263 // pointer), we set its map to be the byte array map and its size to an |
1264 // appropriate array length for the desired size from HeapObject::Size(). | 1264 // appropriate array length for the desired size from HeapObject::Size(). |
1265 // If the block is too small (eg, one or two words), to hold both a size | 1265 // If the block is too small (eg, one or two words), to hold both a size |
1266 // field and a next pointer, we give it a filler map that gives it the | 1266 // field and a next pointer, we give it a filler map that gives it the |
1267 // correct size. | 1267 // correct size. |
1268 if (size_in_bytes > ByteArray::kHeaderSize) { | 1268 if (size_in_bytes > ByteArray::kHeaderSize) { |
1269 set_map(Heap::byte_array_map()); | 1269 set_map(Heap::raw_unchecked_byte_array_map()); |
1270 ByteArray::cast(this)->set_length(ByteArray::LengthFor(size_in_bytes)); | 1270 ByteArray::cast(this)->set_length(ByteArray::LengthFor(size_in_bytes)); |
1271 } else if (size_in_bytes == kPointerSize) { | 1271 } else if (size_in_bytes == kPointerSize) { |
1272 set_map(Heap::one_word_filler_map()); | 1272 set_map(Heap::raw_unchecked_one_word_filler_map()); |
1273 } else if (size_in_bytes == 2 * kPointerSize) { | 1273 } else if (size_in_bytes == 2 * kPointerSize) { |
1274 set_map(Heap::two_word_filler_map()); | 1274 set_map(Heap::raw_unchecked_two_word_filler_map()); |
1275 } else { | 1275 } else { |
1276 UNREACHABLE(); | 1276 UNREACHABLE(); |
1277 } | 1277 } |
1278 ASSERT(Size() == size_in_bytes); | 1278 ASSERT(Size() == size_in_bytes); |
1279 } | 1279 } |
1280 | 1280 |
1281 | 1281 |
1282 Address FreeListNode::next() { | 1282 Address FreeListNode::next() { |
1283 ASSERT(map() == Heap::byte_array_map()); | 1283 ASSERT(map() == Heap::raw_unchecked_byte_array_map()); |
1284 ASSERT(Size() >= kNextOffset + kPointerSize); | 1284 ASSERT(Size() >= kNextOffset + kPointerSize); |
1285 return Memory::Address_at(address() + kNextOffset); | 1285 return Memory::Address_at(address() + kNextOffset); |
1286 } | 1286 } |
1287 | 1287 |
1288 | 1288 |
1289 void FreeListNode::set_next(Address next) { | 1289 void FreeListNode::set_next(Address next) { |
1290 ASSERT(map() == Heap::byte_array_map()); | 1290 ASSERT(map() == Heap::raw_unchecked_byte_array_map()); |
1291 ASSERT(Size() >= kNextOffset + kPointerSize); | 1291 ASSERT(Size() >= kNextOffset + kPointerSize); |
1292 Memory::Address_at(address() + kNextOffset) = next; | 1292 Memory::Address_at(address() + kNextOffset) = next; |
1293 } | 1293 } |
1294 | 1294 |
1295 | 1295 |
1296 OldSpaceFreeList::OldSpaceFreeList(AllocationSpace owner) : owner_(owner) { | 1296 OldSpaceFreeList::OldSpaceFreeList(AllocationSpace owner) : owner_(owner) { |
1297 Reset(); | 1297 Reset(); |
1298 } | 1298 } |
1299 | 1299 |
1300 | 1300 |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1849 int rset = Memory::int_at(rset_addr); | 1849 int rset = Memory::int_at(rset_addr); |
1850 if (rset != 0) { | 1850 if (rset != 0) { |
1851 // Bits were set | 1851 // Bits were set |
1852 int intoff = rset_addr - p->address(); | 1852 int intoff = rset_addr - p->address(); |
1853 int bitoff = 0; | 1853 int bitoff = 0; |
1854 for (; bitoff < kBitsPerInt; ++bitoff) { | 1854 for (; bitoff < kBitsPerInt; ++bitoff) { |
1855 if ((rset & (1 << bitoff)) != 0) { | 1855 if ((rset & (1 << bitoff)) != 0) { |
1856 int bitpos = intoff*kBitsPerByte + bitoff; | 1856 int bitpos = intoff*kBitsPerByte + bitoff; |
1857 Address slot = p->OffsetToAddress(bitpos << kObjectAlignmentBits); | 1857 Address slot = p->OffsetToAddress(bitpos << kObjectAlignmentBits); |
1858 Object** obj = reinterpret_cast<Object**>(slot); | 1858 Object** obj = reinterpret_cast<Object**>(slot); |
1859 if (*obj == Heap::fixed_array_map()) { | 1859 if (*obj == Heap::raw_unchecked_fixed_array_map()) { |
1860 rset_marked_arrays++; | 1860 rset_marked_arrays++; |
1861 FixedArray* fa = FixedArray::cast(HeapObject::FromAddress(slot)); | 1861 FixedArray* fa = FixedArray::cast(HeapObject::FromAddress(slot)); |
1862 | 1862 |
1863 rset_marked_array_elements += fa->length(); | 1863 rset_marked_array_elements += fa->length(); |
1864 // Manually inline FixedArray::IterateBody | 1864 // Manually inline FixedArray::IterateBody |
1865 Address elm_start = slot + FixedArray::kHeaderSize; | 1865 Address elm_start = slot + FixedArray::kHeaderSize; |
1866 Address elm_stop = elm_start + fa->length() * kPointerSize; | 1866 Address elm_stop = elm_start + fa->length() * kPointerSize; |
1867 for (Address elm_addr = elm_start; | 1867 for (Address elm_addr = elm_start; |
1868 elm_addr < elm_stop; elm_addr += kPointerSize) { | 1868 elm_addr < elm_stop; elm_addr += kPointerSize) { |
1869 // Filter non-heap-object pointers | 1869 // Filter non-heap-object pointers |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2629 reinterpret_cast<Object**>(object->address() | 2629 reinterpret_cast<Object**>(object->address() |
2630 + Page::kObjectAreaSize), | 2630 + Page::kObjectAreaSize), |
2631 allocation_top); | 2631 allocation_top); |
2632 PrintF("\n"); | 2632 PrintF("\n"); |
2633 } | 2633 } |
2634 } | 2634 } |
2635 } | 2635 } |
2636 #endif // DEBUG | 2636 #endif // DEBUG |
2637 | 2637 |
2638 } } // namespace v8::internal | 2638 } } // namespace v8::internal |
OLD | NEW |