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 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 void Heap::prepareForGC() | 1298 void Heap::prepareForGC() |
1299 { | 1299 { |
1300 ASSERT(ThreadState::isAnyThreadInGC()); | 1300 ASSERT(ThreadState::isAnyThreadInGC()); |
1301 ThreadState::AttachedThreadStateSet& threads = ThreadState::attachedThreads(
); | 1301 ThreadState::AttachedThreadStateSet& threads = ThreadState::attachedThreads(
); |
1302 for (ThreadState::AttachedThreadStateSet::iterator it = threads.begin(), end
= threads.end(); it != end; ++it) | 1302 for (ThreadState::AttachedThreadStateSet::iterator it = threads.begin(), end
= threads.end(); it != end; ++it) |
1303 (*it)->prepareForGC(); | 1303 (*it)->prepareForGC(); |
1304 } | 1304 } |
1305 | 1305 |
1306 void Heap::collectGarbage(ThreadState::StackState stackState, GCType gcType) | 1306 void Heap::collectGarbage(ThreadState::StackState stackState, GCType gcType) |
1307 { | 1307 { |
| 1308 if (gcType == ForcedForTesting && stackState != ThreadState::NoHeapPointersO
nStack) |
| 1309 ThreadState::current()->setForcedForTesting(true); |
1308 ThreadState::current()->clearGCRequested(); | 1310 ThreadState::current()->clearGCRequested(); |
1309 GCScope gcScope(stackState); | 1311 GCScope gcScope(stackState); |
1310 | 1312 |
1311 // Disallow allocation during garbage collection (but not | 1313 // Disallow allocation during garbage collection (but not |
1312 // during the finalization that happens when the gcScope is | 1314 // during the finalization that happens when the gcScope is |
1313 // torn down). | 1315 // torn down). |
1314 NoAllocationScope<AnyThread> noAllocationScope; | 1316 NoAllocationScope<AnyThread> noAllocationScope; |
1315 | 1317 |
1316 prepareForGC(); | 1318 prepareForGC(); |
1317 | 1319 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1374 // Force template instantiations for the types that we need. | 1376 // Force template instantiations for the types that we need. |
1375 template class HeapPage<FinalizedHeapObjectHeader>; | 1377 template class HeapPage<FinalizedHeapObjectHeader>; |
1376 template class HeapPage<HeapObjectHeader>; | 1378 template class HeapPage<HeapObjectHeader>; |
1377 template class ThreadHeap<FinalizedHeapObjectHeader>; | 1379 template class ThreadHeap<FinalizedHeapObjectHeader>; |
1378 template class ThreadHeap<HeapObjectHeader>; | 1380 template class ThreadHeap<HeapObjectHeader>; |
1379 | 1381 |
1380 Visitor* Heap::s_markingVisitor; | 1382 Visitor* Heap::s_markingVisitor; |
1381 CallbackStack* Heap::s_markingStack; | 1383 CallbackStack* Heap::s_markingStack; |
1382 CallbackStack* Heap::s_weakCallbackStack; | 1384 CallbackStack* Heap::s_weakCallbackStack; |
1383 } | 1385 } |
OLD | NEW |