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 2248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2259 STRINGIFY_REASON(ForcedGC); | 2259 STRINGIFY_REASON(ForcedGC); |
2260 #undef STRINGIFY_REASON | 2260 #undef STRINGIFY_REASON |
2261 case NumberOfGCReason: ASSERT_NOT_REACHED(); | 2261 case NumberOfGCReason: ASSERT_NOT_REACHED(); |
2262 } | 2262 } |
2263 return "<Unknown>"; | 2263 return "<Unknown>"; |
2264 } | 2264 } |
2265 | 2265 |
2266 void Heap::collectGarbage(ThreadState::StackState stackState, ThreadState::GCTyp
e gcType, GCReason reason) | 2266 void Heap::collectGarbage(ThreadState::StackState stackState, ThreadState::GCTyp
e gcType, GCReason reason) |
2267 { | 2267 { |
2268 ThreadState* state = ThreadState::current(); | 2268 ThreadState* state = ThreadState::current(); |
| 2269 RELEASE_ASSERT(!state->isInGC()); |
2269 ThreadState::GCState originalGCState = state->gcState(); | 2270 ThreadState::GCState originalGCState = state->gcState(); |
2270 state->setGCState(ThreadState::StoppingOtherThreads); | 2271 state->setGCState(ThreadState::StoppingOtherThreads); |
2271 | 2272 |
2272 GCScope gcScope(stackState); | 2273 GCScope gcScope(stackState); |
2273 // Check if we successfully parked the other threads. If not we bail out of | 2274 // Check if we successfully parked the other threads. If not we bail out of |
2274 // the GC. | 2275 // the GC. |
2275 if (!gcScope.allThreadsParked()) { | 2276 if (!gcScope.allThreadsParked()) { |
2276 // Restore the original GCState. | 2277 // Restore the original GCState. |
2277 state->setGCState(originalGCState); | 2278 state->setGCState(originalGCState); |
2278 return; | 2279 return; |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2615 size_t Heap::s_allocatedObjectSize = 0; | 2616 size_t Heap::s_allocatedObjectSize = 0; |
2616 size_t Heap::s_allocatedSpace = 0; | 2617 size_t Heap::s_allocatedSpace = 0; |
2617 size_t Heap::s_markedObjectSize = 0; | 2618 size_t Heap::s_markedObjectSize = 0; |
2618 // We don't want to use 0 KB for the initial value because it may end up | 2619 // We don't want to use 0 KB for the initial value because it may end up |
2619 // triggering the first GC of some thread too prematurely. | 2620 // triggering the first GC of some thread too prematurely. |
2620 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024; | 2621 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024; |
2621 size_t Heap::s_externalObjectSizeAtLastGC = 0; | 2622 size_t Heap::s_externalObjectSizeAtLastGC = 0; |
2622 double Heap::s_estimatedMarkingTimePerByte = 0.0; | 2623 double Heap::s_estimatedMarkingTimePerByte = 0.0; |
2623 | 2624 |
2624 } // namespace blink | 2625 } // namespace blink |
OLD | NEW |