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