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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 }; | 50 }; |
51 | 51 |
52 namespace blink { | 52 namespace blink { |
53 | 53 |
54 class BasePage; | 54 class BasePage; |
55 class CallbackStack; | 55 class CallbackStack; |
56 class CrossThreadPersistentRegion; | 56 class CrossThreadPersistentRegion; |
57 struct GCInfo; | 57 struct GCInfo; |
58 class GarbageCollectedMixinConstructorMarker; | 58 class GarbageCollectedMixinConstructorMarker; |
59 class HeapObjectHeader; | 59 class HeapObjectHeader; |
| 60 class PersistentNode; |
60 class PersistentRegion; | 61 class PersistentRegion; |
61 class BaseHeap; | 62 class BaseHeap; |
62 class SafePointAwareMutexLocker; | 63 class SafePointAwareMutexLocker; |
63 class SafePointBarrier; | 64 class SafePointBarrier; |
64 class ThreadState; | 65 class ThreadState; |
65 class Visitor; | 66 class Visitor; |
66 | 67 |
67 // Declare that a class has a pre-finalizer. The pre-finalizer is called | 68 // Declare that a class has a pre-finalizer. The pre-finalizer is called |
68 // before any object gets swept, so it is safe to touch on-heap objects | 69 // before any object gets swept, so it is safe to touch on-heap objects |
69 // that may be collected in the same GC cycle. If you cannot avoid touching | 70 // that may be collected in the same GC cycle. If you cannot avoid touching |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 } | 503 } |
503 void allocationPointAdjusted(int heapIndex); | 504 void allocationPointAdjusted(int heapIndex); |
504 void promptlyFreed(size_t gcInfoIndex); | 505 void promptlyFreed(size_t gcInfoIndex); |
505 | 506 |
506 void accumulateSweepingTime(double time) { m_accumulatedSweepingTime += time
; } | 507 void accumulateSweepingTime(double time) { m_accumulatedSweepingTime += time
; } |
507 | 508 |
508 #if OS(WIN) && COMPILER(MSVC) | 509 #if OS(WIN) && COMPILER(MSVC) |
509 size_t threadStackSize(); | 510 size_t threadStackSize(); |
510 #endif | 511 #endif |
511 | 512 |
| 513 #if defined(LEAK_SANITIZER) |
| 514 void registerStaticPersistentNode(PersistentNode*); |
| 515 void releaseStaticPersistentNodes(); |
| 516 |
| 517 void enterStaticReferenceRegistrationDisabledScope(); |
| 518 void leaveStaticReferenceRegistrationDisabledScope(); |
| 519 #endif |
| 520 |
512 private: | 521 private: |
513 enum SnapshotType { | 522 enum SnapshotType { |
514 HeapSnapshot, | 523 HeapSnapshot, |
515 FreelistSnapshot | 524 FreelistSnapshot |
516 }; | 525 }; |
517 | 526 |
518 ThreadState(); | 527 ThreadState(); |
519 ~ThreadState(); | 528 ~ThreadState(); |
520 | 529 |
521 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); | 530 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 // for an object, by processing the m_orderedPreFinalizers back-to-front. | 653 // for an object, by processing the m_orderedPreFinalizers back-to-front. |
645 ListHashSet<PreFinalizer> m_orderedPreFinalizers; | 654 ListHashSet<PreFinalizer> m_orderedPreFinalizers; |
646 | 655 |
647 v8::Isolate* m_isolate; | 656 v8::Isolate* m_isolate; |
648 void (*m_traceDOMWrappers)(v8::Isolate*, Visitor*); | 657 void (*m_traceDOMWrappers)(v8::Isolate*, Visitor*); |
649 | 658 |
650 #if defined(ADDRESS_SANITIZER) | 659 #if defined(ADDRESS_SANITIZER) |
651 void* m_asanFakeStack; | 660 void* m_asanFakeStack; |
652 #endif | 661 #endif |
653 | 662 |
| 663 #if defined(LEAK_SANITIZER) |
| 664 // PersistentNodes that are stored in static references; |
| 665 // references we have to clear before initiating LSan's leak detection. |
| 666 HashSet<PersistentNode*> m_staticPersistents; |
| 667 |
| 668 // Count that controls scoped disabling of persistent registration. |
| 669 size_t m_disabledStaticPersistentsRegistration; |
| 670 #endif |
| 671 |
654 // Ideally we want to allocate an array of size |gcInfoTableMax| but it will | 672 // Ideally we want to allocate an array of size |gcInfoTableMax| but it will |
655 // waste memory. Thus we limit the array size to 2^8 and share one entry | 673 // waste memory. Thus we limit the array size to 2^8 and share one entry |
656 // with multiple types of vectors. This won't be an issue in practice, | 674 // with multiple types of vectors. This won't be an issue in practice, |
657 // since there will be less than 2^8 types of objects in common cases. | 675 // since there will be less than 2^8 types of objects in common cases. |
658 static const int likelyToBePromptlyFreedArraySize = (1 << 8); | 676 static const int likelyToBePromptlyFreedArraySize = (1 << 8); |
659 static const int likelyToBePromptlyFreedArrayMask = likelyToBePromptlyFreedA
rraySize - 1; | 677 static const int likelyToBePromptlyFreedArrayMask = likelyToBePromptlyFreedA
rraySize - 1; |
660 OwnPtr<int[]> m_likelyToBePromptlyFreed; | 678 OwnPtr<int[]> m_likelyToBePromptlyFreed; |
661 }; | 679 }; |
662 | 680 |
663 template<ThreadAffinity affinity> class ThreadStateFor; | 681 template<ThreadAffinity affinity> class ThreadStateFor; |
664 | 682 |
665 template<> class ThreadStateFor<MainThreadOnly> { | 683 template<> class ThreadStateFor<MainThreadOnly> { |
666 public: | 684 public: |
667 static ThreadState* state() | 685 static ThreadState* state() |
668 { | 686 { |
669 // This specialization must only be used from the main thread. | 687 // This specialization must only be used from the main thread. |
670 ASSERT(ThreadState::current()->isMainThread()); | 688 ASSERT(ThreadState::current()->isMainThread()); |
671 return ThreadState::mainThreadState(); | 689 return ThreadState::mainThreadState(); |
672 } | 690 } |
673 }; | 691 }; |
674 | 692 |
675 template<> class ThreadStateFor<AnyThread> { | 693 template<> class ThreadStateFor<AnyThread> { |
676 public: | 694 public: |
677 static ThreadState* state() { return ThreadState::current(); } | 695 static ThreadState* state() { return ThreadState::current(); } |
678 }; | 696 }; |
679 | 697 |
680 } // namespace blink | 698 } // namespace blink |
681 | 699 |
682 #endif // ThreadState_h | 700 #endif // ThreadState_h |
OLD | NEW |