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 2330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2341 | 2341 |
2342 void Heap::postGC(ThreadState::GCType gcType) | 2342 void Heap::postGC(ThreadState::GCType gcType) |
2343 { | 2343 { |
2344 ASSERT(ThreadState::current()->isInGC()); | 2344 ASSERT(ThreadState::current()->isInGC()); |
2345 for (ThreadState* state : ThreadState::attachedThreads()) | 2345 for (ThreadState* state : ThreadState::attachedThreads()) |
2346 state->postGC(gcType); | 2346 state->postGC(gcType); |
2347 } | 2347 } |
2348 | 2348 |
2349 void Heap::collectGarbage(ThreadState::StackState stackState, ThreadState::GCTyp
e gcType) | 2349 void Heap::collectGarbage(ThreadState::StackState stackState, ThreadState::GCTyp
e gcType) |
2350 { | 2350 { |
2351 ASSERT(!ThreadState::current()->isSweepingInProgress()); | |
2352 ASSERT(!ThreadState::current()->sweepForbidden()); | |
2353 | |
2354 ThreadState* state = ThreadState::current(); | 2351 ThreadState* state = ThreadState::current(); |
2355 ThreadState::GCState originalGCState = state->gcState(); | 2352 ThreadState::GCState originalGCState = state->gcState(); |
2356 state->setGCState(ThreadState::StoppingOtherThreads); | 2353 state->setGCState(ThreadState::StoppingOtherThreads); |
2357 | 2354 |
2358 GCScope gcScope(stackState); | 2355 GCScope gcScope(stackState); |
2359 // Check if we successfully parked the other threads. If not we bail out of | 2356 // Check if we successfully parked the other threads. If not we bail out of |
2360 // the GC. | 2357 // the GC. |
2361 if (!gcScope.allThreadsParked()) { | 2358 if (!gcScope.allThreadsParked()) { |
2362 // Restore the original GCState. | 2359 // Restore the original GCState. |
2363 state->setGCState(originalGCState); | 2360 state->setGCState(originalGCState); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2425 Platform::current()->histogramCustomCounts("BlinkGC.TotalObjectSpace", H
eap::allocatedObjectSize() / 1024, 0, 4 * 1024 * 1024, 50); | 2422 Platform::current()->histogramCustomCounts("BlinkGC.TotalObjectSpace", H
eap::allocatedObjectSize() / 1024, 0, 4 * 1024 * 1024, 50); |
2426 Platform::current()->histogramCustomCounts("BlinkGC.TotalAllocatedSpace"
, Heap::allocatedSpace() / 1024, 0, 4 * 1024 * 1024, 50); | 2423 Platform::current()->histogramCustomCounts("BlinkGC.TotalAllocatedSpace"
, Heap::allocatedSpace() / 1024, 0, 4 * 1024 * 1024, 50); |
2427 } | 2424 } |
2428 | 2425 |
2429 if (state->isMainThread()) | 2426 if (state->isMainThread()) |
2430 ScriptForbiddenScope::exit(); | 2427 ScriptForbiddenScope::exit(); |
2431 } | 2428 } |
2432 | 2429 |
2433 void Heap::collectGarbageForTerminatingThread(ThreadState* state) | 2430 void Heap::collectGarbageForTerminatingThread(ThreadState* state) |
2434 { | 2431 { |
2435 ASSERT(!ThreadState::current()->isSweepingInProgress()); | |
2436 ASSERT(!ThreadState::current()->sweepForbidden()); | |
2437 | |
2438 // We explicitly do not enter a safepoint while doing thread specific | 2432 // We explicitly do not enter a safepoint while doing thread specific |
2439 // garbage collection since we don't want to allow a global GC at the | 2433 // garbage collection since we don't want to allow a global GC at the |
2440 // same time as a thread local GC. | 2434 // same time as a thread local GC. |
2441 { | 2435 { |
2442 MarkingVisitor<ThreadLocalMarking> markingVisitor; | 2436 MarkingVisitor<ThreadLocalMarking> markingVisitor; |
2443 ThreadState::NoAllocationScope noAllocationScope(state); | 2437 ThreadState::NoAllocationScope noAllocationScope(state); |
2444 | 2438 |
2445 state->preGC(); | 2439 state->preGC(); |
2446 s_markingVisitor->configureEagerTraceLimit(); | 2440 s_markingVisitor->configureEagerTraceLimit(); |
2447 ASSERT(s_markingVisitor->canTraceEagerly()); | 2441 ASSERT(s_markingVisitor->canTraceEagerly()); |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2771 bool Heap::s_shutdownCalled = false; | 2765 bool Heap::s_shutdownCalled = false; |
2772 bool Heap::s_lastGCWasConservative = false; | 2766 bool Heap::s_lastGCWasConservative = false; |
2773 FreePagePool* Heap::s_freePagePool; | 2767 FreePagePool* Heap::s_freePagePool; |
2774 OrphanedPagePool* Heap::s_orphanedPagePool; | 2768 OrphanedPagePool* Heap::s_orphanedPagePool; |
2775 Heap::RegionTree* Heap::s_regionTree = nullptr; | 2769 Heap::RegionTree* Heap::s_regionTree = nullptr; |
2776 size_t Heap::s_allocatedObjectSize = 0; | 2770 size_t Heap::s_allocatedObjectSize = 0; |
2777 size_t Heap::s_allocatedSpace = 0; | 2771 size_t Heap::s_allocatedSpace = 0; |
2778 size_t Heap::s_markedObjectSize = 0; | 2772 size_t Heap::s_markedObjectSize = 0; |
2779 | 2773 |
2780 } // namespace blink | 2774 } // namespace blink |
OLD | NEW |