OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 2378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2389 ASSERT(s_markingStack->isEmpty()); | 2389 ASSERT(s_markingStack->isEmpty()); |
2390 } | 2390 } |
2391 | 2391 |
2392 void Heap::collectAllGarbage() | 2392 void Heap::collectAllGarbage() |
2393 { | 2393 { |
2394 // FIXME: Oilpan: we should perform a single GC and everything | 2394 // FIXME: Oilpan: we should perform a single GC and everything |
2395 // should die. Unfortunately it is not the case for all objects | 2395 // should die. Unfortunately it is not the case for all objects |
2396 // because the hierarchy was not completely moved to the heap and | 2396 // because the hierarchy was not completely moved to the heap and |
2397 // some heap allocated objects own objects that contain persistents | 2397 // some heap allocated objects own objects that contain persistents |
2398 // pointing to other heap allocated objects. | 2398 // pointing to other heap allocated objects. |
2399 for (int i = 0; i < 5; ++i) | 2399 size_t previousLiveObjects = 0; |
2400 for (int i = 0; i < 5; ++i) { | |
2400 collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWithSw eep, ForcedGCForTesting); | 2401 collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWithSw eep, ForcedGCForTesting); |
2402 size_t liveObjects = Heap::estimatedLiveObjectSize(); | |
haraken
2015/04/13 23:12:12
Shall we use Heap::markedObjectSize()?
Conceptual
sof
2015/04/14 06:40:51
ok, let's leave estimatedLiveObjectSize() for the
| |
2403 if (liveObjects == previousLiveObjects) | |
2404 break; | |
2405 previousLiveObjects = liveObjects; | |
2406 } | |
2401 } | 2407 } |
2402 | 2408 |
2403 double Heap::estimatedMarkingTime() | 2409 double Heap::estimatedMarkingTime() |
2404 { | 2410 { |
2405 ASSERT(ThreadState::current()->isMainThread()); | 2411 ASSERT(ThreadState::current()->isMainThread()); |
2406 | 2412 |
2407 // Use 8 ms as initial estimated marking time. | 2413 // Use 8 ms as initial estimated marking time. |
2408 // 8 ms is long enough for low-end mobile devices to mark common | 2414 // 8 ms is long enough for low-end mobile devices to mark common |
2409 // real-world object graphs. | 2415 // real-world object graphs. |
2410 if (s_estimatedMarkingTimePerByte == 0) | 2416 if (s_estimatedMarkingTimePerByte == 0) |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2694 // We don't want to use 0 KB for the initial value because it may end up | 2700 // We don't want to use 0 KB for the initial value because it may end up |
2695 // triggering the first GC of some thread too prematurely. | 2701 // triggering the first GC of some thread too prematurely. |
2696 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024; | 2702 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024; |
2697 | 2703 |
2698 size_t Heap::s_externallyAllocatedBytes = 0; | 2704 size_t Heap::s_externallyAllocatedBytes = 0; |
2699 size_t Heap::s_externallyAllocatedBytesAlive = 0; | 2705 size_t Heap::s_externallyAllocatedBytesAlive = 0; |
2700 unsigned Heap::s_requestedUrgentGC = false; | 2706 unsigned Heap::s_requestedUrgentGC = false; |
2701 double Heap::s_estimatedMarkingTimePerByte = 0.0; | 2707 double Heap::s_estimatedMarkingTimePerByte = 0.0; |
2702 | 2708 |
2703 } // namespace blink | 2709 } // namespace blink |
OLD | NEW |