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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 } | 496 } |
497 void allocationPointAdjusted(int arenaIndex); | 497 void allocationPointAdjusted(int arenaIndex); |
498 void promptlyFreed(size_t gcInfoIndex); | 498 void promptlyFreed(size_t gcInfoIndex); |
499 | 499 |
500 void accumulateSweepingTime(double time) { m_accumulatedSweepingTime += time
; } | 500 void accumulateSweepingTime(double time) { m_accumulatedSweepingTime += time
; } |
501 | 501 |
502 #if OS(WIN) && COMPILER(MSVC) | 502 #if OS(WIN) && COMPILER(MSVC) |
503 size_t threadStackSize(); | 503 size_t threadStackSize(); |
504 #endif | 504 #endif |
505 | 505 |
506 // Registers a closure that will be called while the thread is shutting down | 506 void freePersistentNode(PersistentNode*); |
507 // (i.e. ThreadState::isTerminating will be true), in order to allow for any | 507 |
508 // persistent handles that should be cleared. | 508 using PersistentClearCallback = void(*)(void*); |
509 void registerThreadShutdownHook(PassOwnPtr<SameThreadClosure>); | 509 |
| 510 void registerStaticPersistentNode(PersistentNode*, PersistentClearCallback); |
| 511 void releaseStaticPersistentNodes(); |
510 | 512 |
511 #if defined(LEAK_SANITIZER) | 513 #if defined(LEAK_SANITIZER) |
512 void registerStaticPersistentNode(PersistentNode*); | |
513 void releaseStaticPersistentNodes(); | |
514 | |
515 void enterStaticReferenceRegistrationDisabledScope(); | 514 void enterStaticReferenceRegistrationDisabledScope(); |
516 void leaveStaticReferenceRegistrationDisabledScope(); | 515 void leaveStaticReferenceRegistrationDisabledScope(); |
517 #endif | 516 #endif |
518 | 517 |
519 void resetHeapCounters(); | 518 void resetHeapCounters(); |
520 void increaseAllocatedObjectSize(size_t); | 519 void increaseAllocatedObjectSize(size_t); |
521 void decreaseAllocatedObjectSize(size_t); | 520 void decreaseAllocatedObjectSize(size_t); |
522 void increaseMarkedObjectSize(size_t); | 521 void increaseMarkedObjectSize(size_t); |
523 | 522 |
524 void callThreadShutdownHooks(); | 523 void callThreadShutdownHooks(); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 CallbackStack* m_threadLocalWeakCallbackStack; | 648 CallbackStack* m_threadLocalWeakCallbackStack; |
650 | 649 |
651 // Pre-finalizers are called in the reverse order in which they are | 650 // Pre-finalizers are called in the reverse order in which they are |
652 // registered by the constructors (including constructors of Mixin objects) | 651 // registered by the constructors (including constructors of Mixin objects) |
653 // for an object, by processing the m_orderedPreFinalizers back-to-front. | 652 // for an object, by processing the m_orderedPreFinalizers back-to-front. |
654 ListHashSet<PreFinalizer> m_orderedPreFinalizers; | 653 ListHashSet<PreFinalizer> m_orderedPreFinalizers; |
655 | 654 |
656 v8::Isolate* m_isolate; | 655 v8::Isolate* m_isolate; |
657 void (*m_traceDOMWrappers)(v8::Isolate*, Visitor*); | 656 void (*m_traceDOMWrappers)(v8::Isolate*, Visitor*); |
658 | 657 |
659 // Invoked while the thread is terminating. Intended to be used to free | |
660 // persistent pointers into the thread's heap. | |
661 Vector<OwnPtr<SameThreadClosure>> m_threadShutdownHooks; | |
662 | |
663 #if defined(ADDRESS_SANITIZER) | 658 #if defined(ADDRESS_SANITIZER) |
664 void* m_asanFakeStack; | 659 void* m_asanFakeStack; |
665 #endif | 660 #endif |
666 | 661 |
| 662 // PersistentNodes that are stored in static references; |
| 663 // references that either have to be cleared upon the thread |
| 664 // detaching from Oilpan and shutting down or references we |
| 665 // have to clear before initiating LSan's leak detection. |
| 666 HashMap<PersistentNode*, PersistentClearCallback> m_staticPersistents; |
| 667 |
667 #if defined(LEAK_SANITIZER) | 668 #if defined(LEAK_SANITIZER) |
668 // PersistentNodes that are stored in static references; | |
669 // references we have to clear before initiating LSan's leak detection. | |
670 HashSet<PersistentNode*> m_staticPersistents; | |
671 | |
672 // Count that controls scoped disabling of persistent registration. | 669 // Count that controls scoped disabling of persistent registration. |
673 size_t m_disabledStaticPersistentsRegistration; | 670 size_t m_disabledStaticPersistentsRegistration; |
674 #endif | 671 #endif |
675 | 672 |
676 // Ideally we want to allocate an array of size |gcInfoTableMax| but it will | 673 // Ideally we want to allocate an array of size |gcInfoTableMax| but it will |
677 // waste memory. Thus we limit the array size to 2^8 and share one entry | 674 // waste memory. Thus we limit the array size to 2^8 and share one entry |
678 // with multiple types of vectors. This won't be an issue in practice, | 675 // with multiple types of vectors. This won't be an issue in practice, |
679 // since there will be less than 2^8 types of objects in common cases. | 676 // since there will be less than 2^8 types of objects in common cases. |
680 static const int likelyToBePromptlyFreedArraySize = (1 << 8); | 677 static const int likelyToBePromptlyFreedArraySize = (1 << 8); |
681 static const int likelyToBePromptlyFreedArrayMask = likelyToBePromptlyFreedA
rraySize - 1; | 678 static const int likelyToBePromptlyFreedArrayMask = likelyToBePromptlyFreedA
rraySize - 1; |
(...skipping 20 matching lines...) Expand all Loading... |
702 | 699 |
703 template<> class ThreadStateFor<AnyThread> { | 700 template<> class ThreadStateFor<AnyThread> { |
704 STATIC_ONLY(ThreadStateFor); | 701 STATIC_ONLY(ThreadStateFor); |
705 public: | 702 public: |
706 static ThreadState* state() { return ThreadState::current(); } | 703 static ThreadState* state() { return ThreadState::current(); } |
707 }; | 704 }; |
708 | 705 |
709 } // namespace blink | 706 } // namespace blink |
710 | 707 |
711 #endif // ThreadState_h | 708 #endif // ThreadState_h |
OLD | NEW |