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 2275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2286 if (!obj->IsFreeSpace()) { | 2286 if (!obj->IsFreeSpace()) { |
2287 size_of_objects_2 += obj->Size(); | 2287 size_of_objects_2 += obj->Size(); |
2288 } | 2288 } |
2289 } | 2289 } |
2290 // Delta must be within 5% of the larger result. | 2290 // Delta must be within 5% of the larger result. |
2291 // TODO(gc): Tighten this up by distinguishing between byte | 2291 // TODO(gc): Tighten this up by distinguishing between byte |
2292 // arrays that are real and those that merely mark free space | 2292 // arrays that are real and those that merely mark free space |
2293 // on the heap. | 2293 // on the heap. |
2294 if (size_of_objects_1 > size_of_objects_2) { | 2294 if (size_of_objects_1 > size_of_objects_2) { |
2295 intptr_t delta = size_of_objects_1 - size_of_objects_2; | 2295 intptr_t delta = size_of_objects_1 - size_of_objects_2; |
2296 PrintF("Heap::SizeOfObjects: %" V8_PTR_PREFIX "d, " | 2296 PrintF("Heap::SizeOfObjects: %" V8PRIdPTR |
2297 "Iterator: %" V8_PTR_PREFIX "d, " | 2297 ", " |
2298 "delta: %" V8_PTR_PREFIX "d\n", | 2298 "Iterator: %" V8PRIdPTR |
| 2299 ", " |
| 2300 "delta: %" V8PRIdPTR "\n", |
2299 size_of_objects_1, size_of_objects_2, delta); | 2301 size_of_objects_1, size_of_objects_2, delta); |
2300 CHECK_GT(size_of_objects_1 / 20, delta); | 2302 CHECK_GT(size_of_objects_1 / 20, delta); |
2301 } else { | 2303 } else { |
2302 intptr_t delta = size_of_objects_2 - size_of_objects_1; | 2304 intptr_t delta = size_of_objects_2 - size_of_objects_1; |
2303 PrintF("Heap::SizeOfObjects: %" V8_PTR_PREFIX "d, " | 2305 PrintF("Heap::SizeOfObjects: %" V8PRIdPTR |
2304 "Iterator: %" V8_PTR_PREFIX "d, " | 2306 ", " |
2305 "delta: %" V8_PTR_PREFIX "d\n", | 2307 "Iterator: %" V8PRIdPTR |
| 2308 ", " |
| 2309 "delta: %" V8PRIdPTR "\n", |
2306 size_of_objects_1, size_of_objects_2, delta); | 2310 size_of_objects_1, size_of_objects_2, delta); |
2307 CHECK_GT(size_of_objects_2 / 20, delta); | 2311 CHECK_GT(size_of_objects_2 / 20, delta); |
2308 } | 2312 } |
2309 } | 2313 } |
2310 | 2314 |
2311 | 2315 |
2312 static void FillUpNewSpace(NewSpace* new_space) { | 2316 static void FillUpNewSpace(NewSpace* new_space) { |
2313 // Fill up new space to the point that it is completely full. Make sure | 2317 // Fill up new space to the point that it is completely full. Make sure |
2314 // that the scavenger does not undo the filling. | 2318 // that the scavenger does not undo the filling. |
2315 Heap* heap = new_space->heap(); | 2319 Heap* heap = new_space->heap(); |
(...skipping 4282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6598 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(arrays[j], N - 1); | 6602 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(arrays[j], N - 1); |
6599 } | 6603 } |
6600 } | 6604 } |
6601 // Force allocation from the free list. | 6605 // Force allocation from the free list. |
6602 heap->set_force_oom(true); | 6606 heap->set_force_oom(true); |
6603 heap->CollectGarbage(OLD_SPACE); | 6607 heap->CollectGarbage(OLD_SPACE); |
6604 } | 6608 } |
6605 | 6609 |
6606 } // namespace internal | 6610 } // namespace internal |
6607 } // namespace v8 | 6611 } // namespace v8 |
OLD | NEW |