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 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
575 void shouldFlushHeapDoesNotContainCache() { m_shouldFlushHeapDoesNotContainC ache = true; } | 575 void shouldFlushHeapDoesNotContainCache() { m_shouldFlushHeapDoesNotContainC ache = true; } |
576 | 576 |
577 void registerTraceDOMWrappers(v8::Isolate* isolate, void (*traceDOMWrappers) (v8::Isolate*, Visitor*)) | 577 void registerTraceDOMWrappers(v8::Isolate* isolate, void (*traceDOMWrappers) (v8::Isolate*, Visitor*)) |
578 { | 578 { |
579 m_isolate = isolate; | 579 m_isolate = isolate; |
580 m_traceDOMWrappers = traceDOMWrappers; | 580 m_traceDOMWrappers = traceDOMWrappers; |
581 } | 581 } |
582 | 582 |
583 double collectionRate() const { return m_collectionRate; } | 583 double collectionRate() const { return m_collectionRate; } |
584 | 584 |
585 // By entering a gc-forbidden scope, conservative GCs will not | |
586 // be allowed while handling an out-of-line allocation request. | |
587 // Intended used when constructing subclasses of GC mixins, where | |
588 // the object being constructed cannot be safely traced & marked | |
589 // fully should a GC be allowed while its subclasses are being | |
590 // constructed. | |
591 void enterGCForbiddenScope() | |
592 { | |
593 m_gcForbiddenCount++; | |
594 } | |
595 | |
585 private: | 596 private: |
586 ThreadState(); | 597 ThreadState(); |
587 ~ThreadState(); | 598 ~ThreadState(); |
588 | 599 |
589 friend class SafePointBarrier; | 600 friend class SafePointBarrier; |
590 friend class SafePointAwareMutexLocker; | 601 friend class SafePointAwareMutexLocker; |
591 | 602 |
592 void enterSafePoint(StackState, void*); | 603 void enterSafePoint(StackState, void*); |
593 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); | 604 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); |
594 void clearSafePointScopeMarker() | 605 void clearSafePointScopeMarker() |
(...skipping 24 matching lines...) Expand all Loading... | |
619 void cleanup(); | 630 void cleanup(); |
620 void cleanupPages(); | 631 void cleanupPages(); |
621 | 632 |
622 void unregisterPreFinalizerInternal(void*); | 633 void unregisterPreFinalizerInternal(void*); |
623 void invokePreFinalizers(Visitor&); | 634 void invokePreFinalizers(Visitor&); |
624 | 635 |
625 #if ENABLE(GC_PROFILING) | 636 #if ENABLE(GC_PROFILING) |
626 void snapshotFreeList(); | 637 void snapshotFreeList(); |
627 #endif | 638 #endif |
628 | 639 |
629 // By entering a gc-forbidden scope, conservative GCs will not | 640 template<typename U> friend class GarbageCollectedMixinConstructorMarker; |
630 // be allowed while handling an out-of-line allocation request. | |
631 // Intended used when constructing subclasses of GC mixins, where | |
632 // the object being constructed cannot be safely traced & marked | |
633 // fully should a GC be allowed while its subclasses are being | |
634 // constructed. | |
635 template<typename U, typename V> friend class AllocateObjectTrait; | |
636 void enterGCForbiddenScope() { m_gcForbiddenCount++; } | |
637 void leaveGCForbiddenScope() | 641 void leaveGCForbiddenScope() |
638 { | 642 { |
639 ASSERT(m_gcForbiddenCount > 0); | 643 // FIXME: if a declared mixin object derives from another, |
640 m_gcForbiddenCount--; | 644 // its instantiation will leave this scope twice, which |
645 // will lead to unbalanced accounting. If that happens | |
646 // nestedly as part of constructing another mixin, this | |
647 // might result in the forbidden GC scope being exited | |
648 // too early. Theoretically; no Blink mixin objects | |
649 // known to have such nested constructors and be at risk. | |
650 if (m_gcForbiddenCount) | |
haraken
2015/03/05 02:20:19
Hmm, it is concerning that m_gcForbiddenCount can
| |
651 m_gcForbiddenCount--; | |
641 } | 652 } |
642 | 653 |
643 static WTF::ThreadSpecific<ThreadState*>* s_threadSpecific; | 654 static WTF::ThreadSpecific<ThreadState*>* s_threadSpecific; |
644 static uintptr_t s_mainThreadStackStart; | 655 static uintptr_t s_mainThreadStackStart; |
645 static uintptr_t s_mainThreadUnderestimatedStackSize; | 656 static uintptr_t s_mainThreadUnderestimatedStackSize; |
646 static SafePointBarrier* s_safePointBarrier; | 657 static SafePointBarrier* s_safePointBarrier; |
647 | 658 |
648 // We can't create a static member of type ThreadState here | 659 // We can't create a static member of type ThreadState here |
649 // because it will introduce global constructor and destructor. | 660 // because it will introduce global constructor and destructor. |
650 // We would like to manage lifetime of the ThreadState attached | 661 // We would like to manage lifetime of the ThreadState attached |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
762 m_locked = false; | 773 m_locked = false; |
763 } | 774 } |
764 | 775 |
765 MutexBase& m_mutex; | 776 MutexBase& m_mutex; |
766 bool m_locked; | 777 bool m_locked; |
767 }; | 778 }; |
768 | 779 |
769 } // namespace blink | 780 } // namespace blink |
770 | 781 |
771 #endif // ThreadState_h | 782 #endif // ThreadState_h |
OLD | NEW |