| 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 #endif |
| 517 |
| 512 private: | 518 private: |
| 513 enum SnapshotType { | 519 enum SnapshotType { |
| 514 HeapSnapshot, | 520 HeapSnapshot, |
| 515 FreelistSnapshot | 521 FreelistSnapshot |
| 516 }; | 522 }; |
| 517 | 523 |
| 518 ThreadState(); | 524 ThreadState(); |
| 519 ~ThreadState(); | 525 ~ThreadState(); |
| 520 | 526 |
| 521 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); | 527 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. | 650 // for an object, by processing the m_orderedPreFinalizers back-to-front. |
| 645 ListHashSet<PreFinalizer> m_orderedPreFinalizers; | 651 ListHashSet<PreFinalizer> m_orderedPreFinalizers; |
| 646 | 652 |
| 647 v8::Isolate* m_isolate; | 653 v8::Isolate* m_isolate; |
| 648 void (*m_traceDOMWrappers)(v8::Isolate*, Visitor*); | 654 void (*m_traceDOMWrappers)(v8::Isolate*, Visitor*); |
| 649 | 655 |
| 650 #if defined(ADDRESS_SANITIZER) | 656 #if defined(ADDRESS_SANITIZER) |
| 651 void* m_asanFakeStack; | 657 void* m_asanFakeStack; |
| 652 #endif | 658 #endif |
| 653 | 659 |
| 660 #if defined(LEAK_SANITIZER) |
| 661 // PersistentNodes that are stored in static references; |
| 662 // references we have to clear before initiating LSan's leak detection. |
| 663 HashSet<PersistentNode*> m_staticPersistents; |
| 664 #endif |
| 665 |
| 654 // Ideally we want to allocate an array of size |gcInfoTableMax| but it will | 666 // 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 | 667 // 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, | 668 // 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. | 669 // since there will be less than 2^8 types of objects in common cases. |
| 658 static const int likelyToBePromptlyFreedArraySize = (1 << 8); | 670 static const int likelyToBePromptlyFreedArraySize = (1 << 8); |
| 659 static const int likelyToBePromptlyFreedArrayMask = likelyToBePromptlyFreedA
rraySize - 1; | 671 static const int likelyToBePromptlyFreedArrayMask = likelyToBePromptlyFreedA
rraySize - 1; |
| 660 OwnPtr<int[]> m_likelyToBePromptlyFreed; | 672 OwnPtr<int[]> m_likelyToBePromptlyFreed; |
| 661 }; | 673 }; |
| 662 | 674 |
| 663 template<ThreadAffinity affinity> class ThreadStateFor; | 675 template<ThreadAffinity affinity> class ThreadStateFor; |
| 664 | 676 |
| 665 template<> class ThreadStateFor<MainThreadOnly> { | 677 template<> class ThreadStateFor<MainThreadOnly> { |
| 666 public: | 678 public: |
| 667 static ThreadState* state() | 679 static ThreadState* state() |
| 668 { | 680 { |
| 669 // This specialization must only be used from the main thread. | 681 // This specialization must only be used from the main thread. |
| 670 ASSERT(ThreadState::current()->isMainThread()); | 682 ASSERT(ThreadState::current()->isMainThread()); |
| 671 return ThreadState::mainThreadState(); | 683 return ThreadState::mainThreadState(); |
| 672 } | 684 } |
| 673 }; | 685 }; |
| 674 | 686 |
| 675 template<> class ThreadStateFor<AnyThread> { | 687 template<> class ThreadStateFor<AnyThread> { |
| 676 public: | 688 public: |
| 677 static ThreadState* state() { return ThreadState::current(); } | 689 static ThreadState* state() { return ThreadState::current(); } |
| 678 }; | 690 }; |
| 679 | 691 |
| 680 } // namespace blink | 692 } // namespace blink |
| 681 | 693 |
| 682 #endif // ThreadState_h | 694 #endif // ThreadState_h |
| OLD | NEW |