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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 DCHECK(!state->sweepForbidden()); | 566 DCHECK(!state->sweepForbidden()); |
567 DCHECK(!state->m_orderedPreFinalizers.contains( | 567 DCHECK(!state->m_orderedPreFinalizers.contains( |
568 PreFinalizer(self, T::invokePreFinalizer))); | 568 PreFinalizer(self, T::invokePreFinalizer))); |
569 state->m_orderedPreFinalizers.add( | 569 state->m_orderedPreFinalizers.add( |
570 PreFinalizer(self, T::invokePreFinalizer)); | 570 PreFinalizer(self, T::invokePreFinalizer)); |
571 } | 571 } |
572 }; | 572 }; |
573 | 573 |
574 static const char* gcReasonString(BlinkGC::GCReason); | 574 static const char* gcReasonString(BlinkGC::GCReason); |
575 | 575 |
| 576 // Returns |true| if |object| resides on this thread's heap. |
| 577 // It is well-defined to call this method on any heap allocated |
| 578 // reference, provided its associated heap hasn't been detached |
| 579 // and shut down. Its behavior is undefined for any other pointer |
| 580 // value. |
| 581 bool isOnThreadHeap(const void* object) const { |
| 582 return &fromObject(object)->heap() == &heap(); |
| 583 } |
| 584 |
576 private: | 585 private: |
577 template <typename T> | 586 template <typename T> |
578 friend class PrefinalizerRegistration; | 587 friend class PrefinalizerRegistration; |
579 enum SnapshotType { HeapSnapshot, FreelistSnapshot }; | 588 enum SnapshotType { HeapSnapshot, FreelistSnapshot }; |
580 | 589 |
581 explicit ThreadState(BlinkGC::ThreadHeapMode); | 590 explicit ThreadState(BlinkGC::ThreadHeapMode); |
582 ~ThreadState(); | 591 ~ThreadState(); |
583 | 592 |
584 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); | 593 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); |
585 void clearSafePointScopeMarker() { | 594 void clearSafePointScopeMarker() { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 class ThreadStateFor<AnyThread> { | 774 class ThreadStateFor<AnyThread> { |
766 STATIC_ONLY(ThreadStateFor); | 775 STATIC_ONLY(ThreadStateFor); |
767 | 776 |
768 public: | 777 public: |
769 static ThreadState* state() { return ThreadState::current(); } | 778 static ThreadState* state() { return ThreadState::current(); } |
770 }; | 779 }; |
771 | 780 |
772 } // namespace blink | 781 } // namespace blink |
773 | 782 |
774 #endif // ThreadState_h | 783 #endif // ThreadState_h |
OLD | NEW |