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