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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // collect garbage at this point. | 271 // collect garbage at this point. |
272 bool shouldGC(); | 272 bool shouldGC(); |
273 bool shouldForceConservativeGC(); | 273 bool shouldForceConservativeGC(); |
274 | 274 |
275 // If gcRequested returns true when a thread returns to its event | 275 // If gcRequested returns true when a thread returns to its event |
276 // loop the thread will initiate a garbage collection. | 276 // loop the thread will initiate a garbage collection. |
277 bool gcRequested(); | 277 bool gcRequested(); |
278 void setGCRequested(); | 278 void setGCRequested(); |
279 void clearGCRequested(); | 279 void clearGCRequested(); |
280 | 280 |
| 281 // Was the last GC forced for testing? This is set when garbage collection |
| 282 // is forced for testing and there are pointers on the stack. It remains |
| 283 // set until a garbage collection is triggered with no pointers on the stack
. |
| 284 // This is used for layout tests that trigger GCs and check if objects are |
| 285 // dead at a given point in time. That only reliably works when we get |
| 286 // precise GCs with no conservative stack scanning. |
| 287 void setForcedForTesting(bool); |
| 288 bool forcePreciseGCForTesting(); |
| 289 |
281 bool sweepRequested(); | 290 bool sweepRequested(); |
282 void setSweepRequested(); | 291 void setSweepRequested(); |
283 void clearSweepRequested(); | 292 void clearSweepRequested(); |
284 void performPendingSweep(); | 293 void performPendingSweep(); |
285 | 294 |
286 // Support for disallowing allocation. Mainly used for sanity | 295 // Support for disallowing allocation. Mainly used for sanity |
287 // checks asserts. | 296 // checks asserts. |
288 bool isAllocationAllowed() const { return !isAtSafePoint() && !m_noAllocatio
nCount; } | 297 bool isAllocationAllowed() const { return !isAtSafePoint() && !m_noAllocatio
nCount; } |
289 void enterNoAllocationScope() { m_noAllocationCount++; } | 298 void enterNoAllocationScope() { m_noAllocationCount++; } |
290 void leaveNoAllocationScope() { m_noAllocationCount--; } | 299 void leaveNoAllocationScope() { m_noAllocationCount--; } |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 friend class SafePointBarrier; | 499 friend class SafePointBarrier; |
491 | 500 |
492 void enterSafePoint(StackState, void*); | 501 void enterSafePoint(StackState, void*); |
493 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); | 502 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); |
494 void clearSafePointScopeMarker() | 503 void clearSafePointScopeMarker() |
495 { | 504 { |
496 m_safePointStackCopy.clear(); | 505 m_safePointStackCopy.clear(); |
497 m_safePointScopeMarker = 0; | 506 m_safePointScopeMarker = 0; |
498 } | 507 } |
499 | 508 |
| 509 void performPendingGC(StackState); |
| 510 |
500 // Finds the Blink HeapPage in this thread-specific heap | 511 // Finds the Blink HeapPage in this thread-specific heap |
501 // corresponding to a given address. Return 0 if the address is | 512 // corresponding to a given address. Return 0 if the address is |
502 // not contained in any of the pages. This does not consider | 513 // not contained in any of the pages. This does not consider |
503 // large objects. | 514 // large objects. |
504 BaseHeapPage* heapPageFromAddress(Address); | 515 BaseHeapPage* heapPageFromAddress(Address); |
505 | 516 |
506 // When ThreadState is detaching from non-main thread its | 517 // When ThreadState is detaching from non-main thread its |
507 // heap is expected to be empty (because it is going away). | 518 // heap is expected to be empty (because it is going away). |
508 // Perform registered cleanup tasks and garbage collection | 519 // Perform registered cleanup tasks and garbage collection |
509 // to sweep away any objects that are left on this heap. | 520 // to sweep away any objects that are left on this heap. |
(...skipping 23 matching lines...) Expand all Loading... |
533 ThreadIdentifier m_thread; | 544 ThreadIdentifier m_thread; |
534 OwnPtr<PersistentNode> m_persistents; | 545 OwnPtr<PersistentNode> m_persistents; |
535 StackState m_stackState; | 546 StackState m_stackState; |
536 intptr_t* m_startOfStack; | 547 intptr_t* m_startOfStack; |
537 intptr_t* m_endOfStack; | 548 intptr_t* m_endOfStack; |
538 void* m_safePointScopeMarker; | 549 void* m_safePointScopeMarker; |
539 Vector<Address> m_safePointStackCopy; | 550 Vector<Address> m_safePointStackCopy; |
540 bool m_atSafePoint; | 551 bool m_atSafePoint; |
541 Vector<Interruptor*> m_interruptors; | 552 Vector<Interruptor*> m_interruptors; |
542 bool m_gcRequested; | 553 bool m_gcRequested; |
| 554 bool m_forcePreciseGCForTesting; |
543 volatile int m_sweepRequested; | 555 volatile int m_sweepRequested; |
544 bool m_sweepInProgress; | 556 bool m_sweepInProgress; |
545 size_t m_noAllocationCount; | 557 size_t m_noAllocationCount; |
546 bool m_inGC; | 558 bool m_inGC; |
547 BaseHeap* m_heaps[NumberOfHeaps]; | 559 BaseHeap* m_heaps[NumberOfHeaps]; |
548 OwnPtr<HeapContainsCache> m_heapContainsCache; | 560 OwnPtr<HeapContainsCache> m_heapContainsCache; |
549 HeapStats m_stats; | 561 HeapStats m_stats; |
550 HeapStats m_statsAfterLastGC; | 562 HeapStats m_statsAfterLastGC; |
551 | 563 |
552 Vector<OwnPtr<CleanupTask> > m_cleanupTasks; | 564 Vector<OwnPtr<CleanupTask> > m_cleanupTasks; |
(...skipping 15 matching lines...) Expand all Loading... |
568 }; | 580 }; |
569 | 581 |
570 template<> class ThreadStateFor<AnyThread> { | 582 template<> class ThreadStateFor<AnyThread> { |
571 public: | 583 public: |
572 static ThreadState* state() { return ThreadState::current(); } | 584 static ThreadState* state() { return ThreadState::current(); } |
573 }; | 585 }; |
574 | 586 |
575 } | 587 } |
576 | 588 |
577 #endif // ThreadState_h | 589 #endif // ThreadState_h |
OLD | NEW |