| 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 1864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1875 RELEASE_ASSERT(!state->isInGC()); | 1875 RELEASE_ASSERT(!state->isInGC()); |
| 1876 state->completeSweep(); | 1876 state->completeSweep(); |
| 1877 ThreadState::GCState originalGCState = state->gcState(); | 1877 ThreadState::GCState originalGCState = state->gcState(); |
| 1878 state->setGCState(ThreadState::StoppingOtherThreads); | 1878 state->setGCState(ThreadState::StoppingOtherThreads); |
| 1879 | 1879 |
| 1880 GCScope gcScope(stackState); | 1880 GCScope gcScope(stackState); |
| 1881 // Check if we successfully parked the other threads. If not we bail out of | 1881 // Check if we successfully parked the other threads. If not we bail out of |
| 1882 // the GC. | 1882 // the GC. |
| 1883 if (!gcScope.allThreadsParked()) { | 1883 if (!gcScope.allThreadsParked()) { |
| 1884 // Restore the original GCState. | 1884 // Restore the original GCState. |
| 1885 state->setGCState(originalGCState); | 1885 if (LIKELY(state->gcState() == ThreadState::StoppingOtherThreads)) |
| 1886 state->setGCState(originalGCState); |
| 1886 return; | 1887 return; |
| 1887 } | 1888 } |
| 1888 | 1889 |
| 1889 if (state->isMainThread()) | 1890 if (state->isMainThread()) |
| 1890 ScriptForbiddenScope::enter(); | 1891 ScriptForbiddenScope::enter(); |
| 1891 | 1892 |
| 1892 s_lastGCWasConservative = false; | 1893 s_lastGCWasConservative = false; |
| 1893 | 1894 |
| 1894 TRACE_EVENT2("blink_gc", "Heap::collectGarbage", | 1895 TRACE_EVENT2("blink_gc", "Heap::collectGarbage", |
| 1895 "lazySweeping", gcType == ThreadState::GCWithoutSweep, | 1896 "lazySweeping", gcType == ThreadState::GCWithoutSweep, |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2223 size_t Heap::s_allocatedObjectSize = 0; | 2224 size_t Heap::s_allocatedObjectSize = 0; |
| 2224 size_t Heap::s_allocatedSpace = 0; | 2225 size_t Heap::s_allocatedSpace = 0; |
| 2225 size_t Heap::s_markedObjectSize = 0; | 2226 size_t Heap::s_markedObjectSize = 0; |
| 2226 // We don't want to use 0 KB for the initial value because it may end up | 2227 // We don't want to use 0 KB for the initial value because it may end up |
| 2227 // triggering the first GC of some thread too prematurely. | 2228 // triggering the first GC of some thread too prematurely. |
| 2228 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024; | 2229 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024; |
| 2229 size_t Heap::s_externalObjectSizeAtLastGC = 0; | 2230 size_t Heap::s_externalObjectSizeAtLastGC = 0; |
| 2230 double Heap::s_estimatedMarkingTimePerByte = 0.0; | 2231 double Heap::s_estimatedMarkingTimePerByte = 0.0; |
| 2231 | 2232 |
| 2232 } // namespace blink | 2233 } // namespace blink |
| OLD | NEW |