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 2189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2200 state->postGC(gcType); | 2200 state->postGC(gcType); |
2201 } | 2201 } |
2202 | 2202 |
2203 const char* Heap::gcReasonString(GCReason reason) | 2203 const char* Heap::gcReasonString(GCReason reason) |
2204 { | 2204 { |
2205 switch (reason) { | 2205 switch (reason) { |
2206 #define STRINGIFY_REASON(reason) case reason: return #reason; | 2206 #define STRINGIFY_REASON(reason) case reason: return #reason; |
2207 STRINGIFY_REASON(IdleGC); | 2207 STRINGIFY_REASON(IdleGC); |
2208 STRINGIFY_REASON(PreciseGC); | 2208 STRINGIFY_REASON(PreciseGC); |
2209 STRINGIFY_REASON(ConservativeGC); | 2209 STRINGIFY_REASON(ConservativeGC); |
2210 STRINGIFY_REASON(ForcedGCForTesting); | 2210 STRINGIFY_REASON(ForcedGC); |
2211 #undef STRINGIFY_REASON | 2211 #undef STRINGIFY_REASON |
2212 case NumberOfGCReason: ASSERT_NOT_REACHED(); | 2212 case NumberOfGCReason: ASSERT_NOT_REACHED(); |
2213 } | 2213 } |
2214 return "<Unknown>"; | 2214 return "<Unknown>"; |
2215 } | 2215 } |
2216 | 2216 |
2217 void Heap::collectGarbage(ThreadState::StackState stackState, ThreadState::GCTyp
e gcType, GCReason reason) | 2217 void Heap::collectGarbage(ThreadState::StackState stackState, ThreadState::GCTyp
e gcType, GCReason reason) |
2218 { | 2218 { |
2219 ThreadState* state = ThreadState::current(); | 2219 ThreadState* state = ThreadState::current(); |
2220 ThreadState::GCState originalGCState = state->gcState(); | 2220 ThreadState::GCState originalGCState = state->gcState(); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 size_t previousLiveObjects = 0; | 2399 size_t previousLiveObjects = 0; |
2400 for (int i = 0; i < 5; ++i) { | 2400 for (int i = 0; i < 5; ++i) { |
2401 collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWithSw
eep, ForcedGCForTesting); | 2401 collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWithSw
eep, ForcedGC); |
2402 size_t liveObjects = Heap::markedObjectSize(); | 2402 size_t liveObjects = Heap::markedObjectSize(); |
2403 if (liveObjects == previousLiveObjects) | 2403 if (liveObjects == previousLiveObjects) |
2404 break; | 2404 break; |
2405 previousLiveObjects = liveObjects; | 2405 previousLiveObjects = liveObjects; |
2406 } | 2406 } |
2407 } | 2407 } |
2408 | 2408 |
2409 double Heap::estimatedMarkingTime() | 2409 double Heap::estimatedMarkingTime() |
2410 { | 2410 { |
2411 ASSERT(ThreadState::current()->isMainThread()); | 2411 ASSERT(ThreadState::current()->isMainThread()); |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2700 // 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 |
2701 // triggering the first GC of some thread too prematurely. | 2701 // triggering the first GC of some thread too prematurely. |
2702 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024; | 2702 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024; |
2703 | 2703 |
2704 size_t Heap::s_externallyAllocatedBytes = 0; | 2704 size_t Heap::s_externallyAllocatedBytes = 0; |
2705 size_t Heap::s_externallyAllocatedBytesAlive = 0; | 2705 size_t Heap::s_externallyAllocatedBytesAlive = 0; |
2706 unsigned Heap::s_requestedUrgentGC = false; | 2706 unsigned Heap::s_requestedUrgentGC = false; |
2707 double Heap::s_estimatedMarkingTimePerByte = 0.0; | 2707 double Heap::s_estimatedMarkingTimePerByte = 0.0; |
2708 | 2708 |
2709 } // namespace blink | 2709 } // namespace blink |
OLD | NEW |