| 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 2279 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2290     double timeStamp = WTF::currentTimeMS(); | 2290     double timeStamp = WTF::currentTimeMS(); | 
| 2291 #if ENABLE(GC_PROFILING) | 2291 #if ENABLE(GC_PROFILING) | 
| 2292     static_cast<MarkingVisitor<Visitor::GlobalMarking>*>(s_markingVisitor)->obje
      ctGraph().clear(); | 2292     static_cast<MarkingVisitor<Visitor::GlobalMarking>*>(s_markingVisitor)->obje
      ctGraph().clear(); | 
| 2293 #endif | 2293 #endif | 
| 2294 | 2294 | 
| 2295     // Disallow allocation during garbage collection (but not during the | 2295     // Disallow allocation during garbage collection (but not during the | 
| 2296     // finalization that happens when the gcScope is torn down). | 2296     // finalization that happens when the gcScope is torn down). | 
| 2297     ThreadState::NoAllocationScope noAllocationScope(state); | 2297     ThreadState::NoAllocationScope noAllocationScope(state); | 
| 2298 | 2298 | 
| 2299     preGC(); | 2299     preGC(); | 
| 2300     StackFrameDepth::configureStackLimit(); | 2300 | 
| 2301     ASSERT(StackFrameDepth::isSafeToRecurse()); | 2301     StackFrameDepthScope stackDepthScope; | 
| 2302 | 2302 | 
| 2303     size_t totalObjectSize = Heap::allocatedObjectSize() + Heap::markedObjectSiz
      e(); | 2303     size_t totalObjectSize = Heap::allocatedObjectSize() + Heap::markedObjectSiz
      e(); | 
| 2304     Heap::resetHeapCounters(); | 2304     Heap::resetHeapCounters(); | 
| 2305 | 2305 | 
| 2306     // 1. Trace persistent roots. | 2306     // 1. Trace persistent roots. | 
| 2307     ThreadState::visitPersistentRoots(s_markingVisitor); | 2307     ThreadState::visitPersistentRoots(s_markingVisitor); | 
| 2308 | 2308 | 
| 2309     // 2. Trace objects reachable from the persistent roots including | 2309     // 2. Trace objects reachable from the persistent roots including | 
| 2310     // ephemerons. | 2310     // ephemerons. | 
| 2311     processMarkingStack(s_markingVisitor); | 2311     processMarkingStack(s_markingVisitor); | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2351 void Heap::collectGarbageForTerminatingThread(ThreadState* state) | 2351 void Heap::collectGarbageForTerminatingThread(ThreadState* state) | 
| 2352 { | 2352 { | 
| 2353     // We explicitly do not enter a safepoint while doing thread specific | 2353     // We explicitly do not enter a safepoint while doing thread specific | 
| 2354     // garbage collection since we don't want to allow a global GC at the | 2354     // garbage collection since we don't want to allow a global GC at the | 
| 2355     // same time as a thread local GC. | 2355     // same time as a thread local GC. | 
| 2356     { | 2356     { | 
| 2357         MarkingVisitor<Visitor::ThreadLocalMarking> markingVisitor; | 2357         MarkingVisitor<Visitor::ThreadLocalMarking> markingVisitor; | 
| 2358         ThreadState::NoAllocationScope noAllocationScope(state); | 2358         ThreadState::NoAllocationScope noAllocationScope(state); | 
| 2359 | 2359 | 
| 2360         state->preGC(); | 2360         state->preGC(); | 
| 2361         StackFrameDepth::configureStackLimit(); | 2361         StackFrameDepthScope stackDepthScope; | 
| 2362         ASSERT(StackFrameDepth::isSafeToRecurse()); |  | 
| 2363 | 2362 | 
| 2364         // 1. Trace the thread local persistent roots. For thread local GCs we | 2363         // 1. Trace the thread local persistent roots. For thread local GCs we | 
| 2365         // don't trace the stack (ie. no conservative scanning) since this is | 2364         // don't trace the stack (ie. no conservative scanning) since this is | 
| 2366         // only called during thread shutdown where there should be no objects | 2365         // only called during thread shutdown where there should be no objects | 
| 2367         // on the stack. | 2366         // on the stack. | 
| 2368         // We also assume that orphaned pages have no objects reachable from | 2367         // We also assume that orphaned pages have no objects reachable from | 
| 2369         // persistent handles on other threads or CrossThreadPersistents.  The | 2368         // persistent handles on other threads or CrossThreadPersistents.  The | 
| 2370         // only cases where this could happen is if a subsequent conservative | 2369         // only cases where this could happen is if a subsequent conservative | 
| 2371         // global GC finds a "pointer" on the stack or due to a programming | 2370         // global GC finds a "pointer" on the stack or due to a programming | 
| 2372         // error where an object has a dangling cross-thread pointer to an | 2371         // error where an object has a dangling cross-thread pointer to an | 
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2726 size_t Heap::s_allocatedObjectSize = 0; | 2725 size_t Heap::s_allocatedObjectSize = 0; | 
| 2727 size_t Heap::s_allocatedSpace = 0; | 2726 size_t Heap::s_allocatedSpace = 0; | 
| 2728 size_t Heap::s_markedObjectSize = 0; | 2727 size_t Heap::s_markedObjectSize = 0; | 
| 2729 // We don't want to use 0 KB for the initial value because it may end up | 2728 // We don't want to use 0 KB for the initial value because it may end up | 
| 2730 // triggering the first GC of some thread too prematurely. | 2729 // triggering the first GC of some thread too prematurely. | 
| 2731 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024; | 2730 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024; | 
| 2732 size_t Heap::s_externalObjectSizeAtLastGC = 0; | 2731 size_t Heap::s_externalObjectSizeAtLastGC = 0; | 
| 2733 double Heap::s_estimatedMarkingTimePerByte = 0.0; | 2732 double Heap::s_estimatedMarkingTimePerByte = 0.0; | 
| 2734 | 2733 | 
| 2735 } // namespace blink | 2734 } // namespace blink | 
| OLD | NEW | 
|---|